summaryrefslogtreecommitdiff
blob: 2773bdc5a631645b3b07b1b46db2f8c517faf957 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
--- syb-0.4.3-orig/tests/XML.hs	2014-12-31 19:40:41.000000000 +1100
+++ syb-0.4.3/tests/XML.hs	2015-01-02 12:47:10.082782760 +1100
@@ -13,6 +13,7 @@
 
 import Test.HUnit
 
+import Control.Applicative (Alternative(..), Applicative(..))
 import Control.Monad
 import Data.Maybe
 import Data.Generics
@@ -157,6 +158,17 @@
                         else Just (tail x, head x)
                )
 
+instance Functor ReadX where
+  fmap  = liftM
+
+instance Applicative ReadX where
+  pure  = return
+  (<*>) = ap
+
+instance Alternative ReadX where
+  (<|>) = mplus
+  empty = mzero
+
 -- ReadX is a monad!
 instance Monad ReadX where
   return x = ReadX (\y -> Just (y,x))
--- syb-0.4.3-orig/tests/Perm.hs	2014-12-31 19:40:41.000000000 +1100
+++ syb-0.4.3/tests/Perm.hs	2015-01-02 12:47:02.751422866 +1100
@@ -11,6 +11,7 @@
 
 import Test.HUnit
 
+import Control.Applicative (Alternative(..), Applicative(..))
 import Control.Monad
 import Data.Generics
 
@@ -44,6 +45,17 @@
                         else Just (tail x, head x)
                )
 
+instance Functor ReadT where
+  fmap  = liftM
+
+instance Applicative ReadT where
+  pure  = return
+  (<*>) = ap
+
+instance Alternative ReadT where
+  (<|>) = mplus
+  empty = mzero
+
 -- ReadT is a monad!
 instance Monad ReadT where
   return x = ReadT (\y -> Just (y,x))
--- syb-0.4.3-orig/tests/Bits.hs	2014-12-31 19:40:41.000000000 +1100
+++ syb-0.4.3/tests/Bits.hs	2015-01-02 12:46:37.842839944 +1100
@@ -39,6 +39,7 @@
 import Data.Generics
 import Data.Char
 import Data.Maybe
+import Control.Applicative (Alternative(..), Applicative(..))
 import Control.Monad
 import CompanyDatatypes
 
@@ -129,6 +130,16 @@
 data ReadB a = ReadB (Bin -> (Maybe a, Bin))
 unReadB (ReadB f) = f
 
+instance Functor ReadB where
+  fmap  = liftM
+
+instance Applicative ReadB where
+  pure  = return
+  (<*>) = ap
+
+instance Alternative ReadB where
+  (<|>) = mplus
+  empty = mzero
 
 -- It's a monad.
 instance Monad ReadB where
--- syb-0.4.3-orig/tests/Encode.hs	2014-12-31 19:40:41.000000000 +1100
+++ syb-0.4.3/tests/Encode.hs	2015-01-02 12:51:48.500949407 +1100
@@ -6,6 +6,8 @@
 
 module Encode () where
 
+import Control.Applicative (Applicative(..))
+import Control.Monad (ap, liftM)
 import Data.Generics
 
 data Bit = Zero | One
@@ -62,6 +64,11 @@
 -- Sec. 3.3 cont'd
 
 data EncM a   -- The encoder monad
+instance Functor EncM where
+  fmap  = liftM
+instance Applicative EncM where
+  pure  = return
+  (<*>) = ap
 instance Monad EncM
  where
   return  = undefined
--- syb-0.4.3-orig/tests/GRead2.hs	2014-12-31 19:40:41.000000000 +1100
+++ syb-0.4.3/tests/GRead2.hs	2015-01-02 12:51:27.524567019 +1100
@@ -10,6 +10,8 @@
 
 -}
 
+import Control.Applicative (Applicative(..))
+import Control.Monad (ap, liftM)
 import Data.Generics
 
 gread :: Data a => String -> Maybe a
@@ -18,6 +20,13 @@
 -- The decoder monad
 newtype DecM a = D (String -> Maybe (String, a))
 
+instance Functor DecM where
+    fmap  = liftM
+
+instance Applicative DecM where
+    pure  = return
+    (<*>) = ap
+
 instance Monad DecM where
     return a = D (\s -> Just (s,a))
     (D m) >>= k = D (\s ->
--- syb-0.4.3-orig/tests/Ext1.hs	2014-12-31 19:40:41.000000000 +1100
+++ syb-0.4.3/tests/Ext1.hs	2015-01-02 10:30:39.396517984 +1100
@@ -1,4 +1,5 @@
 {-# OPTIONS -fglasgow-exts #-}
+{-# LANGUAGE CPP #-}
 
 module Ext1 (tests) where
 
@@ -11,8 +12,11 @@
 import Test.HUnit
 
 import Data.Generics
+#if MIN_VERSION_base(4,8,0)
+import GHC.Base hiding(foldr)
+#else
 import GHC.Base
-
+#endif
 
 -- Unsafe coerce
 unsafeCoerce :: a -> b