IO package:rio
A value of type
IO a is a computation which, when
performed, does some I/O before returning a value of type
a.
There is really only one way to "perform" an I/O action: bind it to
Main.main in your program. When your program is run, the I/O
will be performed. It isn't possible to perform I/O from an arbitrary
function, unless that function is itself in the
IO monad and
called at some point, directly or indirectly, from
Main.main.
IO is a monad, so
IO actions can be combined using
either the do-notation or the
>> and
>>=
operations from the
Monad class.
Helpful type synonym for using a
URef from an
IO-based
stack.
Configuration for how to create a
LogFunc. Intended to be used
with the
withLogFunc function.
The Reader+IO monad. This is different from a
ReaderT because:
- It's not a transformer, it hardcodes IO for simpler usage and
error messages.
- Instances of typeclasses like MonadLogger are implemented
using classes defined on the environment, instead of using an
underlying monad.
Abstract
RIO to an arbitrary
MonadReader instance, which
can handle IO.
Create a
LogOptions value from the given
Handle and
whether to perform verbose logging or not. Individiual settings can be
overridden using appropriate
set functions. Logging output is
guaranteed to be non-interleaved only for a UTF-8
Handle in a
multi-thread environment.
When Verbose Flag is
True, the following happens:
- setLogVerboseFormat is called with True
- setLogUseColor is called with True (except on
Windows)
- setLogUseLoc is called with True
- setLogUseTime is called with True
- setLogMinLevel is called with Debug log
level
Create a
LogOptions value which will store its data in memory.
This is primarily intended for testing purposes. This will return both
a
LogOptions value and an
IORef containing the resulting
Builder value.
This will default to non-verbose settings and assume there is a
terminal attached. These assumptions can be overridden using the
appropriate
set functions.
Lift one RIO env to another.
Using the environment run in IO the action that requires that
environment.
Refer to
setLogVerboseFormat. This modifier allows to alter the
verbose format value dynamically at runtime.
Default: follows the value of the verbose flag.
Warning: Trace statement left in code
Warning: Trace statement left in code
Warning: Trace statement left in code
Warning: Trace statement left in code
Warning: Trace statement left in code
Warning: Trace statement left in code
Warning: Trace statement left in code
Warning: Trace statement left in code
Warning: Trace statement left in code
O(n) The
partition function takes a predicate a
ByteString and returns the pair of ByteStrings with elements which do
and do not satisfy the predicate, respectively; i.e.,
partition p bs == (filter p xs, filter (not . p) xs)