summaryrefslogtreecommitdiff
path: root/testsuite/tests/linear/should_compile/Linear3.hs
blob: 52b9571085cb4f2b8ed2b8e7daa98f0fa1dec083 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
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