Safe Haskell | None |
---|---|
Language | Haskell2010 |
- type family FIndex (r :: Symbol) (rs :: [(Symbol, Schema)]) :: Nat where ...
- class i ~ FIndex fn rs => FElem (fn :: Symbol) (rs :: [(Symbol, Schema)]) (i :: Nat) where
- type family FImage (rs :: [(Symbol, Schema)]) (ss :: [(Symbol, Schema)]) :: [Nat] where ...
- class is ~ FImage rs ss => FSubset (rs :: [(Symbol, Schema)]) (ss :: [(Symbol, Schema)]) is where
- obj :: SingI fields => Iso' (JsonRepr (SchemaObject fields)) (Rec FieldRepr fields)
- textRepr :: (KnownSymbol fn, SingI fn, SingI cs) => Iso' (FieldRepr '(fn, SchemaText cs)) Text
- numberRepr :: (KnownSymbol fn, SingI fn, SingI cs) => Iso' (FieldRepr '(fn, SchemaNumber cs)) Scientific
- boolRepr :: (KnownSymbol fn, SingI fn, SingI cs) => Iso' (FieldRepr '(fn, SchemaBoolean)) Bool
- arrayRepr :: (KnownSymbol fn, SingI fn, SingI cs, SingI schema) => Iso' (FieldRepr '(fn, SchemaArray cs schema)) (Vector (JsonRepr schema))
- objectRepr :: (KnownSymbol fn, SingI fn, SingI fields) => Iso' (FieldRepr '(fn, SchemaObject fields)) (Rec FieldRepr fields)
- optionalRepr :: (KnownSymbol fn, SingI fn, SingI schema) => Iso' (FieldRepr '(fn, SchemaOptional schema)) (Maybe (JsonRepr schema))
Documentation
type family FIndex (r :: Symbol) (rs :: [(Symbol, Schema)]) :: Nat where ... Source #
A partial relation that gives the index of a value in a list.
class i ~ FIndex fn rs => FElem (fn :: Symbol) (rs :: [(Symbol, Schema)]) (i :: Nat) where Source #
flens :: Functor g => proxy fn -> (FieldRepr '(fn, ByField fn rs i) -> g (FieldRepr '(fn, ByField fn rs i))) -> Rec FieldRepr rs -> g (Rec FieldRepr rs) Source #
fget :: proxy fn -> Rec FieldRepr rs -> FieldRepr '(fn, ByField fn rs i) Source #
For Vinyl users who are not using the lens
package, we provide a getter.
fput :: FieldRepr '(fn, ByField fn rs i) -> Rec FieldRepr rs -> Rec FieldRepr rs Source #
For Vinyl users who are not using the lens
package, we also provide a
setter. In general, it will be unambiguous what field is being written to,
and so we do not take a proxy argument here.
type family FImage (rs :: [(Symbol, Schema)]) (ss :: [(Symbol, Schema)]) :: [Nat] where ... Source #
A partial relation that gives the indices of a sublist in a larger list.
class is ~ FImage rs ss => FSubset (rs :: [(Symbol, Schema)]) (ss :: [(Symbol, Schema)]) is where Source #
fsubset :: Functor g => (Rec FieldRepr rs -> g (Rec FieldRepr rs)) -> Rec FieldRepr ss -> g (Rec FieldRepr ss) Source #
This is a lens into a slice of the larger record. Morally, we have:
fsubset :: Lens' (Rec FieldRepr ss) (Rec FieldRepr rs)
fcast :: Rec FieldRepr ss -> Rec FieldRepr rs Source #
The getter of the fsubset
lens is fcast
, which takes a larger record
to a smaller one by forgetting fields.
freplace :: Rec FieldRepr rs -> Rec FieldRepr ss -> Rec FieldRepr ss Source #
textRepr :: (KnownSymbol fn, SingI fn, SingI cs) => Iso' (FieldRepr '(fn, SchemaText cs)) Text Source #
numberRepr :: (KnownSymbol fn, SingI fn, SingI cs) => Iso' (FieldRepr '(fn, SchemaNumber cs)) Scientific Source #
boolRepr :: (KnownSymbol fn, SingI fn, SingI cs) => Iso' (FieldRepr '(fn, SchemaBoolean)) Bool Source #
arrayRepr :: (KnownSymbol fn, SingI fn, SingI cs, SingI schema) => Iso' (FieldRepr '(fn, SchemaArray cs schema)) (Vector (JsonRepr schema)) Source #
objectRepr :: (KnownSymbol fn, SingI fn, SingI fields) => Iso' (FieldRepr '(fn, SchemaObject fields)) (Rec FieldRepr fields) Source #
optionalRepr :: (KnownSymbol fn, SingI fn, SingI schema) => Iso' (FieldRepr '(fn, SchemaOptional schema)) (Maybe (JsonRepr schema)) Source #