Safe Haskell | None |
---|---|
Language | Haskell2010 |
Commonly used Rec
instantiations.
Synopsis
- type (:::) a b = '(a, b)
- type FieldRec = Rec ElField
- type AFieldRec ts = ARec ElField ts
- type HList = Rec Identity
- type LazyHList = Rec Thunk
- getField :: ElField '(s, t) -> t
- getLabel :: forall s t. KnownSymbol s => ElField '(s, t) -> String
- fieldMap :: (a -> b) -> ElField '(s, a) -> ElField '(s, b)
- traverseField :: (KnownSymbol s, Functor f) => (a -> b) -> f (ElField '(s, a)) -> ElField '(s, f b)
- rfield :: Functor f => (a -> f b) -> ElField '(s, a) -> f (ElField '(s, b))
- (=:) :: KnownSymbol l => Label (l :: Symbol) -> (v :: *) -> ElField (l ::: v)
- rgetf :: forall l f v record us. (HasField record l us us v v, RecElemFCtx record f) => Label l -> record f us -> f (l ::: v)
- rvalf :: (HasField record l us us v v, RecElemFCtx record ElField) => Label l -> record ElField us -> v
- rputf' :: forall l v v' record us us'. (HasField record l us us' v v', KnownSymbol l, RecElemFCtx record ElField) => Label l -> v' -> record ElField us -> record ElField us'
- rputf :: forall l v record us. (HasField record l us us v v, KnownSymbol l, RecElemFCtx record ElField) => Label l -> v -> record ElField us -> record ElField us
- rlensfL' :: forall l v v' record g f us us'. (Functor g, HasField record l us us' v v', RecElemFCtx record f) => Label l -> (f (l ::: v) -> g (f (l ::: v'))) -> record f us -> g (record f us')
- rlensfL :: forall l v record g f us. (Functor g, HasField record l us us v v, RecElemFCtx record f) => Label l -> (f (l ::: v) -> g (f (l ::: v))) -> record f us -> g (record f us)
- rlensf' :: forall l v v' record g us us'. (Functor g, HasField record l us us' v v', RecElemFCtx record ElField) => Label l -> (v -> g v') -> record ElField us -> g (record ElField us')
- rlensf :: forall l v record g us. (Functor g, HasField record l us us v v, RecElemFCtx record ElField) => Label l -> (v -> g v) -> record ElField us -> g (record ElField us)
- (=:=) :: KnownSymbol s => Label (s :: Symbol) -> a -> FieldRec '['(s, a)]
- data SField (field :: k) = SField
- type family FieldType l fs where ...
- type HasField record l fs fs' v v' = (RecElem record (l ::: v) (l ::: v') fs fs' (RIndex (l ::: v) fs), FieldType l fs ~ v, FieldType l fs' ~ v')
- data Label (a :: Symbol) = Label
- class (KnownSymbol (Fst a), a ~ '(Fst a, Snd a)) => KnownField a
- type AllFields fs = (RPureConstrained KnownField fs, RecApplicative fs, RApply fs)
- rmapf :: AllFields fs => (forall a. KnownField a => f a -> g a) -> Rec f fs -> Rec g fs
- type family Unlabeled ts where ...
- class StripFieldNames ts where
- rpuref :: AllFields fs => (forall a. KnownField a => f a) -> Rec f fs
- (<<$$>>) :: AllFields fs => (forall a. KnownField a => f a -> g a) -> Rec f fs -> Rec g fs
- rlabels :: AllFields fs => Rec (Const String) fs
Documentation
type AFieldRec ts = ARec ElField ts Source #
An ARec
of named fields to provide constant-time field access.
type HList = Rec Identity Source #
Heterogeneous list whose elements are evaluated during list construction.
type LazyHList = Rec Thunk Source #
Heterogeneous list whose elements are left as-is during list
construction (cf. HList
).
getLabel :: forall s t. KnownSymbol s => ElField '(s, t) -> String Source #
Get the label name of an ElField
.
fieldMap :: (a -> b) -> ElField '(s, a) -> ElField '(s, b) Source #
ElField
is isomorphic to a functor something like Compose
ElField ('(,) s)
.
traverseField :: (KnownSymbol s, Functor f) => (a -> b) -> f (ElField '(s, a)) -> ElField '(s, f b) Source #
rfield :: Functor f => (a -> f b) -> ElField '(s, a) -> f (ElField '(s, b)) Source #
Lens for an ElField'
s data payload.
(=:) :: KnownSymbol l => Label (l :: Symbol) -> (v :: *) -> ElField (l ::: v) infix 8 Source #
Operator for creating an ElField
. With the -XOverloadedLabels
extension, this permits usage such as, #foo =: 23
to produce a
value of type ElField ("foo" ::: Int)
.
rgetf :: forall l f v record us. (HasField record l us us v v, RecElemFCtx record f) => Label l -> record f us -> f (l ::: v) Source #
Get a named field from a record.
rvalf :: (HasField record l us us v v, RecElemFCtx record ElField) => Label l -> record ElField us -> v Source #
Get the value associated with a named field from a record.
rputf' :: forall l v v' record us us'. (HasField record l us us' v v', KnownSymbol l, RecElemFCtx record ElField) => Label l -> v' -> record ElField us -> record ElField us' Source #
Set a named field. rputf' #foo 23
sets the field named #foo
to
23
.
rputf :: forall l v record us. (HasField record l us us v v, KnownSymbol l, RecElemFCtx record ElField) => Label l -> v -> record ElField us -> record ElField us Source #
Set a named field without changing its type. rputf #foo 23
sets
the field named #foo
to 23
.
rlensfL' :: forall l v v' record g f us us'. (Functor g, HasField record l us us' v v', RecElemFCtx record f) => Label l -> (f (l ::: v) -> g (f (l ::: v'))) -> record f us -> g (record f us') Source #
rlensfL :: forall l v record g f us. (Functor g, HasField record l us us v v, RecElemFCtx record f) => Label l -> (f (l ::: v) -> g (f (l ::: v))) -> record f us -> g (record f us) Source #
rlensf' :: forall l v v' record g us us'. (Functor g, HasField record l us us' v v', RecElemFCtx record ElField) => Label l -> (v -> g v') -> record ElField us -> g (record ElField us') Source #
rlensf :: forall l v record g us. (Functor g, HasField record l us us v v, RecElemFCtx record ElField) => Label l -> (v -> g v) -> record ElField us -> g (record ElField us) Source #
(=:=) :: KnownSymbol s => Label (s :: Symbol) -> a -> FieldRec '['(s, a)] Source #
Shorthand for a FieldRec
with a single field.
data SField (field :: k) Source #
A proxy for field types.
type HasField record l fs fs' v v' = (RecElem record (l ::: v) (l ::: v') fs fs' (RIndex (l ::: v) fs), FieldType l fs ~ v, FieldType l fs' ~ v') Source #
Constraint that a label is associated with a particular type in a record.
data Label (a :: Symbol) Source #
Proxy for label type
class (KnownSymbol (Fst a), a ~ '(Fst a, Snd a)) => KnownField a Source #
Instances
KnownSymbol l => KnownField (l ::: v :: (Symbol, k)) Source # | |
Defined in Data.Vinyl.Derived |
type AllFields fs = (RPureConstrained KnownField fs, RecApplicative fs, RApply fs) Source #
type family Unlabeled ts where ... Source #
Remove the first component (e.g. the label) from a type-level list of pairs.
class StripFieldNames ts where Source #
Facilities for removing and replacing the type-level label, or column name, part of a record.
stripNames :: Rec ElField ts -> Rec Identity (Unlabeled ts) Source #
stripNames' :: Functor f => Rec (f :. ElField) ts -> Rec f (Unlabeled ts) Source #
withNames :: Rec Identity (Unlabeled ts) -> Rec ElField ts Source #
withNames' :: Functor f => Rec f (Unlabeled ts) -> Rec (f :. ElField) ts Source #
Instances
(<<$$>>) :: AllFields fs => (forall a. KnownField a => f a -> g a) -> Rec f fs -> Rec g fs Source #
Operator synonym for rmapf
.