large-generics-0.2.1: Generic programming API for large-records and large-anon
Safe HaskellSafe-Inferred
LanguageHaskell2010

Data.Record.Generic.Transform

Synopsis

Interpretation function

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

Instances

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

Defined in Data.Record.Generic.Transform

newtype Interpret d x Source #

Constructors

Interpret (Interpreted d x) 

Working with the Interpreted newtype wrapper

liftInterpretedA2 :: 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 family InterpretTo d xs ys :: Constraint where ... Source #

Equations

InterpretTo _ '[] '[] = () 
InterpretTo d ('(f, x) ': xs) ('(f, y) ': ys) = IfEqual x (Interpreted d y) (InterpretTo d xs ys) 

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

Equations

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

Construction

normalize :: HasNormalForm d x y => Proxy d -> Proxy y -> Rep I x -> Rep (Interpret d) y Source #

Construct normal form

TODO: Documentation.

denormalize :: 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 Source #

Instances

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

Defined in Data.Record.Generic.Transform

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

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

Generalization of the default interpretation

class StandardInterpretation d f where Source #

Minimal complete definition

Nothing

Methods

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

default standardInterpretation :: 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 #