Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Bluefin.Exception
Synopsis
- data Exception exn (e :: Effects)
- try :: forall exn (es :: Effects) a. (forall (e :: Effects). Exception exn e -> Eff (e :& es) a) -> Eff es (Either exn a)
- handle :: forall exn (es :: Effects) a. (exn -> Eff es a) -> (forall (e :: Effects). Exception exn e -> Eff (e :& es) a) -> Eff es a
- catch :: forall exn (es :: Effects) a. (forall (e :: Effects). Exception exn e -> Eff (e :& es) a) -> (exn -> Eff es a) -> Eff es a
- throw :: forall (ex :: Effects) (es :: Effects) e a. ex :> es => Exception e ex -> e -> Eff es a
Handle
data Exception exn (e :: Effects) #
Handle to an exception of type exn
Handlers
Arguments
:: forall exn (es :: Effects) a. (forall (e :: Effects). Exception exn e -> Eff (e :& es) a) | |
-> Eff es (Either exn a) |
|
>>> runPureEff $ try $ \e -> do throw e 42 pure "No exception thrown" Left 42
Arguments
:: forall exn (es :: Effects) a. (exn -> Eff es a) | If the exception is thrown, apply this handler |
-> (forall (e :: Effects). Exception exn e -> Eff (e :& es) a) | |
-> Eff es a |
handle
, but with the argument order swapped
>>> runPureEff $ handle (pure . show) $ \e -> do throw e 42 pure "No exception thrown" "42"