graphql-engine-1.0.0: GraphQL API over Postgres
Safe HaskellNone
LanguageHaskell2010

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

Documentation

(>->) :: Arrow arr => arr (e, s) a -> arr (e, (a, s)) b -> arr (e, s) b infixl 1 Source #

The analog to >>= for arrow commands. In proc notation, >-> can be used to chain the output of one command into the input of another.

See also Note [Weird control operator types].

(<-<) :: Arrow arr => arr (e, (a, s)) b -> arr (e, s) a -> arr (e, s) b infixr 1 Source #

dup :: Arrow arr => arr a (a, a) Source #

bothA :: Arrow arr => arr a b -> arr (a, a) (b, b) Source #

orA :: ArrowChoice arr => arr a Bool -> arr b Bool -> arr (a, b) Bool Source #

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 #

data Traversal a r b Source #

An indexed version of Twan van Laarhoven’s FunList type (see https://twanvl.nl/blog/haskell/non-regular1). A value of type Traversal a b (t b) is a concrete representation of a traversal applied to a data structure of type t a and producing a value of type t b. This explicit representation is used to implement traverseA using only ArrowChoice.

Constructors

Done b 
Yield a !(r -> Traversal a r b) 

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:

Methods

arrM :: (a -> m b) -> arr a b Source #

Instances

Instances details
Monad m => ArrowKleisli m (Kleisli m) Source # 
Instance details

Defined in Control.Arrow.Extended

Methods

arrM :: (a -> m b) -> Kleisli m a b Source #

Monad m => ArrowKleisli m (Rule m) Source # 
Instance details

Defined in Hasura.Incremental.Internal.Rule

Methods

arrM :: (a -> m b) -> Rule m a b Source #

ArrowKleisli m arr => ArrowKleisli m (WriterA w arr) Source # 
Instance details

Defined in Control.Arrow.Extended

Methods

arrM :: (a -> m b) -> WriterA w arr a b Source #

ArrowKleisli m arr => ArrowKleisli m (ReaderA r arr) Source # 
Instance details

Defined in Control.Arrow.Extended

Methods

arrM :: (a -> m b) -> ReaderA r arr a b Source #

(ArrowKleisli m arr, ArrowChoice arr) => ArrowKleisli m (ErrorA e arr) Source # 
Instance details

Defined in Control.Arrow.Extended

Methods

arrM :: (a -> m b) -> ErrorA e arr a b Source #

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 id, bindA is just arrM id, but it is provided as a separate function for clarity.

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 arrM (uncurry f) -< (x, y), but the use of bindA allows it to be expressed more directly.