Safe Haskell | Safe-Inferred |
---|
- class Arrow ar => ArrowF f ar | ar -> f where
- mapF :: ArrowF f ar => (f b -> f c) -> (a `ar` b) -> a `ar` c
- arrMF :: (ArrowF f ar, ArrowKleisli m ar) => (a -> m (f c)) -> a `ar` c
- unite :: ArrowPlus ar => (b, b) `ar` b
- const :: Arrow ar => b -> a `ar` b
- concatA :: ArrowPlus ar => [a `ar` b] -> a `ar` b
- plus :: (Alternative f, ArrowF f ar) => (a `ar` b) -> (a `ar` b) -> a `ar` b
- constF :: ArrowF f ar => f c -> a `ar` c
- none :: (Alternative f, ArrowF f ar) => a `ar` b
- results :: (Foldable f, ArrowF f ar) => (a `ar` b) -> a `ar` Bool
- isA :: (Alternative f, ArrowF f ar) => (a -> Bool) -> a `ar` a
- ifA :: (Foldable f, ArrowF f ar, ArrowChoice ar) => (a `ar` b) -> (a `ar` t) -> (a `ar` t) -> a `ar` t
- when :: (Foldable f, ArrowF f ar, ArrowChoice ar) => (a `ar` a) -> (a `ar` c) -> a `ar` a
- guards :: (Alternative f, Foldable f, ArrowF f ar, ArrowChoice ar) => (a `ar` c) -> (a `ar` b) -> a `ar` b
- filterA :: (Alternative f, Foldable f, ArrowF f ar, ArrowChoice ar) => (a `ar` c) -> a `ar` a
- notA :: (Alternative f, Foldable f, ArrowF f ar, ArrowChoice ar) => (a `ar` c) -> a `ar` a
- orElse :: (Foldable f, ArrowF f ar, ArrowChoice ar) => (a `ar` b) -> (a `ar` b) -> a `ar` b
- maybeA :: (Alternative f, ArrowF f ar) => Maybe a `ar` a
- optional :: (Foldable f, ArrowF f ar, ArrowChoice ar) => (a `ar` b) -> a `ar` Maybe b
Container arrow type class.
class Arrow ar => ArrowF f ar | ar -> f whereSource
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 `ar` a | Use a container as the input for an arrow. |
:: (a `ar` b) | |
-> a `ar` f b | Get the result as container. |
mapF :: ArrowF f ar => (f b -> f c) -> (a `ar` b) -> a `ar` cSource
Map a function over the result collection of a container arrow.
arrMF :: (ArrowF f ar, ArrowKleisli m ar) => (a -> m (f c)) -> a `ar` cSource
Embed a monadic function returning an ordered list into a container arrow.
Generic arrow utilities.
unite :: ArrowPlus ar => (b, b) `ar` bSource
Take the output of an arrow producing two results and concatenate them into the result of the container arrow.
concatA :: ArrowPlus ar => [a `ar` b] -> a `ar` bSource
Collect the results of applying multiple arrows to the same input.
plus :: (Alternative f, ArrowF f ar) => (a `ar` b) -> (a `ar` b) -> a `ar` bSource
Join the results of two arrows, like (+) from ArrowPlus.
Container arrow utilities.
constF :: ArrowF f ar => f c -> a `ar` cSource
Skip the input and produce a constant output specified as a container.
none :: (Alternative f, ArrowF f ar) => a `ar` bSource
Ignore the input and produce no results. Like zeroArrow
.
results :: (Foldable f, ArrowF f ar) => (a `ar` b) -> a `ar` BoolSource
Returns a Bool
indicating whether the input arrow produces a container
with any results.
Conditional and filter arrows.
isA :: (Alternative f, ArrowF f ar) => (a -> Bool) -> a `ar` aSource
ifA :: (Foldable f, ArrowF f ar, ArrowChoice ar) => (a `ar` b) -> (a `ar` t) -> (a `ar` t) -> a `ar` tSource
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, ArrowF f ar, ArrowChoice ar) => (a `ar` a) -> (a `ar` c) -> a `ar` aSource
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, ArrowF f ar, ArrowChoice ar) => (a `ar` c) -> (a `ar` b) -> a `ar` bSource
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, ArrowF f ar, ArrowChoice ar) => (a `ar` c) -> a `ar` aSource
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, ArrowF f ar, ArrowChoice ar) => (a `ar` c) -> a `ar` aSource
Negation container arrow. Only accept the input when the condition produces no output.
orElse :: (Foldable f, ArrowF f ar, ArrowChoice ar) => (a `ar` b) -> (a `ar` b) -> a `ar` bSource
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, ArrowF f ar) => Maybe a `ar` aSource