diff options
Diffstat (limited to 'testsuite/tests/linear/should_compile/Linear3.hs')
-rw-r--r-- | testsuite/tests/linear/should_compile/Linear3.hs | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/testsuite/tests/linear/should_compile/Linear3.hs b/testsuite/tests/linear/should_compile/Linear3.hs new file mode 100644 index 0000000000..52b9571085 --- /dev/null +++ b/testsuite/tests/linear/should_compile/Linear3.hs @@ -0,0 +1,25 @@ +{-# LANGUAGE LinearTypes #-} +{-# LANGUAGE UnicodeSyntax #-} +module Linear3 where + +correctApp1 :: (a⊸b) ⊸ a ⊸ b +correctApp1 f a = f a + +correctApp2 :: (a⊸a) -> a ⊸ a +correctApp2 f a = f (f a) + +correctApp3 :: Int ⊸ Int +correctApp3 x = f x + where + f :: Int ⊸ Int + f y = y + +correctApp4 :: Int ⊸ Int +correctApp4 x = f (f x) + where + f :: Int ⊸ Int + f y = y + +correctIf :: Bool ⊸ a ⊸ a +correctIf x n = + if x then n else n |