yoko-2.0: 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) => Convert0 cnv a b whereSource

Use the conversion cnv to convert from a to b.

Methods

convert0 :: cnv -> a -> Idiom cnv bSource

Instances

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

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

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

Methods

hcompos0 :: cnv -> a p1 p0 -> Idiom cnv tSource

Instances

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

type family WithMessage dcA b dcB :: FoundDC k lSource

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) => MapRs0 cnv msg dc dc' prod prod' whereSource

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

Methods

mapRs0 :: cnv -> msg -> Proxy dc -> Proxy dc' -> prod p1 p0 -> Idiom cnv (prod' p1 p0)Source

Instances

Applicative (Idiom cnv) => MapRs0 k k1 * * cnv msg dc dc' U U 
Applicative (Idiom cnv) => MapRs0 k k1 * * cnv msg dc dc' (T0 Dep a) (T0 Dep a) 
Convert0 cnv a b => MapRs0 k k1 * * cnv msg dc dc' (T0 (Rec lbl) a) (T0 (Rec lbl') b) 
(MapRs0 k k1 * * cnv msg dc dc' a a', MapRs0 k k1 * * cnv msg dc dc' b b') => MapRs0 k k1 * * cnv msg dc dc' (:*: a b) (:*: a' b') 
(Traversable f, MapRs0 k k1 * * cnv msg dc dc' a a') => MapRs0 k k1 * * cnv msg dc dc' (T1 Dep f a) (T1 Dep f a') 
MapRs0 k k1 * * cnv msg dc dc' a a' => MapRs0 k k1 * * cnv msg dc dc' (C k2 dcA a) (C k3 dcB a') 
(Bitraversable f, MapRs0 k k1 * * cnv msg dc dc' a a', MapRs0 k k1 * * cnv msg dc dc' b b') => MapRs0 k k1 * * cnv msg dc dc' (T2 Dep f a b) (T2 Dep f a' b')