hextra-1.1.0.1: Generic and niche utility functions and more for Haskell.
Safe HaskellSafe-Inferred
LanguageHaskell2010

Hextra.Applicative

Description

Defines useful and alternative applicative functions and constructs.

Synopsis

Documentation

(<:>) :: forall f a b. Applicative f => f a -> f b -> f (a, b) infixl 5 Source #

Pairs up all elements in two applicative functors. One of the operations/values of the monoidal presentation of functors

(<::>) :: forall f a b. Applicative f => f a -> f b -> f (a, b) infixl 4 Source #

Just (<:>), but with lower precedence

(<<>>) :: forall f a. (Applicative f, Monoid a) => f a -> f a -> f a infixl 6 Source #

Adds up values in two applicative functors.

unit :: forall f. Applicative f => f () Source #

Applicative functor with () in it One of the operations/values of the monoidal presentation of functors

(<.>) :: forall f b c a. Applicative f => f (b -> c) -> f (a -> b) -> f (a -> c) Source #

Composes two applicative functions.

mkApp :: forall f a b. Functor f => (forall x y. f x -> f y -> f (x, y)) -> f (a -> b) -> f a -> f b Source #

Creates a (<*>) definition from a definition of (<:>). mkApp (<:>) = (<*>)

mkPure :: forall f a. Functor f => f () -> a -> f a Source #

Creates a pure definition from a definition of unit. mkPure unit = pure

class Monoidal f where Source #

Methods

nilA :: f () Source #

zipA :: f a -> f b -> f (a, b) Source #

mkNilA :: forall f. Functor f => (forall x. x -> f x) -> f () Source #

mkZipA :: forall f a b. Functor f => (forall x y. f (x -> y) -> f x -> f y) -> f a -> f b -> f (a, b) Source #