packages feed

hint 0.3.3.2 → 0.3.3.3

raw patch · 9 files changed

+88/−16 lines, 9 filesdep ~MonadCatchIO-mtldep ~ghcdep ~unixPVP: major bump suggested

API removals or changes: PVP suggests a major version bump

Dependency ranges changed: MonadCatchIO-mtl, ghc, unix

API changes (from Hackage documentation)

- Language.Haskell.Interpreter: as :: Typeable a => a
- Language.Haskell.Interpreter: infer :: Typeable a => a
+ Language.Haskell.Interpreter: as, infer :: Typeable a => a

Files

AUTHORS view
@@ -8,3 +8,6 @@ Fernando Benavides Pasqualino Titto Assini Carl Howells+Daniel Wagner+Bryan O'Sullivan+Conrad Parker
README view
@@ -20,5 +20,5 @@  To get a copy of the darcs repository: -darcs get http://code.haskell.org/hint/devel+darcs get http://darcsden.com/jcpetruzza/hint 
hint.cabal view
@@ -1,5 +1,5 @@ name:                hint-version:             0.3.3.2+version:             0.3.3.3 description:         This library defines an @Interpreter@ monad. It allows to load Haskell         modules, browse them, type-check and evaluate strings with Haskell@@ -16,7 +16,7 @@ license-file:       LICENSE author:             Daniel Gorin maintainer:         jcpetruzza@gmail.com-homepage:           http://projects.haskell.org/hint+homepage:           http://darcsden.com/jcpetruzza/hint  cabal-version:      >= 1.2.3 build-type:         Simple@@ -37,7 +37,7 @@                       filepath,                       utf8-string,                       extensible-exceptions,-                      MonadCatchIO-mtl >= 0.2+                      MonadCatchIO-mtl >= 0.3   if impl(ghc >= 6.8) {     build-depends:    random,                       directory@@ -56,7 +56,7 @@   }    if !os(windows) {-      build-depends:    unix >= 2.2.0.0 && < 2.5+      build-depends:    unix >= 2.2.0.0 && < 2.6   }    exposed-modules:    Language.Haskell.Interpreter
src/Hint/Compat.hs view
@@ -4,6 +4,10 @@  where +#if __GLASGOW_HASKELL__ < 702+import Control.Monad.Trans (liftIO)+#endif+ import qualified Hint.GHC as GHC  -- Kinds became a synonym for Type in GHC 6.8. We define this wrapper@@ -12,14 +16,34 @@  #if __GLASGOW_HASKELL__ >= 700 -- supportedLanguages :: [String]-supportedExtensions = map (\(e,_,_) -> e) GHC.xFlags+supportedExtensions = map f GHC.xFlags+    where+#if __GLASGOW_HASKELL__ < 702+      f (e,_,_) = e+#else+      f (e,_,_,_) = e+#endif +#if __GLASGOW_HASKELL__ < 702 -- setContext :: GHC.GhcMonad m => [GHC.Module] -> [GHC.Module] -> m () setContext xs = GHC.setContext xs . map (\y -> (y,Nothing))  getContext :: GHC.GhcMonad m => m ([GHC.Module], [GHC.Module]) getContext = fmap (\(as,bs) -> (as,map fst bs)) GHC.getContext+#else +-- Keep setContext/getContext unmodified for use where the results of getContext+-- are simply restored by setContext, in which case we don't really care about the+-- particular type of b.++-- setContext :: GHC.GhcMonad m => [GHC.Module] -> [b] -> m ()+setContext = GHC.setContext++-- getContext :: GHC.GhcMonad m => m ([GHC.Module], [b])+getContext = GHC.getContext++#endif+ mkPState = GHC.mkPState  #else@@ -35,7 +59,33 @@ mkPState df buf loc = GHC.mkPState buf loc df #endif +-- Explicitly-typed variants of getContext/setContext, for use where we modify+-- or override the context.+#if __GLASGOW_HASKELL__ < 702+setContextModules :: GHC.GhcMonad m => [GHC.Module] -> [GHC.Module] -> m ()+setContextModules = setContext +getContextNames :: GHC.GhcMonad m => m([String], [String])+getContextNames = fmap (\(as,bs) -> (map name as, map name bs)) getContext+    where name = GHC.moduleNameString . GHC.moduleName+#else+setContextModules :: GHC.GhcMonad m => [GHC.Module] -> [GHC.Module] -> m ()+setContextModules as = GHC.setContext as . map (GHC.simpleImportDecl . GHC.moduleName)++getContextNames :: GHC.GhcMonad m => m([String], [String])+getContextNames = fmap (\(as,bs) -> (map name as, map decl bs)) GHC.getContext+    where name = GHC.moduleNameString . GHC.moduleName+          decl = GHC.moduleNameString . GHC.unLoc . GHC.ideclName+#endif++#if __GLASGOW_HASKELL__ < 702+mkSrcLoc = GHC.mkSrcLoc+stringToStringBuffer = liftIO . GHC.stringToStringBuffer+#else+mkSrcLoc = GHC.mkRealSrcLoc+stringToStringBuffer = return . GHC.stringToStringBuffer+#endif+ #if __GLASGOW_HASKELL__ >= 610 configureDynFlags :: GHC.DynFlags -> GHC.DynFlags configureDynFlags dflags = dflags{GHC.ghcMode    = GHC.CompManager,@@ -110,12 +160,21 @@                                   GHC.ghcLink    = GHC.LinkInMemory} #endif -  -- 6.08 and above+#if __GLASGOW_HASKELL__ < 701+  -- 6.08 - 7.0.4 pprType :: GHC.Type -> (GHC.PprStyle -> GHC.Doc) pprType = GHC.pprTypeForUser False -- False means drop explicit foralls  pprKind :: GHC.Kind -> (GHC.PprStyle -> GHC.Doc) pprKind = pprType+#else+  -- 7.2.1 and above+pprType :: GHC.Type -> GHC.SDoc+pprType = GHC.pprTypeForUser False -- False means drop explicit foralls++pprKind :: GHC.Kind -> GHC.SDoc+pprKind = pprType+#endif  #elif __GLASGOW_HASKELL__ >= 606   -- 6.6 only
src/Hint/Context.hs view
@@ -56,9 +56,7 @@        return PhantomModule{pm_name = mod_name, pm_file = tmp_dir </> nums}  allModulesInContext :: MonadInterpreter m => m ([ModuleName], [ModuleName])-allModulesInContext =-    do (l, i) <- runGhc Compat.getContext-       return (map fromGhcRep_ l, map fromGhcRep_ i)+allModulesInContext = runGhc Compat.getContextNames  addPhantomModule :: MonadInterpreter m                  => (ModuleName -> ModuleText)@@ -248,7 +246,7 @@        pm <- maybe (return []) (findModule . pm_name >=> return . return) new_pm        (old_top_level, _) <- runGhc Compat.getContext        let new_top_level = pm ++ old_top_level-       runGhc2 Compat.setContext new_top_level unqual_mods+       runGhc2 Compat.setContextModules new_top_level unqual_mods        --        onState (\s ->s{qual_imports = quals}) 
src/Hint/GHC.hs view
@@ -19,6 +19,9 @@ #elif __GLASGOW_HASKELL__ < 608     module SrcLoc, #endif+#if __GLASGOW_HASKELL__ >= 702+    module SrcLoc,+#endif )  where@@ -32,7 +35,7 @@ import GHC hiding ( Phase ) #endif -import Outputable   ( PprStyle, ppr,+import Outputable   ( PprStyle, SDoc, ppr,                       showSDoc, showSDocForUser, showSDocUnqual,                       withPprStyle, defaultErrStyle ) import ErrUtils     ( Message, mkLocMessage  )@@ -44,7 +47,7 @@ import FastString   ( fsLit )  #if __GLASGOW_HASKELL__ >= 700-import DynFlags     ( xFlags, xopt )+import DynFlags     ( supportedLanguagesAndExtensions, xFlags, xopt ) #else import DynFlags     ( supportedLanguages ) #endif@@ -52,5 +55,9 @@ #if __GLASGOW_HASKELL__ >= 608 import PprTyThing   ( pprTypeForUser ) #elif __GLASGOW_HASKELL__ < 608-import SrcLoc       ( SrcSpan, noSrcLoc )+import SrcLoc       ( SrcSpan )+#endif++#if __GLASGOW_HASKELL__ >= 702+import SrcLoc       ( mkRealSrcLoc ) #endif
src/Hint/InterpreterT.hs view
@@ -118,7 +118,11 @@        _ <- runGhc1 GHC.setSessionDynFlags df2{GHC.log_action = log_handler}  #if __GLASGOW_HASKELL__ >= 700+#if __GLASGOW_HASKELL__ >= 702+       let extMap      = map (\(a,_,b,_) -> (a,b)) GHC.xFlags+#else        let extMap      = map (\(a,b,_) -> (a,b)) GHC.xFlags+#endif        let toOpt e     = let err = error ("init error: unknown ext:" ++ show e)                          in fromMaybe err (lookup e extMap)        let getOptVal e = (asExtension e, GHC.xopt (toOpt e) df2)
src/Hint/Parsers.hs view
@@ -23,10 +23,10 @@ runParser parser expr =     do dyn_fl <- runGhc GHC.getSessionDynFlags        ---       buf <- liftIO $ GHC.stringToStringBuffer expr+       buf <- Compat.stringToStringBuffer expr        --        -- ghc >= 7 panics if noSrcLoc is given-       let srcLoc = GHC.mkSrcLoc (GHC.fsLit "<hint>") 1 1+       let srcLoc = Compat.mkSrcLoc (GHC.fsLit "<hint>") 1 1        let parse_res = GHC.unP parser (Compat.mkPState dyn_fl buf srcLoc)        --        case parse_res of
src/Hint/Reflection.hs view
@@ -61,6 +61,7 @@                                     (map getUnqualName $ GHC.tyConDataCons tc) asModElem (GHC.AClass c)    = Class (getUnqualName c)                                     (map getUnqualName $ GHC.classMethods c)+asModElem _ = error "asModElem: can't happen!"  getUnqualName :: GHC.NamedThing a => a -> String getUnqualName = GHC.showSDocUnqual . GHC.pprParenSymName