Safe Haskell | None |
---|---|
Language | Haskell2010 |
Data.Reproject
- class Proj label ty where
- data Projection t a where
- ProjNil :: Projection t '[]
- Combine :: (KnownSymbol a, Proj a t, Cons a (ProjVal a t) (MakeTuple t b)) => Proxy (a :: Symbol) -> Projection t b -> Projection t (a ': b)
- type family HasProj (a :: [Symbol]) t :: Constraint where ...
- type family MakeTuple t k where ...
- proj :: forall a t r. (HasProj a t, r ~ MakeTuple t a) => Projection t a -> t -> r
- data Proxy k t :: forall k. k -> * = Proxy
- projVal :: Has label value record => Proxy label -> record -> value
- (@@) :: (KnownSymbol a, Proj a t, Cons a (ProjVal a t) (MakeTuple t b)) => Proxy (a :: Symbol) -> Projection t b -> Projection t (a ': b)
Documentation
class Proj label ty where Source #
A named projection on a type. Very similar to Has
but w/o a setter
Minimal complete definition
data Projection t a where Source #
A list of projections to be applied to a type
Constructors
ProjNil :: Projection t '[] | |
Combine :: (KnownSymbol a, Proj a t, Cons a (ProjVal a t) (MakeTuple t b)) => Proxy (a :: Symbol) -> Projection t b -> Projection t (a ': b) |
Instances
Eq (Projection t v) Source # | |
(Proj a t, KnownSymbol a, Read (Projection t as), Cons a (ProjVal a t) (MakeTuple t as)) => Read (Projection t ((:) Symbol a as)) Source # | |
Read (Projection t ([] Symbol)) Source # | |
Show (Projection t v) Source # | |
type family HasProj (a :: [Symbol]) t :: Constraint where ... Source #
Construct a constraint that asserts that for all labels a projection for type t exists
type family MakeTuple t k where ... Source #
Build a Labels compatible tuple from a list of projections
data Proxy k t :: forall k. k -> * #
A concrete, poly-kinded proxy type
Constructors
Proxy |
Instances
Monad (Proxy *) | |
Functor (Proxy *) | |
Applicative (Proxy *) | |
Foldable (Proxy *) | |
Traversable (Proxy *) | |
Generic1 (Proxy *) | |
Alternative (Proxy *) | |
MonadPlus (Proxy *) | |
Bounded (Proxy k s) | |
Enum (Proxy k s) | |
Eq (Proxy k s) | |
Ord (Proxy k s) | |
Read (Proxy k s) | |
Show (Proxy k s) | |
Ix (Proxy k s) | |
Generic (Proxy k t) | |
Monoid (Proxy k s) | |
type Rep1 (Proxy *) | |
type Rep (Proxy k t) | |
(@@) :: (KnownSymbol a, Proj a t, Cons a (ProjVal a t) (MakeTuple t b)) => Proxy (a :: Symbol) -> Projection t b -> Projection t (a ': b) infixr 5 Source #
Infix alias for Combine