bluefin-0.2.6.0: The Bluefin effect system
Safe HaskellNone
LanguageHaskell2010

Bluefin.Exception.GeneralBracket

Synopsis

Effectful functions

generalBracket #

Arguments

:: forall r b h a (es :: Effects). Handle h 
=> Eff es r

Acquire the resource

-> MakeExceptions r a h es

Construct the handle h of exceptions to pass into the body, and determine what to run when the body terminates via one of those exceptions.

-> (r -> b -> Eff es a)

To run on normal termination

-> (r -> Eff es ())

To run on unknown exception

-> (forall (e :: Effects). h e -> r -> Eff (e :& es) b)

Body

-> Eff es a 

A generalization of bracket that enables distinguishing exceptional from normal exit.

r
The type of the resource
b
The result type of the body
a
The type of the overall result
h
The handle of exceptions available in the body

Handle

data MakeExceptions r a (h :: Effects -> Type) (es :: Effects) #

To create a MakeExceptions use catchWithResource and the Applicative-like functions that produce and combine them.

Instances

Instances details
(Handle h, e :> es) => OneWayCoercible (MakeExceptions r a h e :: Type) (MakeExceptions r a h es :: Type) 
Instance details

Defined in Bluefin.Internal.Exception

Handle h => Handle (MakeExceptions r a h) 
Instance details

Defined in Bluefin.Internal.Exception

Methods

handleImpl :: HandleD (MakeExceptions r a h) #

mapHandle :: forall (e :: Effects) (es :: Effects). e :> es => MakeExceptions r a h e -> MakeExceptions r a h es #

catchWithResource #

Arguments

:: forall ex r a (es :: Effects). (r -> ex -> Eff es a) 
-> MakeExceptions r a (Exception ex) es

͘

pureMakeExceptions #

Arguments

:: forall h (e :: Effects) r a. h e 
-> MakeExceptions r a h e

͘

Analogous to pure

apMakeExceptions #

Arguments

:: forall (h1 :: Effects -> Type) (h2 :: Effects -> Type) r a (e :: Effects). (Handle h1, Handle h2) 
=> MakeExceptions r a (h1 :~> h2) e 
-> MakeExceptions r a h1 e 
-> MakeExceptions r a h2 e

͘

Analogous to ap and <*>

fmapMakeExceptions #

Arguments

:: forall (h1 :: Effects -> Type) (h2 :: Effects -> Type) (e :: Effects) r a. (Handle h1, Handle h2) 
=> (h1 :~> h2) e 
-> MakeExceptions r a h1 e 
-> MakeExceptions r a h2 e

͘

Analogous to fmap and <$>

:~>

data ((h1 :: Effects -> Type) :~> (h2 :: Effects -> Type)) (es :: Effects) infixr 9 #

Instances

Instances details
(Handle h1, Handle h2) => OneWayCoercible ((h1 :~> h2) e :: Type) ((h1 :~> h2) es :: Type) 
Instance details

Defined in Bluefin.Internal.CloneableHandle

Methods

oneWayCoercibleImpl :: OneWayCoercibleD ((h1 :~> h2) e) ((h1 :~> h2) es) #

(Handle h1, Handle h2) => Handle (h1 :~> h2) 
Instance details

Defined in Bluefin.Internal.CloneableHandle

Methods

handleImpl :: HandleD (h1 :~> h2) #

mapHandle :: forall (e :: Effects) (es :: Effects). e :> es => (h1 :~> h2) e -> (h1 :~> h2) es #

abstract #

Arguments

:: forall h2 h1 (es :: Effects). Handle h2 
=> (forall (e :: Effects). h1 e -> h2 (e :& es)) 
-> (h1 :~> h2) es

͘