Safe Haskell | None |
---|---|
Language | Haskell2010 |
Data.Record.Generic.Transform
Synopsis
- type family Interpreted (d :: dom) x
- newtype Interpret (d :: dom) x = Interpret (Interpreted d x)
- liftInterpreted :: forall {dom1} {dom2} (dx :: dom1) x (dy :: dom2) y. (Interpreted dx x -> Interpreted dy y) -> Interpret dx x -> Interpret dy y
- 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)
- type HasNormalForm (d :: dom) x y = InterpretTo d (MetadataOf x) (MetadataOf y)
- type family InterpretTo (d :: dom) (xs :: [(k, Type)]) (ys :: [(k, Type)]) where ...
- type family IfEqual (x :: t) (y :: t) (r :: k) :: k where ...
- normalize :: forall {dom} (d :: dom) x y. HasNormalForm d x y => Proxy d -> Proxy y -> Rep I x -> Rep (Interpret d) y
- denormalize :: forall {dom} (d :: dom) x y. HasNormalForm d x y => Proxy d -> Proxy y -> Rep (Interpret d) y -> Rep I x
- data Uninterpreted (x :: k)
- data DefaultInterpretation (f :: Type -> Type)
- 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))
- 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)
- class StandardInterpretation (d :: (k -> Type) -> dom) (f :: k -> Type) where
- standardInterpretation :: forall (x :: k). Proxy d -> (Interpreted (d f) (Uninterpreted x) -> f x, f x -> Interpreted (d f) (Uninterpreted x))
- toStandardInterpretation :: forall {k} {dom} (d :: (k -> Type) -> dom) f (x :: k). StandardInterpretation d f => Proxy d -> f x -> Interpret (d f) (Uninterpreted x)
- fromStandardInterpretation :: forall {k} {dom} (d :: (k -> Type) -> dom) f (x :: k). StandardInterpretation d f => Proxy d -> Interpret (d f) (Uninterpreted x) -> f x
Interpretation function
type family Interpreted (d :: dom) x Source #
Instances
type Interpreted (DefaultInterpretation f :: Type) (Uninterpreted x) Source # | |
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) |
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
type Interpreted (DefaultInterpretation f :: Type) (Uninterpreted x) Source # | |
Defined in Data.Record.Generic.Transform |
data DefaultInterpretation (f :: Type -> Type) Source #
Instances
StandardInterpretation DefaultInterpretation (f :: Type -> Type) Source # | |
Defined in Data.Record.Generic.Transform Methods standardInterpretation :: Proxy DefaultInterpretation -> (Interpreted (DefaultInterpretation f) (Uninterpreted x) -> f x, f x -> Interpreted (DefaultInterpretation f) (Uninterpreted x)) Source # | |
type Interpreted (DefaultInterpretation f :: Type) (Uninterpreted x) Source # | |
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 #
Instances
StandardInterpretation DefaultInterpretation (f :: Type -> Type) Source # | |
Defined in Data.Record.Generic.Transform Methods standardInterpretation :: Proxy DefaultInterpretation -> (Interpreted (DefaultInterpretation f) (Uninterpreted x) -> f x, f x -> Interpreted (DefaultInterpretation 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 #