yoko-0.9: Generic Programming with Disbanded Data Types

Portabilitysee LANGUAGE pragmas (... GHC)
Stabilityexperimental
Maintainernicolas.frisby@gmail.com
Safe HaskellNone

Data.Yoko.HCompos

Description

The generic homomorphism or "heterogenous compos".

See the paper "A Pattern for Almost Homomorphic Functions" at http://www.ittc.ku.edu/~nfrisby/frisby-2012-wgp.pdf, presented at the Workshop on Generic Programming 2012.

Synopsis

Documentation

type family Idiom cnv :: * -> *Source

The applicative functor required by the conversion.

class Applicative (Idiom cnv) => Convert cnv a b whereSource

Use the conversion cnv to convert from a to b.

Methods

convert :: cnv -> a -> Idiom cnv bSource

Instances

(Applicative (Idiom (a -> i b)), Applicative i, ~ * a x, ~ * b y) => Convert (a -> i b) x y 

class Applicative (Idiom cnv) => HCompos cnv a t whereSource

The generic version of convert; operates on disbanded data types.

Methods

hcompos :: cnv -> a -> Idiom cnv tSource

Instances

(Applicative (Idiom cnv), Generic dcA, ~ (FoundDC *) (Match * dcB) (WithMessage dcA b (FindDCs (Tag dcA) (DCs b))), MapRs cnv (ResultsInIncompatibleFields dcA dcB) dcA dcB (Rep dcA) (Rep dcB), DC dcB, ~ * (Codomain dcB) b, DT b) => HCompos cnv (N dcA) b 
(Applicative (Idiom cnv), HCompos cnv a t, HCompos cnv b t) => HCompos cnv (:+: a b) t 

data FoundDC star Source

Constructors

NoCorrespondingConstructorFor_In_ star star 
Match star 

type family WithMessage dcA b dcB :: FoundDC *Source

type family FindDCs s dcBs :: Maybe *Source

FindDCs dcA dcBs returns a type-level Maybe. Just dcB is a fields type dcB where Tag dcA ~ dcB.

class Applicative (Idiom cnv) => MapRs cnv msg dc dc' prod prod' whereSource

Same as compos semantics, but with a generalized type and just for converting between product representations.

Methods

mapRs :: cnv -> msg -> Proxy dc -> Proxy dc' -> prod -> Idiom cnv prod'Source

Instances

Applicative (Idiom cnv) => MapRs cnv msg dc dc' U U 
Applicative (Idiom cnv) => MapRs cnv msg dc dc' (Dep a) (Dep a) 
(Applicative (Idiom cnv), Convert cnv a b) => MapRs cnv msg dc dc' (Rec a) (Rec b) 
(Applicative (Idiom cnv), Traversable f, MapRs cnv msg dc dc' a a') => MapRs cnv msg dc dc' (Par1 f a) (Par1 f a') 
(Applicative (Idiom cnv), MapRs cnv msg dc dc' a a', MapRs cnv msg dc dc' b b') => MapRs cnv msg dc dc' (:*: a b) (:*: a' b') 
(Applicative (Idiom cnv), Bitraversable f, MapRs cnv msg dc dc' a a', MapRs cnv msg dc dc' b b') => MapRs cnv msg dc dc' (Par2 f a b) (Par2 f a' b')