explicit-exception 0.1.10 → 0.1.10.1
raw patch · 5 files changed
+56/−35 lines, 5 filesdep +explicit-exceptiondep ~basedep ~bytestringdep ~tarPVP ok
version bump matches the API change (PVP)
Dependencies added: explicit-exception
Dependency ranges changed: base, bytestring, tar, transformers
API changes (from Hackage documentation)
Files
- explicit-exception.cabal +32/−16
- spaceleak/Example.hs +1/−0
- spaceleak/Tar.hs +4/−2
- src/Control/Monad/Exception/Synchronous.hs +13/−11
- src/Control/Monad/Label.hs +6/−6
explicit-exception.cabal view
@@ -1,10 +1,11 @@+Cabal-Version: 2.2 Name: explicit-exception-Version: 0.1.10-License: BSD3+Version: 0.1.10.1+License: BSD-3-Clause License-File: LICENSE Author: Henning Thielemann <haskell@henning-thielemann.de> Maintainer: Henning Thielemann <haskell@henning-thielemann.de>-Homepage: http://www.haskell.org/haskellwiki/Exception+Homepage: http://wiki.haskell.org/Exception Category: Control Stability: Experimental Synopsis: Exceptions which are explicit in the type signature.@@ -15,9 +16,9 @@ This package is a proposal for improved exception handling in Haskell. It strictly separates between handling of exceptional situations (file not found, invalid user input,- see <http://www.haskell.org/haskellwiki/Exception>) and+ see <http://wiki.haskell.org/Exception>) and (programming) errors (division by zero, index out of range,- see <http://www.haskell.org/haskellwiki/Error>).+ see <http://wiki.haskell.org/Error>). Handling of the first one is called \"exception handling\", whereas handling of errors is better known as \"debugging\". .@@ -31,17 +32,16 @@ See also: @unexceptionalio@ Tested-With: GHC==7.4.2, GHC==7.6.3, GHC==7.8.4 Tested-With: GHC==8.0.2, GHC==8.4.1-Cabal-Version: >=1.6 Build-Type: Simple Source-Repository head type: darcs- location: http://hub.darcs.net/thielema/explicit-exception/+ location: https://hub.darcs.net/thielema/explicit-exception/ Source-Repository this type: darcs- location: http://hub.darcs.net/thielema/explicit-exception/- tag: 0.1.10+ location: https://hub.darcs.net/thielema/explicit-exception/+ tag: 0.1.10.1 Flag buildTests description: Build executables that demonstrate some space leaks@@ -70,6 +70,7 @@ GHC-Options: -Wall Hs-Source-Dirs: src+ Default-Language: Haskell98 Exposed-Modules: Control.Monad.Exception.Asynchronous Control.Monad.Exception.Asynchronous.Lazy@@ -90,34 +91,49 @@ Executable ee-tar If flag(buildTests) Build-Depends:- bytestring >=0.9.0.1 && <0.11,- tar >=0.3 && <0.4+ explicit-exception,+ bytestring >=0.9.0.1 && <0.12,+ tar >=0.4 && <0.6,+ base Else Buildable: False GHC-Options: -Wall- Hs-Source-Dirs: src, spaceleak+ Hs-Source-Dirs: spaceleak+ Default-Language: Haskell98 Main-Is: Tar.hs Executable ee-test If flag(buildTests) Build-Depends:- bytestring >=0.9.0.1 && <0.11+ explicit-exception,+ bytestring >=0.9.0.1 && <0.12,+ base Else Buildable: False GHC-Options: -Wall- Hs-Source-Dirs: src, spaceleak+ Hs-Source-Dirs: spaceleak+ Default-Language: Haskell98 Main-Is: Example.hs Executable ee-unzip- If !flag(buildTests)+ If flag(buildTests)+ Build-Depends:+ base+ Else Buildable: False GHC-Options: -Wall Hs-Source-Dirs: spaceleak+ Default-Language: Haskell98 Main-Is: Unzip.hs Executable ee-writer- If !flag(buildTests)+ If flag(buildTests)+ Build-Depends:+ transformers,+ base+ Else Buildable: False GHC-Options: -Wall Hs-Source-Dirs: spaceleak+ Default-Language: Haskell98 Main-Is: Writer.hs
spaceleak/Example.hs view
@@ -4,6 +4,7 @@ (Exceptional(Exceptional), force, pure, throwMonoid, broken, result, exception, ) import Control.Monad (mplus, ) import Data.Monoid (Monoid, mappend, mempty, )+import Prelude hiding (pure) convert :: [Either String a] -> Exceptional String [a]
spaceleak/Tar.hs view
@@ -5,9 +5,11 @@ import Control.Monad.Exception.Asynchronous (Exceptional(Exceptional), force, pure, throwMonoid, result, exception, ) import qualified Data.ByteString.Lazy as B+import Prelude hiding (pure) -convert :: Tar.Entries -> Exceptional String [Tar.Entry]+convert ::+ Tar.Entries Tar.FormatError -> Exceptional Tar.FormatError [Tar.Entry] convert = force . Tar.foldEntries@@ -16,7 +18,7 @@ throwMonoid -- the String argument prevents caching and thus a space-leak-infinite :: String -> Tar.Entries+infinite :: String -> Tar.Entries e infinite name = let tar = Tar.Next
src/Control/Monad/Exception/Synchronous.hs view
@@ -19,13 +19,19 @@ > > fileParser :: (ParserException e, IOException e) => ExceptionalT e IO String -Unfortunately, this way you cannot remove single exceptions-from the constraints by catching them.-You can only remove all of them using 'resolve' or none.-For a more advanced approach,+You can remove single exceptions from the set,+but with Haskell 98 you need instances for all the other constraints+in the exception constraint set.+There is a more advanced approach, that allows removing exceptions constraints-by some non-Haskell-98 type hackery,-see the exception package by Joseph Iborra.+without a quadratic growth of instances.+It uses some non-Haskell-98 type hackery,+see the @exception@ package by Joseph Iborra.+Fortunately, you use this package in every case+and let the user decide+whether he wants Haskell 98 or non-standard way of handling exceptions.++See also: <https://wiki.haskell.org/Exception>. -} module Control.Monad.Exception.Synchronous ( Exceptional(..),@@ -84,7 +90,7 @@ import System.Exit (ExitCode(ExitSuccess, ExitFailure), ) -import Prelude (Show, Int, error, )+import Prelude (Show, Int, ) -- * Plain monad@@ -199,10 +205,6 @@ case x of Success a -> a Exception e -> handler e--{--Semigroup instance could replace (Math.Checksum.IBAN.+++).--} -- like Applicative.<|> infixl 3 `alternative`, `alternativeT`
src/Control/Monad/Label.hs view
@@ -16,7 +16,7 @@ import Control.Applicative (Applicative(pure, (<*>)), Alternative, ) -import Control.Monad (MonadPlus, ap, )+import Control.Monad (MonadPlus, ) import Control.Monad.Fix (MonadFix) import Control.Monad.IO.Class (MonadIO, ) import Control.Monad.Trans.Class (MonadTrans, )@@ -28,12 +28,16 @@ newtype Label l a = Label { runLabelPriv :: Reader [l] a } -- newtype Label l a = Label { runLabelPriv :: [l] -> a }- deriving (Functor, Monad, MonadFix)+ deriving (Functor, Applicative, Monad, MonadFix) {- instance Functor (Label l) where fmap f m = Label $ \l -> f (runLabelPriv m l) +instance Applicative (Label l) where+ pure = return+ (<*>) = ap+ instance Monad (Label l) where return a = Label $ \_ -> a m >>= k = Label $ \l -> runLabelPriv (k (runLabelPriv m l)) l@@ -41,10 +45,6 @@ instance MonadFix (Label l) where mfix f = Label $ \l -> let a = runLabelPriv (f a) l in a -}--instance Applicative (Label l) where- pure = return- (<*>) = ap runLabel :: Label l a -> [l] -> a