hint 0.4.2.1 → 0.4.2.2
raw patch · 8 files changed
+44/−10 lines, 8 filesdep ~ghcdep ~utf8-stringPVP ok
version bump matches the API change (PVP)
Dependency ranges changed: ghc, utf8-string
API changes (from Hackage documentation)
Files
- AUTHORS +1/−0
- CHANGELOG.markdown +8/−0
- hint.cabal +2/−4
- src/Hint/Compat.hs +3/−1
- src/Hint/Context.hs +19/−2
- src/Hint/GHC.hs +3/−1
- src/Hint/InterpreterT.hs +7/−1
- unit-tests/run-unit-tests.hs +1/−1
AUTHORS view
@@ -16,3 +16,4 @@ Samuel Gélineau Jens Petersen Corentin Dupont+Nathaniel W. Filardo
CHANGELOG.markdown view
@@ -1,3 +1,11 @@+0.4.2.2+-------++ * Builds with ghc 7.10+ * Builds again with ghc 7.4+ * Drops dependency on utf8-string++ 0.4.2.1 -------
hint.cabal view
@@ -1,5 +1,5 @@ name: hint-version: 0.4.2.1+version: 0.4.2.2 description: This library defines an @Interpreter@ monad. It allows to load Haskell modules, browse them, type-check and evaluate strings with Haskell@@ -19,7 +19,6 @@ cabal-version: >= 1.9.2 build-type: Simple-tested-with: GHC==6.8.3, GHC==6.10 extra-source-files: README AUTHORS@@ -45,11 +44,10 @@ ,exceptions Library- build-depends: ghc > 6.6,+ build-depends: ghc >= 7.4, ghc-paths, mtl, filepath,- utf8-string, extensible-exceptions, exceptions if impl(ghc >= 6.8) {
src/Hint/Compat.hs view
@@ -22,7 +22,9 @@ -- supportedLanguages :: [String] supportedExtensions = map f GHC.xFlags where-#if (__GLASGOW_HASKELL__ < 702) || (__GLASGOW_HASKELL__ >= 704)+#if (__GLASGOW_HASKELL__ >= 710)+ f = GHC.flagSpecName+#elif (__GLASGOW_HASKELL__ < 702) || (__GLASGOW_HASKELL__ >= 704) f (e,_,_) = e #else f (e,_,_,_) = e
src/Hint/Context.hs view
@@ -37,7 +37,6 @@ import System.Random import System.FilePath import System.Directory-import qualified System.IO.UTF8 as UTF8 (writeFile) type ModuleText = String @@ -72,7 +71,7 @@ let t = Compat.fileTarget (pm_file pm) m = GHC.mkModuleName (pm_name pm) --- liftIO $ UTF8.writeFile (pm_file pm) (mod_text $ pm_name pm)+ liftIO $ writeFile (pm_file pm) (mod_text $ pm_name pm) -- onState (\s -> s{active_phantoms = pm:active_phantoms s}) mayFail (do -- GHC.load will remove all the modules from scope, so first@@ -145,6 +144,24 @@ -- -- The interpreter is 'reset' both before loading the modules and in the event -- of an error.+--+-- /IMPORTANT/: Like in a ghci session, this will also load (and interpret)+-- any dependency that is not available via an installed package. Make+-- sure that you are not loading any module that is also being used to+-- compile your application. In particular, you need to avoid modules+-- that define types that will later occur in an expression that you will+-- want to interpret.+--+-- The problem in doing this is that those types will have two incompatible+-- representations at runtime: 1) the one in the compiled code and 2) the+-- one in the interpreted code. When interpreting such an expression (bringing+-- it to program-code) you will likely get a segmentation fault, since the+-- latter representation will be used where the program assumes the former.+--+-- The rule of thumb is: never make the interpreter run on the directory+-- with the source code of your program! If you want your interpreted code to+-- use some type that is defined in your program, then put the defining module+-- on a library and make your program depend on that package. loadModules :: MonadInterpreter m => [String] -> m () loadModules fs = do -- first, unload everything, and do some clean-up reset
src/Hint/GHC.hs view
@@ -56,7 +56,9 @@ import Parser ( parseStmt, parseType ) import FastString ( fsLit ) -#if __GLASGOW_HASKELL__ >= 700+#if __GLASGOW_HASKELL__ >= 710+import DynFlags ( supportedLanguagesAndExtensions, xFlags, xopt, FlagSpec(..) )+#elif __GLASGOW_HASKELL__ >= 700 import DynFlags ( supportedLanguagesAndExtensions, xFlags, xopt ) #else import DynFlags ( supportedLanguages )
src/Hint/InterpreterT.hs view
@@ -91,7 +91,11 @@ where compilationError dynFlags = WontCompile+#if __GLASGOW_HASKELL__ >= 706 . map (GhcError . GHC.showSDoc dynFlags)+#else+ . map (GhcError . GHC.showSDoc)+#endif . GHC.pprErrMsgBagWithLoc . GHC.srcErrorMessages #endif@@ -122,7 +126,9 @@ #if __GLASGOW_HASKELL__ >= 700 #if __GLASGOW_HASKELL__ >= 702-#if __GLASGOW_HASKELL__ >= 704+#if __GLASGOW_HASKELL__ >= 710+ let extMap = map (\fs -> (GHC.flagSpecName fs, GHC.flagSpecFlag fs)) GHC.xFlags+#elif __GLASGOW_HASKELL__ >= 704 let extMap = map (\(a,b,_) -> (a,b)) GHC.xFlags #else let extMap = map (\(a,_,b,_) -> (a,b)) GHC.xFlags
unit-tests/run-unit-tests.hs view
@@ -1,6 +1,6 @@ module Main ( main ) where -import Prelude+import Prelude hiding ( catch ) import Control.Exception.Extensible ( ArithException(..) ) import Control.Monad.Catch as MC