summaryrefslogtreecommitdiff
path: root/compiler/typecheck
diff options
context:
space:
mode:
authorAustin Seipp <austin@well-typed.com>2013-09-11 18:46:54 -0500
committerAustin Seipp <austin@well-typed.com>2013-09-11 18:47:15 -0500
commitb20cf4ecbf244f091f4084c11ae2350d248ce6ef (patch)
treed595c6c632773bb4110468c23467f0b339096538 /compiler/typecheck
parent1ef941a82eafb8f22c19e2643685679d2454c24a (diff)
downloadhaskell-b20cf4ecbf244f091f4084c11ae2350d248ce6ef.tar.gz
Fix AMP warnings.
Authored-by: David Luposchainsky <dluposchainsky@gmail.com> Signed-off-by: Austin Seipp <austin@well-typed.com>
Diffstat (limited to 'compiler/typecheck')
-rw-r--r--compiler/typecheck/TcTyDecls.lhs9
-rw-r--r--compiler/typecheck/TcType.lhs9
2 files changed, 18 insertions, 0 deletions
diff --git a/compiler/typecheck/TcTyDecls.lhs b/compiler/typecheck/TcTyDecls.lhs
index 5091cab802..4f3971b7d7 100644
--- a/compiler/typecheck/TcTyDecls.lhs
+++ b/compiler/typecheck/TcTyDecls.lhs
@@ -48,6 +48,7 @@ import UniqSet
import Util
import Maybes
import Data.List
+import Control.Applicative (Applicative(..))
import Control.Monad
\end{code}
@@ -772,6 +773,14 @@ data RoleInferenceInfo = RII { var_ns :: VarPositions
newtype RoleM a = RM { unRM :: Maybe RoleInferenceInfo
-> RoleInferenceState
-> (a, RoleInferenceState) }
+
+instance Functor RoleM where
+ fmap = liftM
+
+instance Applicative RoleM where
+ pure = return
+ (<*>) = ap
+
instance Monad RoleM where
return x = RM $ \_ state -> (x, state)
a >>= f = RM $ \m_info state -> let (a', state') = unRM a m_info state in
diff --git a/compiler/typecheck/TcType.lhs b/compiler/typecheck/TcType.lhs
index af67808044..fddd1607c3 100644
--- a/compiler/typecheck/TcType.lhs
+++ b/compiler/typecheck/TcType.lhs
@@ -182,6 +182,8 @@ import Outputable
import FastString
import Data.IORef
+import Control.Monad (liftM, ap)
+import Control.Applicative (Applicative(..))
\end{code}
%************************************************************************
@@ -1048,6 +1050,13 @@ data OccCheckResult a
| OC_NonTyVar
| OC_Occurs
+instance Functor OccCheckResult where
+ fmap = liftM
+
+instance Applicative OccCheckResult where
+ pure = return
+ (<*>) = ap
+
instance Monad OccCheckResult where
return x = OC_OK x
OC_OK x >>= k = k x