natural-transformation-0.3: A natural transformation package.

Copyright(C) 2015 The University of Kansas
LicenseBSD-style (see the file LICENSE)
MaintainerAndy Gill
StabilityExperimental
Safe HaskellSafe
LanguageHaskell2010

Control.Natural

Contents

Description

A data type and class for natural transformations.

Synopsis

Type Synonym for a Natural Transformation

type (~>) f g = forall x. f x -> g x infixr 0 Source

A natural transformation from f to g.

Newtype for a Natural Transformation

newtype f :~> g infixr 0 Source

A natural transformation suitable for storing in a container.

Constructors

Nat 

Fields

($$) :: f ~> g
 

Instances

Transformation k f g ((:~>) k f g) Source 
Category (k -> *) ((:~>) k) Source 
(~) (k -> *) f g => Monoid ((:~>) k f g) Source 

Class for Natural Transformations

class Transformation f g t | t -> f g where Source

A (natural) transformation is inside t, and contains f and g (typically Functors).

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 -> f a -> g a infix 0 Source

The invocation method for a natural transformation.

Instances