blob: 9ddd5ce50bb4cedfdde44f63c60baf0861b8f697 (
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 %1 -> Char %1 -> Char %1 -> 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
|