yoko-0.2: generic programming with disbanded constructors

Portabilitysee LANGUAGE pragmas (... GHC)



Natural transformations and pairs.



type NT_ u f = forall t. u t -> f tSource

newtype NT u f Source

Natural transformations. We use Unwrap to lighten the user interface at the value level, though it clutters the types a little.


NT (forall t. u t -> Unwrap f t) 

nt_ :: Proxy (KTSS f) -> (forall t. u t -> Unwrap f t) -> NT u fSource

appNT :: NT u f -> u t -> Unwrap f tSource

appNTF :: Wrapper f => NT u f -> NT_ u fSource

orNT :: NT u f -> NT v f -> NT (u :|| v) fSource

Defining an NT via type-level backtracking; :|| uses Pred to short-circuit, preferring inhabitation of u over v.

constNT :: Unwrap f t -> NT (:=: t) fSource

constNT_ :: Proxy (KTSS f) -> Unwrap f t -> NT (:=: t) fSource

constNTF :: Wrapper f => f t -> NT (:=: t) fSource

firstNT :: NT_ u g -> NT g f -> NT u fSource

data NP u f Source

Natural pairs.


forall t . NP (u t) (Unwrap f t) 

firstNP :: NT_ u v -> NP u f -> NP v fSource

Analog to Control.Arrow.first.

newtype ArrowTSS f g a Source

ArrowTSS can be partially applied, and hence occur as the second argument of NT, where as f _ -> g _ cannot.


ArrowTSS (f a -> g a) 


appNTtoNP :: (Wrapper f, Wrapper g) => NT u (ArrowTSS f g) -> NP u f -> NP u gSource