1{-# LANGUAGE LinearTypes #-}
2{-# LANGUAGE UnicodeSyntax #-}
3module Linear14 where
4
5-- Inference-related behaviour. Slightly sub-optimal still.
6
7bind1 :: (d ⊸ (ab) ⊸ c) ⊸ d ⊸ (ab) ⊸ c
8bind1 b x f = b x (\a -> f a)
9
10newtype I a = I a
11
12bind2 :: (d ⊸ (ab) ⊸ c) ⊸ d ⊸ (I ab) ⊸ c
13bind2 b x f = b x (\a -> f (I a))
14
15bind3 :: (dI (ab) ⊸ c) ⊸ d ⊸ (ab) ⊸ c
16bind3 b x f = b x (I (\a -> f a))
17
18bind4 :: (dI ((aa') ⊸ b) ⊸ c) ⊸ d ⊸ ((aa')⊸b) ⊸ c
19bind4 b x f = b x (I (\g -> f g))
20
21bind5 :: (d ⊸ ((aa') ⊸ b) ⊸ c) ⊸ d ⊸ ((aa')⊸b) ⊸ c
22bind5 b x f = b x (\g -> f (\a -> g a))
23
24bind6 :: (dI ((aa') ⊸ b) ⊸ c) ⊸ d ⊸ ((aa')⊸b) ⊸ c
25bind6 b x f = b x (I (\g -> f (\a -> g a)))
26
27