Merge non-moving garbage collector
[ghc.git] / testsuite / tests / typecheck / should_compile / Tc239_Help.hs
1 module Tc239_Help ( WrapIO, WrapIO2 ) where
2
3 import Control.Applicative (Applicative(..))
4 import Control.Monad (liftM, ap)
5
6 newtype WrapIO e a = MkWrapIO { unwrap :: IO a }
7
8 type WrapIO2 a = WrapIO String a
9
10 instance Functor (WrapIO e) where
11 fmap = liftM
12
13 instance Applicative (WrapIO e) where
14 pure = return
15 (<*>) = ap
16
17 instance Monad (WrapIO e) where
18 return x = MkWrapIO (return x)
19
20 m >>= f = MkWrapIO (do x <- unwrap m
21 unwrap (f x) )
22