From: Pepe Iborra Date: Thu, 9 Aug 2007 16:09:33 +0000 (+0000) Subject: Functor instance for the GHCi monad X-Git-Url: http://git.megacz.com/?p=ghc-hetmet.git;a=commitdiff_plain;h=ae460dc3e684b09cb5e1a9072a7d37be2003b5bb Functor instance for the GHCi monad --- diff --git a/compiler/ghci/GhciMonad.hs b/compiler/ghci/GhciMonad.hs index f68da83..82aade4 100644 --- a/compiler/ghci/GhciMonad.hs +++ b/compiler/ghci/GhciMonad.hs @@ -111,6 +111,9 @@ instance Monad GHCi where (GHCi m) >>= k = GHCi $ \s -> m s >>= \a -> unGHCi (k a) s return a = GHCi $ \s -> return a +instance Functor GHCi where + fmap f m = m >>= return . f + ghciHandleDyn :: Typeable t => (t -> GHCi a) -> GHCi a -> GHCi a ghciHandleDyn h (GHCi m) = GHCi $ \s -> Exception.catchDyn (m s) (\e -> unGHCi (h e) s)