Safe Haskell | None |
---|---|
Language | Haskell2010 |
- class Proj label ty where
- type ProjTy label ty
- data Projection t a where
- ProjNil :: Projection t '[]
- Combine :: (KnownSymbol a, Proj a t) => LblProxy (a :: Symbol) -> Projection t b -> Projection t (a ': b)
- type family HasProj (a :: [Symbol]) t = (r :: Constraint) where ...
- proj :: forall t lbls. HasProj lbls t => Projection t lbls -> t -> Rec t lbls
- projVal :: forall label key more v t. ReadRec label (IsEqLabel key label) (Rec t (key ': more)) v => LblProxy label -> Rec t (key ': more) -> v
- (@@) :: (KnownSymbol a, Proj a t) => LblProxy (a :: Symbol) -> Projection t b -> Projection t (a ': b)
- data AnyProj t = (Typeable x, HasProj x t) => AnyProj {
- unAnyProj :: Projection t x
- data AnyRec t = Typeable x => AnyRec {}
- runAnyProj :: t -> AnyProj t -> AnyRec t
- anyToTypedProj :: forall t x. (HasProj x t, Typeable x, Typeable t) => (AnyProj t -> AnyRec t) -> Projection t x -> Rec t x
- anyToTypedProjM :: forall m t x. (Monad m, HasProj x t, Typeable x, Typeable t) => (AnyProj t -> m (AnyRec t)) -> Projection t x -> m (Rec t x)
- data LblProxy t = LblProxy
- class ReadRec label eq r v | label r -> v where
- type family RecValTy label (t :: *) (lbls :: [Symbol]) where ...
- type family IsEqLabel (label :: Symbol) (label2 :: Symbol) = (r :: Bool) where ...
- data Rec t labels where
Documentation
class Proj label ty where Source #
A named projection on a type. Very similar to Has
but w/o a setter
data Projection t a where Source #
A list of projections to be applied to a type
ProjNil :: Projection t '[] | |
Combine :: (KnownSymbol a, Proj a t) => LblProxy (a :: Symbol) -> Projection t b -> Projection t (a ': b) |
Eq (Projection t a) Source # | |
(Proj a t, KnownSymbol a, Read (Projection t as)) => Read (Projection t ((:) Symbol a as)) Source # | |
Read (Projection t ([] Symbol)) Source # | |
Show (Projection t a) Source # | |
type family HasProj (a :: [Symbol]) t = (r :: Constraint) where ... Source #
Construct a constraint that asserts that for all labels a projection for type t exists
projVal :: forall label key more v t. ReadRec label (IsEqLabel key label) (Rec t (key ': more)) v => LblProxy label -> Rec t (key ': more) -> v Source #
Read a projection from a projection record
(@@) :: (KnownSymbol a, Proj a t) => LblProxy (a :: Symbol) -> Projection t b -> Projection t (a ': b) infixr 5 Source #
Infix alias for Combine
Type lifting
(Typeable x, HasProj x t) => AnyProj | |
|
runAnyProj :: t -> AnyProj t -> AnyRec t Source #
anyToTypedProj :: forall t x. (HasProj x t, Typeable x, Typeable t) => (AnyProj t -> AnyRec t) -> Projection t x -> Rec t x Source #
anyToTypedProjM :: forall m t x. (Monad m, HasProj x t, Typeable x, Typeable t) => (AnyProj t -> m (AnyRec t)) -> Projection t x -> m (Rec t x) Source #
Internal helpers
type family RecValTy label (t :: *) (lbls :: [Symbol]) where ... Source #
RecValTy label t lbls = RecValTyH label lbls (RecTys t lbls) |
data Rec t labels where Source #
((~) * (RecValTy label t ((:) Symbol key more)) v, ReadRec label (IsEqLabel key label) (Rec t ((:) Symbol key more)) v) => ReadRec label False (Rec t ((:) Symbol l1 ((:) Symbol key more))) v Source # | |
(~) * (ProjTy key t) v => ReadRec label True (Rec t ((:) Symbol key more)) v Source # | |
(Eq (Rec t ls), Eq (ProjTy l t)) => Eq (Rec t ((:) Symbol l ls)) Source # | |
Eq (Rec c ([] Symbol)) Source # | |
(Show (ProjTy l t), Show (Rec t ls)) => Show (Rec t ((:) Symbol l ls)) Source # | |
Show (Rec c ([] Symbol)) Source # | |