large-generics-0.2.3: Generic programming API for large-records and large-anon
Safe HaskellNone
LanguageHaskell2010

Data.Record.Generic.Transform

Synopsis

Interpretation function

type family Interpreted (d :: dom) x Source #

Instances

Instances details
type Interpreted (DefaultInterpretation f :: Type) (Uninterpreted x) Source # 
Instance details

Defined in Data.Record.Generic.Transform

newtype Interpret (d :: dom) x Source #

Constructors

Interpret (Interpreted d x) 

Working with the Interpreted newtype wrapper

liftInterpreted :: forall {dom1} {dom2} (dx :: dom1) x (dy :: dom2) y. (Interpreted dx x -> Interpreted dy y) -> Interpret dx x -> Interpret dy y Source #

liftInterpretedA2 :: forall {dom1} {dom2} {dom3} m (dx :: dom1) x (dy :: dom2) y (dz :: dom3) z. Applicative m => (Interpreted dx x -> Interpreted dy y -> m (Interpreted dz z)) -> Interpret dx x -> Interpret dy y -> m (Interpret dz z) Source #

Normal form

Existence

type HasNormalForm (d :: dom) x y = InterpretTo d (MetadataOf x) (MetadataOf y) Source #

type family InterpretTo (d :: dom) (xs :: [(k, Type)]) (ys :: [(k, Type)]) where ... Source #

Equations

InterpretTo (_1 :: dom) ('[] :: [(k, Type)]) ('[] :: [(k, Type)]) = () 
InterpretTo (d :: dom) ('(f, x) ': xs :: [(k, Type)]) ('(f, y) ': ys :: [(k, Type)]) = IfEqual x (Interpreted d y) (InterpretTo d xs ys) 

type family IfEqual (x :: t) (y :: t) (r :: k) :: k where ... Source #

Equations

IfEqual (actual :: t) (actual :: t) (k2 :: k1) = k2 
IfEqual (expected :: t) (actual :: t) (k2 :: k1) = TypeError ((('Text "Expected " ':<>: 'ShowType expected) ':<>: 'Text " but got ") ':<>: 'ShowType actual) :: k1 

Construction

normalize :: forall {dom} (d :: dom) x y. HasNormalForm d x y => Proxy d -> Proxy y -> Rep I x -> Rep (Interpret d) y Source #

Construct normal form

TODO: Documentation.

denormalize :: forall {dom} (d :: dom) x y. HasNormalForm d x y => Proxy d -> Proxy y -> Rep (Interpret d) y -> Rep I x Source #

Specialized forms for the common case of a single type argument

data Uninterpreted (x :: k) Source #

Instances

Instances details
type Interpreted (DefaultInterpretation f :: Type) (Uninterpreted x) Source # 
Instance details

Defined in Data.Record.Generic.Transform

normalize1 :: forall {k} {dom} (d :: (k -> Type) -> dom) (f :: k -> Type) x. HasNormalForm (d f) (x f) (x (Uninterpreted :: k -> Type)) => Proxy d -> Rep I (x f) -> Rep (Interpret (d f)) (x (Uninterpreted :: k -> Type)) Source #

denormalize1 :: forall {k} {dom} (d :: (k -> Type) -> dom) (f :: k -> Type) x. HasNormalForm (d f) (x f) (x (Uninterpreted :: k -> Type)) => Proxy d -> Rep (Interpret (d f)) (x (Uninterpreted :: k -> Type)) -> Rep I (x f) Source #

Generalization of the default interpretation

class StandardInterpretation (d :: (k -> Type) -> dom) (f :: k -> Type) where Source #

Minimal complete definition

Nothing

Methods

standardInterpretation :: forall (x :: k). Proxy d -> (Interpreted (d f) (Uninterpreted x) -> f x, f x -> Interpreted (d f) (Uninterpreted x)) Source #

default standardInterpretation :: forall (x :: k). Coercible (Interpreted (d f) (Uninterpreted x)) (f x) => Proxy d -> (Interpreted (d f) (Uninterpreted x) -> f x, f x -> Interpreted (d f) (Uninterpreted x)) Source #

toStandardInterpretation :: forall {k} {dom} (d :: (k -> Type) -> dom) f (x :: k). StandardInterpretation d f => Proxy d -> f x -> Interpret (d f) (Uninterpreted x) Source #

fromStandardInterpretation :: forall {k} {dom} (d :: (k -> Type) -> dom) f (x :: k). StandardInterpretation d f => Proxy d -> Interpret (d f) (Uninterpreted x) -> f x Source #