summaryrefslogtreecommitdiff
path: root/testsuite/tests/linear/should_fail/Linear2.hs
blob: bb6f525f0147f4e780810fea95c53a9d14bbcf45 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
{-# LANGUAGE LinearTypes #-}
{-# LANGUAGE UnicodeSyntax #-}
module Linear2 where

dup :: a -> (a,a)
dup x = (x,x)

incorrectApp1 :: a ⊸ ((a,Int),(a,Int))
incorrectApp1 x = dup (x,0)

incorrectApp2 :: (a->b) -> a ⊸ b
incorrectApp2 f x = f x

incorrectIf :: Bool -> Int ⊸ Int
incorrectIf x n =
  if x then n else 0