handle -package:streamly-core

A version of catch with the arguments swapped around; useful in situations where the code for the handler is shorter. For example:
do handle (\NonTermination -> exitWith (ExitFailure 1)) $
...
The handle used by the action flagging this error.
Flipped catch. See Control.Exception's handle.
Flipped version of catch.
Flipped version of catch
Generalized version of handle. Note, when the given computation throws an exception any monadic side effects in m will be discarded.
Logs an event if it meets the requirements given by the most recent call to setLevel.
Flipped catch. See Control.Exception's handle.
When evaluating a stream if an exception occurs, stream evaluation aborts and the specified exception handler is run with the exception as argument. Inhibits stream fusion
Traditional exception construct. Typical usage in arrow notation:
proc p -> ...
body `handle` \ex -> handler
Flipped version of catch.
Generalized version of handle.
handle, but with the argument order swapped
>>> runPureEff $ handle (pure . show) $ \e -> do
throw e 42
pure "No exception thrown"
"42"
Like blob, but each Log is rendered as text in its own line. If the given Handle is associated to a TTY supporting ANSI colors, and the given LineRenderer supports rendering with colors, and you ask for it, then you will get colorful output.
Flipped version of catch
Handle links relocation with Strategy:
  • CopyFromOrigin - copy source link's target to destination.
  • CreateEmpty - create an empty directory at destination when source link's target is a directory or create an empty file at destination when source link's target is a file.
  • CopyLink - copy source link to destination.
Handle a single error, by mapping it either to the success type a or to one of the other errors in errs. This is syntactic sugar over using VEither.onLeft, but can be nicer to use if one or only a few error variants need to be handled, because it lets you build a simple pipeline:
>>> :{
examplePipe ve = ve
& VEither.handle @Int (pure . show) 
& VEither.handle @Bool (pure . show)
:}
>>> :t examplePipe
examplePipe 
:: VEither (Int : Bool : errs) String -> VEither errs String

>>> examplePipe (VEither.fromLeft False :: VEither '[Int, Bool, Float] String)
VRight "False"