X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=compiler%2FsimplCore%2FCoreMonad.lhs;h=90b062f1f04d199ed73baa4273a7b3574f2e7437;hb=63f6b0868f4948232f87bc4df52c9d3a2ec8f184;hp=f480eb3ce7cba6f64aaa1ff4f19913df5b44bc0d;hpb=9bcd95bad83ee937c178970e8b729732e680fe1e;p=ghc-hetmet.git diff --git a/compiler/simplCore/CoreMonad.lhs b/compiler/simplCore/CoreMonad.lhs index f480eb3..90b062f 100644 --- a/compiler/simplCore/CoreMonad.lhs +++ b/compiler/simplCore/CoreMonad.lhs @@ -36,7 +36,9 @@ module CoreMonad ( #endif ) where -import Name +#ifdef GHCI +import Name( Name ) +#endif import PrelNames ( iNTERACTIVE ) import HscTypes import Module ( Module ) @@ -123,9 +125,12 @@ instance Applicative CoreM where -- For use if the user has imported Control.Monad.Error from MTL -- Requires UndecidableInstances +#if __GLASGOW_HASKELL__ > 606 +-- see instance MonadPlus IOEnv instance MonadPlus IO => MonadPlus CoreM where mzero = CoreM (const mzero) m `mplus` n = CoreM (\rs -> unCoreM m rs `mplus` unCoreM n rs) +#endif instance MonadUnique CoreM where getUniqueSupplyM = do @@ -327,15 +332,16 @@ instance MonadThings CoreM where \subsection{Template Haskell interoperability} \begin{code} - #ifdef GHCI --- | Attempt to convert a Template Haskell name to one that GHC can understand. Original TH names such as those you get when you --- use the @'foo@ syntax will be translated to their equivalent GHC name exactly. Qualified or unqualifed TH names will be dynamically --- bound to names in the module being compiled, if possible. Exact TH names will be bound to the name they represent, exactly. +-- | Attempt to convert a Template Haskell name to one that GHC can +-- understand. Original TH names such as those you get when you use +-- the @'foo@ syntax will be translated to their equivalent GHC name +-- exactly. Qualified or unqualifed TH names will be dynamically bound +-- to names in the module being compiled, if possible. Exact TH names +-- will be bound to the name they represent, exactly. thNameToGhcName :: TH.Name -> CoreM (Maybe Name) thNameToGhcName th_name = do hsc_env <- getHscEnv liftIO $ initTcForLookup hsc_env (lookupThName_maybe th_name) #endif - \end{code}