blob: 3acbda19e171f4dd79137a8b5c60742b8648b094 (
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
|
diff --git a/src/Top/Implementation/TypeGraph/DefaultHeuristics.hs b/src/Top/Implementation/TypeGraph/DefaultHeuristics.hs
index 2cc5210..faf4c8c 100644
--- a/src/Top/Implementation/TypeGraph/DefaultHeuristics.hs
+++ b/src/Top/Implementation/TypeGraph/DefaultHeuristics.hs
@@ -1,2 +1,3 @@
+{-# LANGUAGE FlexibleContexts #-}
-----------------------------------------------------------------------------
-- | License : GPL
diff --git a/src/Top/Monad/Select.hs b/src/Top/Monad/Select.hs
index e5953cb..72276b4 100644
--- a/src/Top/Monad/Select.hs
+++ b/src/Top/Monad/Select.hs
@@ -16,4 +16,6 @@ module Top.Monad.Select
import Top.Util.Embedding
import Control.Monad.State
+import Control.Monad
+import Control.Applicative
--------------------------------------------------------
@@ -22,4 +24,11 @@ import Control.Monad.State
newtype Select t m a = Select (m a)
+instance Monad m => Functor (Select t m) where
+ fmap = liftM
+
+instance Monad m => Applicative (Select t m) where
+ pure = return
+ (<*>) = ap -- defined in Control.Monad
+
instance Monad m => Monad (Select t m) where
return a = Select (return a)
@@ -43,4 +52,11 @@ select = Select
data SelectFix (t :: (* -> *) -> *) (m :: * -> *) a = SelectFix (m a)
+instance Monad m => Functor (SelectFix t m) where
+ fmap = liftM
+
+instance Monad m => Applicative (SelectFix t m) where
+ pure = return
+ (<*>) = ap -- defined in Control.Monad
+
instance Monad m => Monad (SelectFix t m) where
return a = SelectFix (return a)
diff --git a/src/Top/Monad/StateFix.hs b/src/Top/Monad/StateFix.hs
index d77919d..bd8fb76 100644
--- a/src/Top/Monad/StateFix.hs
+++ b/src/Top/Monad/StateFix.hs
@@ -16,4 +16,6 @@ import Control.Monad.State
import Control.Monad.Identity
import Control.Monad.Writer
+import Control.Monad
+import Control.Applicative
type StateFix s = StateFixT s Identity
@@ -21,4 +23,11 @@ type StateFix s = StateFixT s Identity
data StateFixT s m a = Fix { unFix :: StateT (s (StateFixT s m)) m a }
+instance Monad m => Functor (StateFixT s m) where
+ fmap = liftM
+
+instance Monad m => Applicative (StateFixT s m) where
+ pure = return
+ (<*>) = ap -- defined in Control.Monad
+
instance Monad m => Monad (StateFixT s m) where
return = Fix . return
|