Copyright | (C) 2015 The University of Kansas |
---|---|
License | BSD-style (see the file LICENSE) |
Maintainer | Andy Gill |
Stability | Experimental |
Safe Haskell | Safe |
Language | Haskell2010 |
Control.Natural
Description
A data type and class for natural transformations.
Synopsis
- newtype (f :: k -> Type) :~> (g :: k -> Type) = NT {}
- type (~>) (f :: k -> Type) (g :: k -> Type) = forall (x :: k). f x -> g x
- wrapNT :: (forall (a :: k). f a -> g a) -> f :~> g
- unwrapNT :: Transformation f g t => t -> forall (a :: k). f a -> g a
- class Transformation (f :: k -> Type) (g :: k -> Type) t | t -> f g where
- (#) :: t -> forall (a :: k). f a -> g a
Newtype for a Natural Transformation
newtype (f :: k -> Type) :~> (g :: k -> Type) infixr 0 Source #
A natural transformation suitable for storing in a container.
Type Synonym for a Natural Transformation
type (~>) (f :: k -> Type) (g :: k -> Type) = forall (x :: k). f x -> g x infixr 0 Source #
A natural transformation from f
to g
.
Conversion functions between the newtype and the synonym
unwrapNT :: Transformation f g t => t -> forall (a :: k). f a -> g a Source #
Class for Natural Transformations
class Transformation (f :: k -> Type) (g :: k -> Type) t | t -> f g where Source #
A (natural) transformation is inside t
, and contains f
and g
(typically Functor
s).
The order of arguments allows the use of GeneralizedNewtypeDeriving
to wrap
a :~>
, but maintain the Transformation
constraint. Thus, #
can be used
on abstract data types.
Methods
(#) :: t -> forall (a :: k). f a -> g a infix 0 Source #
The invocation method for a natural transformation.
Instances
Transformation (f :: Type -> Type) IO (Object f) Source # | |
Defined in Control.Object | |
Transformation (f :: k -> Type) (g :: k -> Type) (f :~> g) Source # | |
Defined in Control.Natural |