reader -package:streamly-core
Retrieves a function of the current environment.
Constructor for computations in the reader monad (equivalent to
asks).
Constructor for computations in the reader monad (equivalent to
asks).
Constructor for computations in the reader monad (equivalent to
asks).
Read a stream from the supplied IPv4 host address and port number.
Parse an
IPv4 address using a
Reader.
>>> IPv4.reader "192.168.2.47"
Right (ipv4 192 168 2 47,"")
>>> IPv4.reader "192.168.2.470"
Left "All octets in an IPv4 address must be between 0 and 255"
Request the environment value using a transformation function.
Unfold a strict ByteString to a stream of Word8.
Unfold a lazy ByteString to a stream of Word8
Constructor for computations in the reader monad (equivalent to
asks).
Constructor for computations in the reader monad (equivalent to
asks).
Declare how to parse an argument, option, or environment variable.
reader @tag act lifts a purely environment-dependent action
act to a monadic action in an arbitrary monad m with
capability HasReader.
It happens to coincide with asks: reader = asks.
Retrieves a function of the
part of the current environment.
This is
Control.Monad.Reader's
reader with the type
adjusted for better compatibility with
Has.
Not on Stackage, so not searched.
A reader data type with all the bits
Read some text. If the read succeeds, return its value and the
remaining text, otherwise an error message.
- Computation type: Computations which read values from a
shared environment.
- Binding strategy: Monad values are functions from the
environment to a value. The bound function is applied to the bound
value, and both have access to the shared environment.
- Useful for: Maintaining variable bindings, or other shared
environment.
- Zero and plus: None.
- Example type: Reader [(String,Value)]
a
The
Reader monad (also called the Environment monad).
Represents a computation, which can read values from a shared
environment, pass values from function to function, and execute
sub-computations in a modified environment. Using
Reader monad
for such computations is often clearer and easier than using the
State monad.
Inspired by the paper
Functional Programming with Overloading and
Higher-Order Polymorphism, Mark P Jones
(
http://web.cecs.pdx.edu/~mpj/) Advanced School of Functional
Programming, 1995.
The parameterizable reader monad.
Computations are functions of a shared environment.
The
return function ignores the environment, while
>>= passes the inherited environment to both
subcomputations.
Declaration of the
ReaderT monad transformer, which adds a
static environment to a given monad.
If the computation is to modify the stored information, use
Control.Monad.Trans.State instead.
The parameterizable reader monad, which is non-strict.
Computations are functions of a shared environment.
The
return function ignores the environment, while
m
>>= k passes the inherited environment to both
subcomputations:
GHC uses several kinds of name internally: