Safe Haskell | None |
---|---|
Language | Haskell2010 |
Data.Schematic.Lens
- 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)
- arr :: SingI schema => Iso' (JsonRepr (SchemaArray cs schema)) (Vector (JsonRepr schema))
- uni :: SingI (h ': tl) => Iso' (JsonRepr (SchemaUnion (h ': tl))) (Union JsonRepr (h ': tl))
- txt :: SingI cs => Iso' (JsonRepr (SchemaText cs)) Text
- num :: SingI cs => Iso' (JsonRepr (SchemaNumber cs)) Scientific
- opt :: SingI schema => Iso' (JsonRepr (SchemaOptional schema)) (Maybe (JsonRepr schema))
- bln :: Iso' (JsonRepr SchemaBoolean) Bool
- 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 ... #
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 #
Methods
For Vinyl users who are not using the lens
package, we provide a getter.
fput :: f '(fn, ByField fn rs i) -> Rec f rs -> Rec f rs #
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 ... #
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 #
Minimal complete definition
Methods
fsubset :: Functor g => (Rec f rs -> g (Rec f rs)) -> Rec f ss -> g (Rec f ss) #
This is a lens into a slice of the larger record. Morally, we have:
fsubset :: Lens' (Rec FieldRepr ss) (Rec FieldRepr rs)
num :: SingI cs => Iso' (JsonRepr (SchemaNumber cs)) Scientific #
bln :: Iso' (JsonRepr SchemaBoolean) Bool #
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)) #