hint 0.4.1.0 → 0.4.2.0
raw patch · 6 files changed
+34/−23 lines, 6 filesdep ~exceptionsdep ~ghcdep ~ghc-mtl
Dependency ranges changed: exceptions, ghc, ghc-mtl
Files
- CHANGELOG.markdown +5/−0
- hint.cabal +9/−3
- src/Hint/Base.hs +7/−7
- src/Hint/InterpreterT.hs +11/−11
- src/Hint/SignalHandlers.hs +1/−1
- src/Language/Haskell/Interpreter/Unsafe.hs +1/−1
CHANGELOG.markdown view
@@ -1,3 +1,8 @@+0.4.2.0+-------++ * Based on exceptions-0.6+ 0.4.1.0 -------
hint.cabal view
@@ -1,5 +1,5 @@ name: hint-version: 0.4.1.0+version: 0.4.2.0 description: This library defines an @Interpreter@ monad. It allows to load Haskell modules, browse them, type-check and evaluate strings with Haskell@@ -27,6 +27,10 @@ examples/example.hs examples/SomeModule.hs +source-repository head+ type: darcs+ location: http://hub.darcs.net/jcpetruzza/hint+ Test-Suite unit-tests type: exitcode-stdio-1.0 hs-source-dirs: unit-tests@@ -54,14 +58,16 @@ if impl(ghc >= 6.10) { build-depends: base >= 4, base < 5,- ghc-mtl == 1.2.*+ ghc-mtl == 1.2.1.* -- version 1.1.* uses exceptions instead of MonadCatchIO -- version 1.2.* uses the exceptions-0.4 api+ -- version 1.2.1.* uses the exceptions-0.6 api } else { build-depends: base >= 3, base < 4 } }- else { -- ghc < 6.8+ else {+ -- ghc < 6.8 build-depends: utf8-string < 0.3 }
src/Hint/Base.hs view
@@ -43,7 +43,7 @@ ghcVersion :: Int ghcVersion = __GLASGOW_HASKELL__ -class (MonadIO m, MonadCatch m) => MonadInterpreter m where+class (MonadIO m, MonadMask m) => MonadInterpreter m where fromSession :: FromSession m a modifySessionRef :: ModifySessionRef m a runGhc :: RunGhc m a@@ -106,27 +106,27 @@ adjust = id type RunGhc m a =- (forall n.(MonadIO n, MonadCatch n,Functor n) => GHC.GhcT n a)+ (forall n.(MonadIO n, MonadMask n,Functor n) => GHC.GhcT n a) -> m a type RunGhc1 m a b =- (forall n.(MonadIO n, MonadCatch n, Functor n) => a -> GHC.GhcT n b)+ (forall n.(MonadIO n, MonadMask n, Functor n) => a -> GHC.GhcT n b) -> (a -> m b) type RunGhc2 m a b c =- (forall n.(MonadIO n, MonadCatch n, Functor n) => a -> b -> GHC.GhcT n c)+ (forall n.(MonadIO n, MonadMask n, Functor n) => a -> b -> GHC.GhcT n c) -> (a -> b -> m c) type RunGhc3 m a b c d =- (forall n.(MonadIO n, MonadCatch n, Functor n) => a -> b -> c -> GHC.GhcT n d)+ (forall n.(MonadIO n, MonadMask n, Functor n) => a -> b -> c -> GHC.GhcT n d) -> (a -> b -> c -> m d) type RunGhc4 m a b c d e =- (forall n.(MonadIO n, MonadCatch n, Functor n) => a -> b -> c -> d -> GHC.GhcT n e)+ (forall n.(MonadIO n, MonadMask n, Functor n) => a -> b -> c -> d -> GHC.GhcT n e) -> (a -> b -> c -> d -> m e) type RunGhc5 m a b c d e f =- (forall n.(MonadIO n, MonadCatch n, Functor n) => a->b->c->d->e->GHC.GhcT n f)+ (forall n.(MonadIO n, MonadMask n, Functor n) => a->b->c->d->e->GHC.GhcT n f) -> (a -> b -> c -> d -> e -> m f) #endif
src/Hint/InterpreterT.hs view
@@ -39,9 +39,9 @@ newtype InterpreterT m a = InterpreterT{ unInterpreterT :: ReaderT InterpreterSession (ErrorT InterpreterError m) a}- deriving (Functor, Monad, MonadIO, MonadThrow,MonadCatch)+ deriving (Functor, Monad, MonadIO, MonadThrow,MonadCatch,MonadMask) -execute :: (MonadIO m, MonadCatch m, Functor m)+execute :: (MonadIO m, MonadMask m, Functor m) => InterpreterSession -> InterpreterT m a -> m (Either InterpreterError a)@@ -50,7 +50,7 @@ instance MonadTrans InterpreterT where lift = InterpreterT . lift . lift -runGhc_impl :: (MonadIO m, MonadThrow m, MonadCatch m, Functor m) => RunGhc (InterpreterT m) a+runGhc_impl :: (MonadIO m, MonadThrow m, MonadMask m, Functor m) => RunGhc (InterpreterT m) a runGhc_impl f = do s <- fromSession versionSpecific -- i.e. the ghc session r <- liftIO $ f' s either throwError return r@@ -63,9 +63,9 @@ newtype InterpreterT m a = InterpreterT{ unInterpreterT :: ReaderT InterpreterSession (GHC.GhcT m) a}- deriving (Functor, Monad, MonadIO, MonadThrow, MonadCatch)+ deriving (Functor, Monad, MonadIO, MonadThrow, MonadCatch, MonadMask) -execute :: (MonadIO m, MonadCatch m, Functor m)+execute :: (MonadIO m, MonadMask m, Functor m) => InterpreterSession -> InterpreterT m a -> m (Either InterpreterError a)@@ -78,7 +78,7 @@ instance MonadTrans InterpreterT where lift = InterpreterT . lift . lift -runGhc_impl :: (MonadIO m, MonadThrow m, MonadCatch m, Functor m) => RunGhc (InterpreterT m) a+runGhc_impl :: (MonadIO m, MonadThrow m, MonadMask m, Functor m) => RunGhc (InterpreterT m) a runGhc_impl a = InterpreterT (lift a) `catches`@@ -99,7 +99,7 @@ -- ================= Executing the interpreter ================== -initialize :: (MonadIO m, MonadThrow m, MonadCatch m, Functor m)+initialize :: (MonadIO m, MonadThrow m, MonadMask m, Functor m) => [String] -> InterpreterT m () initialize args =@@ -146,7 +146,7 @@ -- NB. The underlying ghc will overwrite certain signal handlers -- (SIGINT, SIGHUP, SIGTERM, SIGQUIT on Posix systems, Ctrl-C handler on Windows). -- In future versions of hint, this might be controlled by the user.-runInterpreter :: (MonadIO m, MonadCatch m, Functor m)+runInterpreter :: (MonadIO m, MonadMask m, Functor m) => InterpreterT m a -> m (Either InterpreterError a) runInterpreter = runInterpreterWithArgs []@@ -154,7 +154,7 @@ -- | Executes the interpreter, setting args passed in as though they -- were command-line args. Returns @Left InterpreterError@ in case of -- error.-runInterpreterWithArgs :: (MonadIO m, MonadCatch m, Functor m)+runInterpreterWithArgs :: (MonadIO m, MonadMask m, Functor m) => [String] -> InterpreterT m a -> m (Either InterpreterError a)@@ -182,7 +182,7 @@ uniqueToken :: MVar () uniqueToken = unsafePerformIO $ newMVar () -ifInterpreterNotRunning :: (MonadIO m, MonadCatch m) => m a -> m a+ifInterpreterNotRunning :: (MonadIO m, MonadMask m) => m a -> m a ifInterpreterNotRunning action = do maybe_token <- liftIO $ tryTakeMVar uniqueToken case maybe_token of@@ -241,7 +241,7 @@ -- The MonadInterpreter instance -instance (MonadIO m, MonadCatch m, Functor m) => MonadInterpreter (InterpreterT m) where+instance (MonadIO m, MonadMask m, Functor m) => MonadInterpreter (InterpreterT m) where fromSession f = InterpreterT $ fmap f ask -- modifySessionRef target f =
src/Hint/SignalHandlers.hs view
@@ -36,5 +36,5 @@ #endif -protectHandlers :: (MonadIO m, MonadCatch m) => m a -> m a+protectHandlers :: (MonadIO m, MonadMask m) => m a -> m a protectHandlers a = bracket saveHandlers restoreHandlers $ const a
src/Language/Haskell/Interpreter/Unsafe.hs view
@@ -24,7 +24,7 @@ -- context. -- -- Warning: Some options may interact badly with the Interpreter.-unsafeRunInterpreterWithArgs :: (MonadCatch m, MonadIO m, Functor m)+unsafeRunInterpreterWithArgs :: (MonadMask m, MonadIO m, Functor m) => [String] -> InterpreterT m a -> m (Either InterpreterError a)