| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
Data.Vinyl.Derived
Description
Commonly used Rec instantiations.
Synopsis
- type (:::) (a :: k) (b :: k1) = '(a, b)
- type FieldRec = Rec ElField
- type AFieldRec (ts :: [(Symbol, Type)]) = ARec ElField ts
- type HList = Rec Identity
- type LazyHList = Rec Thunk
- getField :: forall (s :: Symbol) t. ElField '(s, t) -> t
- getLabel :: forall (s :: Symbol) t. KnownSymbol s => ElField '(s, t) -> String
- fieldMap :: forall a b (s :: Symbol). (a -> b) -> ElField '(s, a) -> ElField '(s, b)
- traverseField :: forall (s :: Symbol) f a b. (KnownSymbol s, Functor f) => (a -> b) -> f (ElField '(s, a)) -> ElField '(s, f b)
- rfield :: forall f a b (s :: Symbol). Functor f => (a -> f b) -> ElField '(s, a) -> f (ElField '(s, b))
- (=:) :: forall (l :: Symbol) v. KnownSymbol l => Label l -> v -> ElField (l ::: v)
- rgetf :: forall {k} (l :: Symbol) f (v :: k) record (us :: [(Symbol, k)]). (HasField record l us us v v, RecElemFCtx record f) => Label l -> record f us -> f (l ::: v)
- rvalf :: forall record (l :: Symbol) (us :: [(Symbol, Type)]) v. (HasField record l us us v v, RecElemFCtx record ElField) => Label l -> record ElField us -> v
- rputf' :: forall (l :: Symbol) v v' record (us :: [(Symbol, Type)]) (us' :: [(Symbol, Type)]). (HasField record l us us' v v', KnownSymbol l, RecElemFCtx record ElField) => Label l -> v' -> record ElField us -> record ElField us'
- rputf :: forall (l :: Symbol) v record (us :: [(Symbol, Type)]). (HasField record l us us v v, KnownSymbol l, RecElemFCtx record ElField) => Label l -> v -> record ElField us -> record ElField us
- rlensfL' :: forall {k} (l :: Symbol) (v :: k) (v' :: k) record g f (us :: [(Symbol, k)]) (us' :: [(Symbol, k)]). (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 {k} (l :: Symbol) (v :: k) record g f (us :: [(Symbol, k)]). (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 :: Symbol) v v' record g (us :: [(Symbol, Type)]) (us' :: [(Symbol, Type)]). (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 :: Symbol) v record g (us :: [(Symbol, Type)]). (Functor g, HasField record l us us v v, RecElemFCtx record ElField) => Label l -> (v -> g v) -> record ElField us -> g (record ElField us)
- (=:=) :: forall (s :: Symbol) a. KnownSymbol s => Label s -> a -> FieldRec '['(s, a)]
- data SField (field :: k) = SField
- type family FieldType (l :: k1) (fs :: [(k1, k)]) :: k where ...
- type HasField (record :: ((k, k1) -> Type) -> [(k, k1)] -> Type) (l :: k) (fs :: [(k, k1)]) (fs' :: [(k, k1)]) (v :: k1) (v' :: k1) = (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 :: (Symbol, k))
- type AllFields (fs :: [(Symbol, k)]) = (RPureConstrained (KnownField :: (Symbol, k) -> Constraint) fs, RecApplicative fs, RApply fs)
- rmapf :: forall {k} (fs :: [(Symbol, k)]) f g. AllFields fs => (forall (a :: (Symbol, k)). KnownField a => f a -> g a) -> Rec f fs -> Rec g fs
- type family Unlabeled (ts :: [(k, a)]) :: [a] where ...
- class StripFieldNames (ts :: [(Symbol, Type)]) where
- stripNames :: Rec ElField ts -> Rec Identity (Unlabeled ts)
- stripNames' :: forall (f :: Type -> Type). Functor f => Rec (f :. ElField) ts -> Rec f (Unlabeled ts)
- withNames :: Rec Identity (Unlabeled ts) -> Rec ElField ts
- withNames' :: forall (f :: Type -> Type). Functor f => Rec f (Unlabeled ts) -> Rec (f :. ElField) ts
- rpuref :: forall {k} (fs :: [(Symbol, k)]) f. AllFields fs => (forall (a :: (Symbol, k)). KnownField a => f a) -> Rec f fs
- (<<$$>>) :: forall {k} (fs :: [(Symbol, k)]) f g. AllFields fs => (forall (a :: (Symbol, k)). KnownField a => f a -> g a) -> Rec f fs -> Rec g fs
- rlabels :: forall {k} (fs :: [(Symbol, k)]). AllFields fs => Rec (Const String :: (Symbol, k) -> Type) fs
Documentation
type AFieldRec (ts :: [(Symbol, Type)]) = 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).
getField :: forall (s :: Symbol) t. ElField '(s, t) -> t Source #
Get the data payload of an ElField.
getLabel :: forall (s :: Symbol) t. KnownSymbol s => ElField '(s, t) -> String Source #
Get the label name of an ElField.
fieldMap :: forall a b (s :: Symbol). (a -> b) -> ElField '(s, a) -> ElField '(s, b) Source #
ElField is isomorphic to a functor something like Compose
ElField ('(,) s).
traverseField :: forall (s :: Symbol) f a b. (KnownSymbol s, Functor f) => (a -> b) -> f (ElField '(s, a)) -> ElField '(s, f b) Source #
rfield :: forall f a b (s :: Symbol). Functor f => (a -> f b) -> ElField '(s, a) -> f (ElField '(s, b)) Source #
Lens for an ElField's data payload.
(=:) :: forall (l :: Symbol) v. KnownSymbol l => Label l -> 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 {k} (l :: Symbol) f (v :: k) record (us :: [(Symbol, k)]). (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 :: forall record (l :: Symbol) (us :: [(Symbol, Type)]) v. (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 :: Symbol) v v' record (us :: [(Symbol, Type)]) (us' :: [(Symbol, Type)]). (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 :: Symbol) v record (us :: [(Symbol, Type)]). (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 {k} (l :: Symbol) (v :: k) (v' :: k) record g f (us :: [(Symbol, k)]) (us' :: [(Symbol, k)]). (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 {k} (l :: Symbol) (v :: k) record g f (us :: [(Symbol, k)]). (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 :: Symbol) v v' record g (us :: [(Symbol, Type)]) (us' :: [(Symbol, Type)]). (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 :: Symbol) v record g (us :: [(Symbol, Type)]). (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 #
(=:=) :: forall (s :: Symbol) a. KnownSymbol s => Label s -> a -> FieldRec '['(s, a)] Source #
Shorthand for a FieldRec with a single field.
data SField (field :: k) Source #
A proxy for field types.
Constructors
| SField |
type HasField (record :: ((k, k1) -> Type) -> [(k, k1)] -> Type) (l :: k) (fs :: [(k, k1)]) (fs' :: [(k, k1)]) (v :: k1) (v' :: k1) = (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
Constructors
| Label |
class (KnownSymbol (Fst a), a ~ '(Fst a, Snd a)) => KnownField (a :: (Symbol, k)) Source #
Instances
| KnownSymbol l => KnownField (l ::: v :: (Symbol, k)) Source # | |
Defined in Data.Vinyl.Derived | |
type AllFields (fs :: [(Symbol, k)]) = (RPureConstrained (KnownField :: (Symbol, k) -> Constraint) fs, RecApplicative fs, RApply fs) Source #
rmapf :: forall {k} (fs :: [(Symbol, k)]) f g. AllFields fs => (forall (a :: (Symbol, k)). KnownField a => f a -> g a) -> Rec f fs -> Rec g fs Source #
type family Unlabeled (ts :: [(k, a)]) :: [a] where ... Source #
Remove the first component (e.g. the label) from a type-level list of pairs.
class StripFieldNames (ts :: [(Symbol, Type)]) where Source #
Facilities for removing and replacing the type-level label, or column name, part of a record.
Methods
stripNames :: Rec ElField ts -> Rec Identity (Unlabeled ts) Source #
stripNames' :: forall (f :: Type -> Type). Functor f => Rec (f :. ElField) ts -> Rec f (Unlabeled ts) Source #
withNames :: Rec Identity (Unlabeled ts) -> Rec ElField ts Source #
withNames' :: forall (f :: Type -> Type). Functor f => Rec f (Unlabeled ts) -> Rec (f :. ElField) ts Source #
Instances
rpuref :: forall {k} (fs :: [(Symbol, k)]) f. AllFields fs => (forall (a :: (Symbol, k)). KnownField a => f a) -> Rec f fs Source #
(<<$$>>) :: forall {k} (fs :: [(Symbol, k)]) f g. AllFields fs => (forall (a :: (Symbol, k)). KnownField a => f a -> g a) -> Rec f fs -> Rec g fs Source #
Operator synonym for rmapf.
rlabels :: forall {k} (fs :: [(Symbol, k)]). AllFields fs => Rec (Const String :: (Symbol, k) -> Type) fs Source #