@@ -24,10 +24,12 @@ test3 = \_ -> show (Data "testing")
24instance functorData :: Functor Data where
24instance functorData :: Functor Data where
25 (<$>) = liftM1
25 (<$>) = liftM1
27−instance appData :: Applicative Data where
27+instance applyData :: Apply Data where
29 (<*>) = ap
28 (<*>) = ap
30+instance applicativeData :: Applicative Data where
31instance monadData :: Prelude.Monad Data where
33instance monadData :: Prelude.Monad Data where
32 return = Data
34 return = Data
33 (>>=) (Data a) f = f a
35 (>>=) (Data a) f = f a
@@ -37,10 +39,12 @@ data Maybe a = Nothing | Just a
37instance functorMaybe :: Functor Maybe where
39instance functorMaybe :: Functor Maybe where
38 (<$>) = liftM1
40 (<$>) = liftM1
40−instance appMaybe :: Applicative Maybe where
42+instance applyMaybe :: Apply Maybe where
42 (<*>) = ap
43 (<*>) = ap
45+instance applicativeMaybe :: Applicative Maybe where
44instance monadMaybe :: Prelude.Monad Maybe where
48instance monadMaybe :: Prelude.Monad Maybe where
45 return = Just
49 return = Just
46 (>>=) Nothing _ = Nothing
50 (>>=) Nothing _ = Nothing
@@ -60,10 +64,12 @@ test6 = \_ -> show ["testing"]
60instance functorFunction :: Functor ((->) r) where
64instance functorFunction :: Functor ((->) r) where
61 (<$>) = liftM1
65 (<$>) = liftM1
63−instance appFunction :: Applicative ((->) r) where
67+instance applyFunction :: Apply ((->) r) where
65 (<*>) = ap
68 (<*>) = ap
70+instance applicativeFunction :: Applicative ((->) r) where
67instance monadFunction :: Prelude.Monad ((->) r) where
73instance monadFunction :: Prelude.Monad ((->) r) where
68 return a r = a
74 return a r = a
69 (>>=) f g r = g (f r) r
75 (>>=) f g r = g (f r) r
@@ -75,6 +81,6 @@ runReader r f = f r
75test9 _ = runReader 0 $ do
81test9 _ = runReader 0 $ do
77 return $ n + 1
83 return $ n + 1
79main = Debug.Trace.trace (test7 "Done")
85main = Debug.Trace.trace (test7 "Done")