Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell98 |
- class Arrow arr => ArrowListLike f arr | arr -> f where
- mapF :: ArrowListLike f arr => (f b -> f c) -> (a `arr` b) -> a `arr` c
- arrMF :: (ArrowListLike f arr, ArrowKleisli m arr) => (a -> m (f c)) -> a `arr` c
- unite :: ArrowPlus arr => (b, b) `arr` b
- const :: Arrow arr => b -> a `arr` b
- concatA :: ArrowPlus arr => [a `arr` b] -> a `arr` b
- plus :: (Alternative f, ArrowListLike f arr) => (a `arr` b) -> (a `arr` b) -> a `arr` b
- constF :: ArrowListLike f arr => f c -> a `arr` c
- none :: (Alternative f, ArrowListLike f arr) => a `arr` b
- results :: (Foldable f, ArrowListLike f arr) => (a `arr` b) -> a `arr` Bool
- isA :: (Alternative f, ArrowListLike f arr) => (a -> Bool) -> a `arr` a
- ifA :: (Foldable f, ArrowListLike f arr, ArrowChoice arr) => (a `arr` b) -> (a `arr` t) -> (a `arr` t) -> a `arr` t
- when :: (Foldable f, ArrowListLike f arr, ArrowChoice arr) => (a `arr` a) -> (a `arr` c) -> a `arr` a
- guards :: (Alternative f, Foldable f, ArrowListLike f arr, ArrowChoice arr) => (a `arr` c) -> (a `arr` b) -> a `arr` b
- filterA :: (Alternative f, Foldable f, ArrowListLike f arr, ArrowChoice arr) => (a `arr` c) -> a `arr` a
- notA :: (Alternative f, Foldable f, ArrowListLike f arr, ArrowChoice arr) => (a `arr` c) -> a `arr` a
- orElse :: (Foldable f, ArrowListLike f arr, ArrowChoice arr) => (a `arr` b) -> (a `arr` b) -> a `arr` b
- maybeA :: (Alternative f, ArrowListLike f arr) => Maybe a `arr` a
- optional :: (Foldable f, ArrowListLike f arr, ArrowChoice arr) => (a `arr` b) -> a `arr` Maybe b
Container arrow type class.
class Arrow arr => ArrowListLike f arr | arr -> f where Source
A type class for arrows that produce containers of results. The container
arrow can be seen as a generalization for list arrows. Most operations
assume the container type has an Applicative
, an Alternative
and a
Foldable
instance.
:: f a `arr` a | Use a container as the input for an arrow. |
:: (a `arr` b) | |
-> a `arr` f b | Get the result as container. |
Monad m => ArrowListLike [] (ListTArrow m) | |
Monad m => ArrowListLike Seq (SeqTArrow m) |
mapF :: ArrowListLike f arr => (f b -> f c) -> (a `arr` b) -> a `arr` c Source
Map a function over the result collection of a container arrow.
arrMF :: (ArrowListLike f arr, ArrowKleisli m arr) => (a -> m (f c)) -> a `arr` c Source
Embed a monadic function returning an ordered list into a container arrow.
Generic arrow utilities.
unite :: ArrowPlus arr => (b, b) `arr` b Source
Take the output of an arrow producing two results and concatenate them into the result of the container arrow.
concatA :: ArrowPlus arr => [a `arr` b] -> a `arr` b Source
Collect the results of applying multiple arrows to the same input.
plus :: (Alternative f, ArrowListLike f arr) => (a `arr` b) -> (a `arr` b) -> a `arr` b Source
Join the results of two arrows, like (+) from ArrowPlus.
Container arrow utilities.
constF :: ArrowListLike f arr => f c -> a `arr` c Source
Skip the input and produce a constant output specified as a container.
none :: (Alternative f, ArrowListLike f arr) => a `arr` b Source
Ignore the input and produce no results. Like zeroArrow
.
results :: (Foldable f, ArrowListLike f arr) => (a `arr` b) -> a `arr` Bool Source
Returns a Bool
indicating whether the input arrow produces a container
with any results.
Conditional and filter arrows.
isA :: (Alternative f, ArrowListLike f arr) => (a -> Bool) -> a `arr` a Source
ifA :: (Foldable f, ArrowListLike f arr, ArrowChoice arr) => (a `arr` b) -> (a `arr` t) -> (a `arr` t) -> a `arr` t Source
Use the result of a container arrow as a conditional, like an if-then-else arrow. When the first arrow produces any results the then arrow will be used, when the first arrow produces no results the else arrow will be used.
when :: (Foldable f, ArrowListLike f arr, ArrowChoice arr) => (a `arr` a) -> (a `arr` c) -> a `arr` a infix 7 Source
Apply a container arrow only when a conditional arrow produces any
results. When the conditional produces no results the output arrow /behaves
like the identity. The second/ input arrow is used as the conditional,
this allow you to write: a `when` condition
guards :: (Alternative f, Foldable f, ArrowListLike f arr, ArrowChoice arr) => (a `arr` c) -> (a `arr` b) -> a `arr` b infix 8 Source
Apply a container arrow only when a conditional arrow produces any
results. When the conditional produces no results the output arrow
produces no results. The first input arrow is used as the conditional,
this allow you to write: condition `guards` a
filterA :: (Alternative f, Foldable f, ArrowListLike f arr, ArrowChoice arr) => (a `arr` c) -> a `arr` a Source
Filter the results of an arrow with a predicate arrow, when the filter condition produces results the input is accepted otherwise it is excluded.
notA :: (Alternative f, Foldable f, ArrowListLike f arr, ArrowChoice arr) => (a `arr` c) -> a `arr` a Source
Negation container arrow. Only accept the input when the condition produces no output.
orElse :: (Foldable f, ArrowListLike f arr, ArrowChoice arr) => (a `arr` b) -> (a `arr` b) -> a `arr` b infix 6 Source
Apply the input arrow, when the arrow does not produces any results the
second fallback arrow is applied.
Likely written infix like this a `orElse` b
Optionality.
maybeA :: (Alternative f, ArrowListLike f arr) => Maybe a `arr` a Source
optional :: (Foldable f, ArrowListLike f arr, ArrowChoice arr) => (a `arr` b) -> a `arr` Maybe b Source