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

module LinearIf where

import Prelude (Bool(..), Char)

ifThenElse :: Bool -> a -> a -> a
ifThenElse True x _ = x
ifThenElse False _ y = y

f :: Bool #-> Char #-> Char #-> Char
f b x y = if b then x else y
  -- 'f' ought to be unrestricted in all three arguments because it desugars to
  -- > ifThenElse b x y