Upgrade to fused-effects 0.5.

main
Patrick Thomson 2019-07-06 10:31:33 -04:00
parent 5533982d40
commit b2d59dc0d6
2 changed files with 10 additions and 8 deletions

View File

@ -1,5 +1,7 @@
cabal-version: 2.4
name: fused-effects-exceptions name: fused-effects-exceptions
version: 0.1.1.0 version: 0.2.0.0
synopsis: Handle exceptions thrown in IO with fused-effects. synopsis: Handle exceptions thrown in IO with fused-effects.
description: Provides an effect that enables catching exceptions thrown from impure computations such as 'IO'. description: Provides an effect that enables catching exceptions thrown from impure computations such as 'IO'.
homepage: https://github.com/patrickt/fused-effects-exceptions#readme homepage: https://github.com/patrickt/fused-effects-exceptions#readme
@ -8,7 +10,7 @@ license-file: LICENSE
author: Josh Vera author: Josh Vera
maintainer: patrickt@github.com maintainer: patrickt@github.com
copyright: 2019 Josh Vera and Patrick Thomson copyright: 2019 Josh Vera and Patrick Thomson
category: Control. category: Control
build-type: Simple build-type: Simple
cabal-version: >=1.10 cabal-version: >=1.10
extra-source-files: README.md extra-source-files: README.md
@ -19,10 +21,10 @@ library
hs-source-dirs: src hs-source-dirs: src
default-language: Haskell2010 default-language: Haskell2010
exposed-modules: Control.Effect.Catch exposed-modules: Control.Effect.Catch
build-depends: base >= 4.7 && < 5 build-depends: base >= 4.7 && < 5
, fused-effects >= 0.3 && <1 , fused-effects ^>= 0.5
, safe-exceptions >= 0.1 && <1 , safe-exceptions >= 0.1 && <1
, unliftio-core >= 0.1.2 && <1 , unliftio-core >= 0.1.2 && <1
source-repository head source-repository head
type: git type: git

View File

@ -27,12 +27,12 @@ import Control.Monad.IO.Class
import Control.Monad.IO.Unlift import Control.Monad.IO.Unlift
data Catch m k data Catch m k
= forall output e . Exc.Exception e => CatchIO (m output) (e -> m output) (output -> k) = forall output e . Exc.Exception e => CatchIO (m output) (e -> m output) (output -> m k)
deriving instance Functor (Catch m) deriving instance Functor m => Functor (Catch m)
instance HFunctor Catch where instance HFunctor Catch where
hmap f (CatchIO go cleanup k) = CatchIO (f go) (f . cleanup) k hmap f (CatchIO go cleanup k) = CatchIO (f go) (f . cleanup) (f . k)
instance Effect Catch where instance Effect Catch where
handle state handler (CatchIO go cleanup k) handle state handler (CatchIO go cleanup k)