Copyright | (c) 2016 Alex Crough |
---|---|
License | BSD2 |
Maintainer | alex@crough.io |
Stability | Experimental |
Portability | RankNTypes, TupleSection, TypeOperators |
Safe Haskell | Safe |
Language | Haskell2010 |
- data Elision f a b
- type Elision' f a = Elision f (f a) a
- complete :: Monad m => (forall c. f c -> m c) -> a -> Elision f a b -> m b
- complete' :: Monad m => (forall c. f c -> m c) -> Elision f () b -> m b
- elide :: (a -> f c) -> (c -> b) -> Elision f a b
- initial :: f a -> Elision f () a
- simple :: Elision' f a
- unelide :: Monad m => Elision f a b -> (forall c. f c -> m c) -> a -> m b
- unelide' :: Monad m => Elision f () b -> (forall c. f c -> m c) -> m b
- data Sum f g a
- type (//) a b = Sum a b
- (//) :: (forall b. f b -> m b) -> (forall b. g b -> m b) -> Sum f g a -> m a
- left' :: Elision f a b -> Elision (f // g) a b
- right' :: Elision g a b -> Elision (f // g) a b
- (/>) :: Elision f a b -> Elision g b c -> Elision (f // g) a c
- (</) :: Elision f b c -> Elision g a b -> Elision (f // g) a c
- module Control.Arrow
- module Data.Profunctor
- apply :: ArrowApply a => a b c -> b -> a () c
Types
A lens-esque type that can be used to "skip" part of a function.
An Elision
can be used in the common interpreter pattern, in which case
f
represents the DSL type, a
represents the input of a function and b
represents the output.
type Elision' f a = Elision f (f a) a Source #
The type of the simplist elision, where unelide eli f = f
Elision manipulation functions
complete :: Monad m => (forall c. f c -> m c) -> a -> Elision f a b -> m b Source #
Construct an interpreter for an elision out of a function an initial argument.
complete' :: Monad m => (forall c. f c -> m c) -> Elision f () b -> m b Source #
Like complete
, but the unit type never has to be provided.
elide :: (a -> f c) -> (c -> b) -> Elision f a b Source #
Create an elision out of two functions to be completed at a later date.
unelide :: Monad m => Elision f a b -> (forall c. f c -> m c) -> a -> m b Source #
Deconstruct an Elision, returning its inner type.
unelide' :: Monad m => Elision f () b -> (forall c. f c -> m c) -> m b Source #
Like unelide
, but applies the unit type to the function immediately.
Combining Interpreters
(//) :: (forall b. f b -> m b) -> (forall b. g b -> m b) -> Sum f g a -> m a Source #
Create a function that can complete an elision of a sum out of two functions that can complete each individual parts.
right' :: Elision g a b -> Elision (f // g) a b Source #
Like right
, but over the first type argument.
(/>) :: Elision f a b -> Elision g b c -> Elision (f // g) a c Source #
Send the output of the left to the input of right, and add their f
types together.
(</) :: Elision f b c -> Elision g a b -> Elision (f // g) a c Source #
Send the output of the right to the input of the left, and add their f
types together.
Reexports
module Control.Arrow
module Data.Profunctor
apply :: ArrowApply a => a b c -> b -> a () c Source #