free-4.12.4: 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.Final

Description

Final encoding of free Alternative functors.

Synopsis

Documentation

newtype Alt f a #

The free Alternative for a Functor f.

Constructors

Alt 

Fields

Instances

Functor (Alt f) # 

Methods

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

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

Applicative (Alt f) # 

Methods

pure :: a -> Alt f a #

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

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

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

Alternative (Alt f) # 

Methods

empty :: Alt f a #

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

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

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

Alt (Alt f) # 

Methods

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

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

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

Apply (Alt f) # 

Methods

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

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

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

Semigroup (Alt f a) # 

Methods

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

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

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

Monoid (Alt f a) # 

Methods

mempty :: Alt f a #

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

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

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

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 #

A version of lift that can be used with f.

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

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