packages feed

explicit-exception 0.1.5 → 0.1.6

raw patch · 4 files changed

+53/−7 lines, 4 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

+ Control.Monad.Exception.Synchronous: fromExitCode :: ExitCode -> Exceptional Int ()
+ Control.Monad.Exception.Synchronous: fromExitCodeT :: Functor m => m ExitCode -> ExceptionalT Int m ()
+ Control.Monad.Exception.Synchronous: toExitCode :: Exceptional Int () -> ExitCode
+ Control.Monad.Exception.Synchronous: toExitCodeT :: Functor m => ExceptionalT Int m () -> m ExitCode

Files

explicit-exception.cabal view
@@ -1,5 +1,5 @@ Name:             explicit-exception-Version:          0.1.5+Version:          0.1.6 License:          BSD3 License-File:     LICENSE Author:           Henning Thielemann <haskell@henning-thielemann.de>@@ -46,7 +46,7 @@ Source-Repository this   type:     darcs   location: http://code.haskell.org/explicit-exception/-  tag:      0.1.5+  tag:      0.1.6  Flag buildTests   description: Build test suite
src/Control/Monad/Exception/Asynchronous.hs view
@@ -7,9 +7,11 @@  * Is it reasonable, that many functions match the exception lazily?   Or is lazy decoupling an operation that shall always be done explicitly?+ * Is the Null type appropriate anywhere?   Should it be better a Monoid type with mempty?   Shall Monoid.mempty be the default, or functions with explicit default values?+ * Shall we replace Monad constraint by Functor constraint,   where we only need liftM? -}@@ -234,6 +236,21 @@  {- fmap (f.g) = fmap f . fmap g++FIXME:+The law+  fmap id = id+requires that we match the constructor strictly.++Strict matching+  fmap id undefined = undefined = id undefined++Lazy matching+  fmap id undefined = Exceptional undefined undefined+      /= undefined = id undefined++This was pointed out by kahl@cas.mcmaster.ca in libraries@haskell.org, 2011-01-22.+However, I think we rely a lot on the lazy matching in http-monad and parallelweb. -} instance Functor (Exceptional e) where    fmap f ~(Exceptional e a) = Exceptional e (f a)
src/Control/Monad/Exception/Synchronous.hs view
@@ -29,8 +29,9 @@ -} module Control.Monad.Exception.Synchronous (    Exceptional(..),-   fromMaybe,  toMaybe,-   fromEither, toEither,+   fromMaybe,    toMaybe,+   fromEither,   toEither,+   fromExitCode, toExitCode,    getExceptionNull,    switch,    force,@@ -42,8 +43,9 @@    resolve,     ExceptionalT(..),-   fromErrorT,  toErrorT,-   fromEitherT, toEitherT,+   fromErrorT,    toErrorT,+   fromEitherT,   toEitherT,+   fromExitCodeT, toExitCodeT,    forceT,    mapExceptionT,    mapExceptionalT,@@ -64,6 +66,8 @@ import Control.Monad.Trans.Error (ErrorT(ErrorT, runErrorT)) import Data.Monoid(Monoid, mappend, mempty, Endo(Endo, appEndo), ) +import System.Exit (ExitCode(ExitSuccess, ExitFailure), )+ import Prelude hiding (catch, )  @@ -97,6 +101,20 @@       Success a   -> Right a       Exception e -> Left e ++toExitCode :: Exceptional Int () -> ExitCode+toExitCode e =+   case e of+      Success () -> ExitSuccess+      Exception n -> ExitFailure n++fromExitCode :: ExitCode -> Exceptional Int ()+fromExitCode e =+   case e of+      ExitSuccess -> Success ()+      ExitFailure n -> Exception n++ -- | useful in connection with 'Control.Monad.Exception.Asynchronous.continue' getExceptionNull :: Exceptional e () -> Maybe e getExceptionNull x =@@ -225,6 +243,18 @@  toEitherT :: Monad m => ExceptionalT e m a -> m (Either e a) toEitherT  =  liftM toEither . runExceptionalT++toExitCodeT ::+   (Functor m) =>+   ExceptionalT Int m () -> m ExitCode+toExitCodeT act =+   fmap toExitCode $ runExceptionalT act++fromExitCodeT ::+   (Functor m) =>+   m ExitCode -> ExceptionalT Int m ()+fromExitCodeT act =+   ExceptionalT $ fmap fromExitCode act  {- | see 'force'
src/System/IO/Straight.hs view
@@ -15,7 +15,6 @@  import Control.Monad.Exception.Synchronous    (Exceptional(Success, Exception), ExceptionalT(ExceptionalT), )-import qualified Control.Monad.Exception.Synchronous as SyncExc import Control.Exception (IOException) import System.IO.Error (try) import Control.Monad.IO.Class (MonadIO, liftIO, )