| Portability | non-portable |
|---|---|
| Stability | experimental |
| Maintainer | sjoerd@w3future.com |
| Safe Haskell | None |
Data.Functor.Free
Description
A free functor is left adjoint to a forgetful functor. In this package the forgetful functor forgets class constraints.
- newtype Free c a = Free {
- runFree :: forall b. c b => (a -> b) -> b
- unit :: a -> Free c a
- rightAdjunct :: c b => (a -> b) -> Free c a -> b
- rightAdjunctF :: ForallF c f => (a -> f b) -> Free c a -> f b
- rightAdjunctT :: ForallT c t => (a -> t f b) -> Free c a -> t f b
- counit :: c a => Free c a -> a
- leftAdjunct :: (Free c a -> b) -> a -> b
- newtype LiftAFree c f a = LiftAFree {
- getLiftAFree :: f (Free c a)
- convert :: (c (f a), Applicative f) => Free c a -> f a
- convertClosed :: c r => Free c Void -> r
- type InitialObject c = Free c Void
- initial :: c r => InitialObject c -> r
- type Coproduct c m n = Free c (Either m n)
- coproduct :: c r => (m -> r) -> (n -> r) -> Coproduct c m n -> r
- inL :: c m => m -> Coproduct c m n
- inR :: c n => n -> Coproduct c m n
- product :: (r -> m) -> (r -> n) -> r -> Free c (m, n)
- fstP :: c m => Free c (m, n) -> m
- sndP :: c n => Free c (m, n) -> n
Documentation
The free functor for constraint c.
Instances
| ~ (* -> Constraint) c (Class f) => Algebra f (Free c a) | |
| ForallF c (Free c) => Monad (Free c) | |
| Functor (Free c) | |
| Applicative (Free c) | |
| ForallT c (LiftAFree c) => Foldable (Free c) | |
| ForallT c (LiftAFree c) => Traversable (Free c) | |
| (ForallF c Identity, ForallF c (Free c), ForallF c (Compose (Free c) (Free c))) => Comonad (Free c) |
rightAdjunct :: c b => (a -> b) -> Free c a -> bSource
rightAdjunctF :: ForallF c f => (a -> f b) -> Free c a -> f bSource
rightAdjunctT :: ForallT c t => (a -> t f b) -> Free c a -> t f bSource
leftAdjunct :: (Free c a -> b) -> a -> bSource
leftAdjunct f = f . unit
newtype LiftAFree c f a Source
Constructors
| LiftAFree | |
Fields
| |
Instances
| (Applicative f, ~ (* -> Constraint) c (Class s)) => Algebra s (LiftAFree c f a) |
convert :: (c (f a), Applicative f) => Free c a -> f aSource
convertClosed :: c r => Free c Void -> rSource
type InitialObject c = Free c VoidSource
initial :: c r => InitialObject c -> rSource