free-5.1.10: Monads for free
Copyright(C) 2012 Edward Kmett
LicenseBSD-style (see the file LICENSE)
MaintainerEdward Kmett <ekmett@gmail.com>
Stabilityprovisional
PortabilityGADTs, Rank2Types
Safe HaskellSafe
LanguageHaskell2010

Control.Alternative.Free

Description

Left distributive Alternative functors for free, based on a design by Stijn van Drongelen.

Synopsis

Documentation

newtype Alt f a Source #

Constructors

Alt 

Fields

Instances

Instances details
Alternative (Alt f) Source # 
Instance details

Defined in Control.Alternative.Free

Methods

empty :: Alt f a Source #

(<|>) :: Alt f a -> Alt f a -> Alt f a Source #

some :: Alt f a -> Alt f [a] Source #

many :: Alt f a -> Alt f [a] Source #

Applicative (Alt f) Source # 
Instance details

Defined in Control.Alternative.Free

Methods

pure :: a -> Alt f a Source #

(<*>) :: Alt f (a -> b) -> Alt f a -> Alt f b Source #

liftA2 :: (a -> b -> c) -> Alt f a -> Alt f b -> Alt f c Source #

(*>) :: Alt f a -> Alt f b -> Alt f b Source #

(<*) :: Alt f a -> Alt f b -> Alt f a Source #

Functor (Alt f) Source # 
Instance details

Defined in Control.Alternative.Free

Methods

fmap :: (a -> b) -> Alt f a -> Alt f b Source #

(<$) :: a -> Alt f b -> Alt f a Source #

Alt (Alt f) Source # 
Instance details

Defined in Control.Alternative.Free

Methods

(<!>) :: Alt f a -> Alt f a -> Alt f a Source #

some :: Applicative (Alt f) => Alt f a -> Alt f [a] Source #

many :: Applicative (Alt f) => Alt f a -> Alt f [a] Source #

Apply (Alt f) Source # 
Instance details

Defined in Control.Alternative.Free

Methods

(<.>) :: Alt f (a -> b) -> Alt f a -> Alt f b Source #

(.>) :: Alt f a -> Alt f b -> Alt f b Source #

(<.) :: Alt f a -> Alt f b -> Alt f a Source #

liftF2 :: (a -> b -> c) -> Alt f a -> Alt f b -> Alt f c Source #

Monoid (Alt f a) Source # 
Instance details

Defined in Control.Alternative.Free

Methods

mempty :: Alt f a Source #

mappend :: Alt f a -> Alt f a -> Alt f a Source #

mconcat :: [Alt f a] -> Alt f a Source #

Semigroup (Alt f a) Source # 
Instance details

Defined in Control.Alternative.Free

Methods

(<>) :: Alt f a -> Alt f a -> Alt f a Source #

sconcat :: NonEmpty (Alt f a) -> Alt f a Source #

stimes :: Integral b => b -> Alt f a -> Alt f a Source #

data AltF f a where Source #

Constructors

Ap :: f a -> Alt f (a -> b) -> AltF f b infixl 3 
Pure :: a -> AltF f a 

Instances

Instances details
Applicative (AltF f) Source # 
Instance details

Defined in Control.Alternative.Free

Methods

pure :: a -> AltF f a Source #

(<*>) :: AltF f (a -> b) -> AltF f a -> AltF f b Source #

liftA2 :: (a -> b -> c) -> AltF f a -> AltF f b -> AltF f c Source #

(*>) :: AltF f a -> AltF f b -> AltF f b Source #

(<*) :: AltF f a -> AltF f b -> AltF f a Source #

Functor (AltF f) Source # 
Instance details

Defined in Control.Alternative.Free

Methods

fmap :: (a -> b) -> AltF f a -> AltF f b Source #

(<$) :: a -> AltF f b -> AltF f a Source #

runAlt :: forall f g a. Alternative g => (forall x. f x -> g x) -> Alt f a -> g a Source #

Given a natural transformation from f to g, this gives a canonical monoidal natural transformation from Alt f to g.

liftAlt :: f a -> Alt f a Source #

A version of lift that can be used with any f.

hoistAlt :: (forall a. f a -> g a) -> Alt f b -> Alt g b Source #

Given a natural transformation from f to g this gives a monoidal natural transformation from Alt f to Alt g.