diff options
author | Austin Seipp <austin@well-typed.com> | 2013-09-11 18:46:54 -0500 |
---|---|---|
committer | Austin Seipp <austin@well-typed.com> | 2013-09-11 18:47:15 -0500 |
commit | b20cf4ecbf244f091f4084c11ae2350d248ce6ef (patch) | |
tree | d595c6c632773bb4110468c23467f0b339096538 /ghc | |
parent | 1ef941a82eafb8f22c19e2643685679d2454c24a (diff) | |
download | haskell-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 'ghc')
-rw-r--r-- | ghc/GhciMonad.hs | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/ghc/GhciMonad.hs b/ghc/GhciMonad.hs index a3fe632493..54e7e0c984 100644 --- a/ghc/GhciMonad.hs +++ b/ghc/GhciMonad.hs @@ -46,6 +46,7 @@ import Data.IORef import System.CPUTime import System.Environment import System.IO +import Control.Applicative (Applicative(..)) import Control.Monad import GHC.Exts @@ -168,13 +169,17 @@ reifyGHCi f = GHCi f' startGHCi :: GHCi a -> GHCiState -> Ghc a startGHCi g state = do ref <- liftIO $ newIORef state; unGHCi g ref +instance Functor GHCi where + fmap = liftM + +instance Applicative GHCi where + pure = return + (<*>) = ap + instance Monad GHCi where (GHCi m) >>= k = GHCi $ \s -> m s >>= \a -> unGHCi (k a) s return a = GHCi $ \_ -> return a -instance Functor GHCi where - fmap f m = m >>= return . f - getGHCiState :: GHCi GHCiState getGHCiState = GHCi $ \r -> liftIO $ readIORef r setGHCiState :: GHCiState -> GHCi () |