| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
Control.Arrow.Extended
Description
The missing standard library for arrows. Some of the functionality in this module is similar to
Paterson’s original arrows library, but it has been modernized to work with recent versions of
GHC.
Synopsis
- (>->) :: Arrow arr => arr (e, s) a -> arr (e, (a, s)) b -> arr (e, s) b
- (<-<) :: Arrow arr => arr (e, (a, s)) b -> arr (e, s) a -> arr (e, s) b
- dup :: Arrow arr => arr a (a, a)
- bothA :: Arrow arr => arr a b -> arr (a, a) (b, b)
- orA :: ArrowChoice arr => arr a Bool -> arr b Bool -> arr (a, b) Bool
- foldlA' :: (ArrowChoice arr, Foldable t) => arr (e, (b, (a, s))) b -> arr (e, (b, (t a, s))) b
- traverseA_ :: (ArrowChoice arr, Foldable t) => arr (e, (a, s)) b -> arr (e, (t a, s)) ()
- data Traversal a r b
- traversal :: Traversable t => t a -> Traversal a b (t b)
- traverseA :: (ArrowChoice arr, Traversable t) => arr (e, (a, s)) b -> arr (e, (t a, s)) (t b)
- traverseA_Maybe :: ArrowChoice arr => arr (e, (a, s)) b -> arr (e, (Maybe a, s)) (Maybe b)
- onNothingA :: ArrowChoice arr => arr (e, s) a -> arr (e, (Maybe a, s)) a
- class (Monad m, Arrow arr) => ArrowKleisli m arr | arr -> m where
- arrM :: (a -> m b) -> arr a b
- bindA :: ArrowKleisli m arr => arr (m a) a
Documentation
foldlA' :: (ArrowChoice arr, Foldable t) => arr (e, (b, (a, s))) b -> arr (e, (b, (t a, s))) b Source #
foldl' lifted to arrows. See also Note [Weird control operator types].
traverseA_ :: (ArrowChoice arr, Foldable t) => arr (e, (a, s)) b -> arr (e, (t a, s)) () Source #
An indexed version of Twan van Laarhoven’s FunList type (see
https://twanvl.nl/blog/haskell/non-regular1). A value of type is a
concrete representation of a traversal applied to a data structure of type Traversal a b (t b)t a and producing a
value of type t b. This explicit representation is used to implement traverseA using only
ArrowChoice.
traversal :: Traversable t => t a -> Traversal a b (t b) Source #
traverseA :: (ArrowChoice arr, Traversable t) => arr (e, (a, s)) b -> arr (e, (t a, s)) (t b) Source #
traverse lifted to arrows. See also Note [Weird control operator types].
traverseA_Maybe :: ArrowChoice arr => arr (e, (a, s)) b -> arr (e, (Maybe a, s)) (Maybe b) Source #
onNothingA :: ArrowChoice arr => arr (e, s) a -> arr (e, (Maybe a, s)) a Source #
class (Monad m, Arrow arr) => ArrowKleisli m arr | arr -> m where Source #
The class of Kleisli arrows, arrows made from monadic functions. Instances should satisfy the following laws:
Instances
| Monad m => ArrowKleisli m (Kleisli m) Source # | |
Defined in Control.Arrow.Extended | |
| Monad m => ArrowKleisli m (Rule m) Source # | |
Defined in Hasura.Incremental.Internal.Rule | |
| ArrowKleisli m arr => ArrowKleisli m (WriterA w arr) Source # | |
Defined in Control.Arrow.Extended | |
| ArrowKleisli m arr => ArrowKleisli m (ReaderA r arr) Source # | |
Defined in Control.Arrow.Extended | |
| (ArrowKleisli m arr, ArrowChoice arr) => ArrowKleisli m (ErrorA e arr) Source # | |
Defined in Control.Arrow.Extended | |
bindA :: ArrowKleisli m arr => arr (m a) a Source #
A combinator that serves a similar role to returnA in arrow notation, except that the
argument is a monadic action instead of a pure value. Just as returnA is actually just
, arr idbindA is just , but it is provided as a separate function for
clarity.arrM id
bindA is useful primarily because it allows executing a monadic action using arrow inputs
currently in scope. For example:
proc (a, b) -> do
x <- foo -< a
y <- bar -< b
bindA -< f x y
The last statement is equivalent to , but the use of arrM (uncurry f) -< (x, y)bindA
allows it to be expressed more directly.