Safe Haskell | Safe-Inferred |
---|

The `ArrowList`

type class, and a collection of list arrow related functions.
This typeclass can be used to embed functions producing multiple outputs into a
an arrow.

- class Arrow arr => ArrowList arr where
- unlist :: ArrowList arr => [b] `arr` b
- unite :: ArrowList arr => (a `arr` (b, b)) -> a `arr` b
- none :: ArrowList arr => a `arr` b
- concatA :: ArrowPlus arr => [a `arr` b] -> a `arr` b
- list :: ArrowList arr => (a `arr` b) -> a `arr` [b]
- empty :: ArrowList arr => (a `arr` b) -> a `arr` Bool
- isA :: ArrowList arr => (a -> Bool) -> a `arr` a
- ifA :: (ArrowList arr, ArrowChoice arr) => (a `arr` c) -> (a `arr` b) -> (a `arr` b) -> a `arr` b
- when :: (ArrowList arr, ArrowChoice arr) => (a `arr` a) -> (a `arr` b) -> a `arr` a
- guards :: (ArrowList arr, ArrowChoice arr) => (a `arr` c) -> (a `arr` b) -> a `arr` b
- filterA :: (ArrowChoice arr, ArrowList arr) => (a `arr` c) -> a `arr` a
- notA :: (ArrowList arr, ArrowChoice arr) => (a `arr` c) -> a `arr` a
- orElse :: (ArrowList arr, ArrowChoice arr) => (a `arr` b) -> (a `arr` b) -> a `arr` b
- maybeL :: ArrowList arr => Maybe a `arr` a
- optional :: (ArrowChoice arr, ArrowList arr) => (a `arr` b) -> a `arr` Maybe b

# ArrowList type class.

class Arrow arr => ArrowList arr whereSource

The `ArrowList`

class represents two possible actions:

- Lifting functions from one value to a list of values into a list arrow.
- Mapping a function over the result list of a list arrow.

Monad m => ArrowList (ListTArrow m) |

# Creating list arrows.

unite :: ArrowList arr => (a `arr` (b, b)) -> a `arr` bSource

Take the output of an arrow producing two results and concatenate them into the result of the list arrow.

concatA :: ArrowPlus arr => [a `arr` b] -> a `arr` bSource

Collect the results of applying multiple arrows to the same input.

# Collecting the results.

list :: ArrowList arr => (a `arr` b) -> a `arr` [b]Source

Collect the entire results of an list arrow as a singleton value in the result list.

empty :: ArrowList arr => (a `arr` b) -> a `arr` BoolSource

Returns a `Bool`

indicating whether the input arrow produce any results.

# Conditional and filter arrows.

:: (ArrowList arr, ArrowChoice arr) | |

=> (a `arr` c) | Arrow used as condition. |

-> (a `arr` b) | Arrow to use when condition has results. |

-> (a `arr` b) | Arrow to use when condition has no results. |

-> a `arr` b |

Use the result a list 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.

:: (ArrowList arr, ArrowChoice arr) | |

=> (a `arr` a) | The arrow to apply, |

-> (a `arr` b) | when this conditional holds. |

-> a `arr` a |

Apply a list 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` c `

:: (ArrowList arr, ArrowChoice arr) | |

=> (a `arr` c) | When this condition holds, |

-> (a `arr` b) | then apply this arrow. |

-> a `arr` b |

Apply a list 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: ` c `guards` a `

filterA :: (ArrowChoice arr, ArrowList arr) => (a `arr` c) -> a `arr` 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 :: (ArrowList arr, ArrowChoice arr) => (a `arr` c) -> a `arr` aSource

Negation list arrow. Only accept the input when the condition produces no output.

orElse :: (ArrowList arr, ArrowChoice arr) => (a `arr` b) -> (a `arr` b) -> a `arr` 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 `