modulespection 0.1.0.7 → 0.1.1.0
raw patch · 2 files changed
+13/−3 lines, 2 filesdep ~basedep ~template-haskell
Dependency ranges changed: base, template-haskell
Files
modulespection.cabal view
@@ -2,7 +2,7 @@ -- documentation, see http://haskell.org/cabal/users-guide/ name: modulespection-version: 0.1.0.7+version: 0.1.1.0 synopsis: Template Haskell for introspecting a module's declarations description: Collect all of the declarations in a module using Template Haskell (via the GHC API). @@ -70,8 +70,8 @@ -- other-modules: other-extensions: LambdaCase , FlexibleInstances- build-depends: base >=4.6 && <4.7- , template-haskell >=2.7 && <2.9+ build-depends: base >=4.6 && < 666+ , template-haskell >=2.7 , ghc-paths >=0.1 && <0.2 , ghc , temporary == 1.2.*
src/Language/Haskell/TH/Module/Magic.hs view
@@ -1,6 +1,7 @@ {-# LANGUAGE LambdaCase #-} {-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE CPP #-}+{-# LANGUAGE NamedFieldPuns #-} module Language.Haskell.TH.Module.Magic ( -- * Name Introspection names@@ -81,8 +82,10 @@ moduleDeclarations :: String -> Q [Dec] moduleDeclarations = mapMaybeM nameToMaybeDec <=< moduleNames +#if __GLASGOW_HASKELL__ < 707 instance MTL.MonadIO Ghc where liftIO = MonadUtils.liftIO+#endif instance MonadCatch Ghc where catch = gcatch@@ -166,8 +169,15 @@ instance GetNameMaybe (TyClDecl RdrName) where getNameMaybe = \case ForeignType x _ -> getNameMaybe x+#if __GLASGOW_HASKELL__ >= 707+ FamDecl x -> getNameMaybe $ fdLName x + SynDecl { tcdLName } -> getNameMaybe tcdLName+ DataDecl { tcdLName } -> getNameMaybe tcdLName+#else x@(TyFamily {}) -> getNameMaybe $ tcdLName x TyDecl x _ _ _ -> getNameMaybe x+#endif+ x@(ClassDecl {}) -> getNameMaybe $ tcdLName x instance GetNameMaybe (HsBindLR RdrName RdrName) where