| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
Control.Alternative.Free.Lawless
Description
Free Alternative (with no laws beyond monoidal).
Free Alternative but assumes no laws relating
Applicative structure and Alternative methods,
just inherited Applicative laws and (empty, being
monoid.<|>)
Synopsis
- data Free (f :: Type -> Type) a where
- newtype Factor (f :: Type -> Type) a = Factor {}
- newtype Summand (f :: Type -> Type) a = Summand {
- runSummand :: Either (f a) (Ap' (Factor f) a)
- viewAp :: forall (f :: Type -> Type) a. Free f a -> Ap (Factor f) a
- reviewAp :: forall (f :: Type -> Type) a. Functor f => Ap (Factor f) a -> Free f a
- viewSum :: forall (f :: Type -> Type) a. Free f a -> [Summand f a]
- reviewSum :: forall (f :: Type -> Type) a. [Summand f a] -> Free f a
- liftFree :: f a -> Free f a
- hoistFree :: (forall x. f x -> g x) -> Free f a -> Free g a
- foldFree :: forall f g a. Alternative g => (forall x. f x -> g x) -> Free f a -> g a
- data Ap' (f :: Type -> Type) a where
- toAp :: forall (f :: Type -> Type) a. Ap' f a -> Ap f a
- notOneAp :: Functor f => Ap f a -> Either (f a) (Ap' f a)
Type definitions
data Free (f :: Type -> Type) a Source #
Bundled Patterns
| pattern SumOf :: [Summand f a] -> Free f a | View as a list of |
| pattern ApOf :: Functor f => Ap (Factor f) a -> Free f a |
newtype Factor (f :: Type -> Type) a Source #
Subexpressions of Free f a which cannot be written as
nontrivial apply x .<*> y
newtype Summand (f :: Type -> Type) a Source #
Subexpressions of Free f a which cannot be written as
nontrivial sum x .<|> y
Constructors
| Summand | |
Fields
| |
Universal property
foldFree :: forall f g a. Alternative g => (forall x. f x -> g x) -> Free f a -> g a Source #
Auxiliary types
data Ap' (f :: Type -> Type) a where Source #
Free Applicative but Ap f a, is excluded.liftAp fa
uses zero or more values of Ap f af _,
but Ap' f a uses either none (Pure') or 2+ times (ApMany').
Constructors
| Pure' :: forall a (f :: Type -> Type). a -> Ap' f a | |
| ApMany' :: forall (f :: Type -> Type) a1 b a. f a1 -> f b -> Ap f (b -> a1 -> a) -> Ap' f a |