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