haskeline 0.3 → 0.3.1
raw patch · 3 files changed
+13/−6 lines, 3 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
+ System.Console.Haskeline.MonadException: handleDyn :: (Typeable exception, MonadException m) => (exception -> m a) -> m a -> m a
+ System.Console.Haskeline.MonadException: throwDynIO :: (Typeable exception, MonadIO m) => exception -> m a
Files
- System/Console/Haskeline.hs +2/−5
- System/Console/Haskeline/MonadException.hs +10/−0
- haskeline.cabal +1/−1
System/Console/Haskeline.hs view
@@ -65,7 +65,6 @@ import qualified System.IO.UTF8 as UTF8 import Data.Char (isSpace) import Control.Monad-import qualified Control.Exception as Exception import Data.Dynamic @@ -200,12 +199,10 @@ -- ^ Handler to run if Ctrl-C is pressed -> m a -- ^ Computation to run -> m a-handleInterrupt f = handle $ \e -> case Exception.dynExceptions e of- Just dyn | Just Interrupt <- fromDynamic dyn -> f- _ -> throwIO e+handleInterrupt f = handle (const f) throwInterrupt :: MonadIO m => m a-throwInterrupt = liftIO $ Exception.evaluate $ Exception.throwDyn Interrupt+throwInterrupt = throwDynIO Interrupt drawEffect :: (LineState s, LineState t, Term (d m),
System/Console/Haskeline/MonadException.hs view
@@ -9,6 +9,7 @@ import Control.Exception(Exception) import Control.Monad.Reader import Control.Monad.State+import Data.Dynamic class MonadIO m => MonadException m where catch :: m a -> (Exception -> m a) -> m a@@ -39,6 +40,15 @@ after a return r )++throwDynIO :: (Typeable exception, MonadIO m) => exception -> m a+throwDynIO = liftIO . E.evaluate . E.throwDyn++handleDyn :: (Typeable exception, MonadException m) => (exception -> m a)+ -> m a -> m a+handleDyn f = handle $ \ex -> case E.dynExceptions ex of+ Just dyn | Just e <- fromDynamic dyn -> f e+ _ -> throwIO ex instance MonadException IO where
haskeline.cabal view
@@ -1,6 +1,6 @@ Name: haskeline Cabal-Version: >=1.2-Version: 0.3+Version: 0.3.1 Category: User Interfaces License: BSD3 License-File: LICENSE