Safe Haskell | None |
---|---|
Language | Haskell2010 |
Data.Schematic.Schema
- type family CRepr (s :: Schema) :: Type where ...
- data TextConstraint
- data DemotedTextConstraint
- data NumberConstraint
- data DemotedNumberConstraint
- data ArrayConstraint = AEq Nat
- data DemotedArrayConstraint = DAEq Integer
- data Schema
- data DemotedSchema
- data FieldRepr :: (Symbol, Schema) -> Type where
- FieldRepr :: (SingI schema, KnownSymbol name) => JsonRepr schema -> FieldRepr '(name, schema)
- toJsonRepr :: FieldRepr '(fn, sch) -> JsonRepr sch
- knownFieldName :: forall proxy (fieldName :: Symbol) schema. KnownSymbol fieldName => proxy '(fieldName, schema) -> Text
- knownFieldSchema :: forall proxy fieldName schema. SingI schema => proxy '(fieldName, schema) -> Sing schema
- type family USubsets (u :: [k]) :: Constraint where ...
- data JsonRepr :: Schema -> Type where
- ReprText :: Text -> JsonRepr (SchemaText cs)
- ReprNumber :: Scientific -> JsonRepr (SchemaNumber cs)
- ReprBoolean :: Bool -> JsonRepr SchemaBoolean
- ReprNull :: JsonRepr SchemaNull
- ReprArray :: Vector (JsonRepr s) -> JsonRepr (SchemaArray cs s)
- ReprObject :: Rec FieldRepr fs -> JsonRepr (SchemaObject fs)
- ReprOptional :: Maybe (JsonRepr s) -> JsonRepr (SchemaOptional s)
- ReprUnion :: Union JsonRepr (h ': tl) -> JsonRepr (SchemaUnion (h ': tl))
- fromOptional :: SingI s => Sing (SchemaOptional s) -> Value -> Parser (Maybe (JsonRepr s))
- parseUnion :: FromJSON (JsonRepr (SchemaUnion ss)) => sing (ss :: [Schema]) -> Value -> Parser (JsonRepr (SchemaUnion ss))
- class FalseConstraint a
- type family TopLevel (schema :: Schema) :: Constraint where ...
Documentation
type family CRepr (s :: Schema) :: Type where ... Source #
Equations
CRepr (SchemaText cs) = TextConstraint | |
CRepr (SchemaNumber cs) = NumberConstraint | |
CRepr (SchemaObject fs) = (String, Schema) | |
CRepr (SchemaArray ar s) = ArrayConstraint |
data TextConstraint Source #
Instances
Generic TextConstraint Source # | |
SingKind TextConstraint Source # | |
KnownNat n => SingI TextConstraint (TEq n) Source # | |
KnownNat n => SingI TextConstraint (TLt n) Source # | |
KnownNat n => SingI TextConstraint (TLe n) Source # | |
KnownNat n => SingI TextConstraint (TGt n) Source # | |
KnownNat n => SingI TextConstraint (TGe n) Source # | |
(KnownSymbol s, SingI Symbol s) => SingI TextConstraint (TRegex s) Source # | |
SingI [Symbol] ss => SingI TextConstraint (TEnum ss) Source # | |
Eq (Sing TextConstraint (TEq n)) Source # | |
Eq (Sing TextConstraint (TLt n)) Source # | |
Eq (Sing TextConstraint (TLe n)) Source # | |
Eq (Sing TextConstraint (TGt n)) Source # | |
Eq (Sing TextConstraint (TGe n)) Source # | |
Eq (Sing TextConstraint (TRegex t)) Source # | |
Eq (Sing TextConstraint (TEnum ss)) Source # | |
type Rep TextConstraint Source # | |
data Sing TextConstraint Source # | |
type Demote TextConstraint Source # | |
data DemotedTextConstraint Source #
Constructors
DTEq Integer | |
DTLt Integer | |
DTLe Integer | |
DTGt Integer | |
DTGe Integer | |
DTRegex Text | |
DTEnum [Text] |
Instances
data NumberConstraint Source #
Instances
Generic NumberConstraint Source # | |
SingKind NumberConstraint Source # | |
KnownNat n => SingI NumberConstraint (NLe n) Source # | |
KnownNat n => SingI NumberConstraint (NLt n) Source # | |
KnownNat n => SingI NumberConstraint (NGt n) Source # | |
KnownNat n => SingI NumberConstraint (NGe n) Source # | |
KnownNat n => SingI NumberConstraint (NEq n) Source # | |
Eq (Sing NumberConstraint (NLe n)) Source # | |
Eq (Sing NumberConstraint (NLt n)) Source # | |
Eq (Sing NumberConstraint (NGt n)) Source # | |
Eq (Sing NumberConstraint (NGe n)) Source # | |
Eq (Sing NumberConstraint (NEq n)) Source # | |
type Rep NumberConstraint Source # | |
data Sing NumberConstraint Source # | |
type Demote NumberConstraint Source # | |
data DemotedNumberConstraint Source #
Instances
data ArrayConstraint Source #
Instances
Generic ArrayConstraint Source # | |
SingKind ArrayConstraint Source # | |
KnownNat n => SingI ArrayConstraint (AEq n) Source # | |
Eq (Sing ArrayConstraint (AEq n)) Source # | |
type Rep ArrayConstraint Source # | |
data Sing ArrayConstraint Source # | |
type Demote ArrayConstraint Source # | |
data DemotedArrayConstraint Source #
Instances
Constructors
SchemaText [TextConstraint] | |
SchemaBoolean | |
SchemaNumber [NumberConstraint] | |
SchemaObject [(Symbol, Schema)] | |
SchemaArray [ArrayConstraint] Schema | |
SchemaNull | |
SchemaOptional Schema | |
SchemaUnion [Schema] |
Instances
data DemotedSchema Source #
Constructors
Instances
data FieldRepr :: (Symbol, Schema) -> Type where Source #
Constructors
FieldRepr :: (SingI schema, KnownSymbol name) => JsonRepr schema -> FieldRepr '(name, schema) |
Instances
toJsonRepr :: FieldRepr '(fn, sch) -> JsonRepr sch Source #
Forgetful Functor Ufr
knownFieldName :: forall proxy (fieldName :: Symbol) schema. KnownSymbol fieldName => proxy '(fieldName, schema) -> Text Source #
knownFieldSchema :: forall proxy fieldName schema. SingI schema => proxy '(fieldName, schema) -> Sing schema Source #
type family USubsets (u :: [k]) :: Constraint where ... Source #
data JsonRepr :: Schema -> Type where Source #
Constructors
ReprText :: Text -> JsonRepr (SchemaText cs) | |
ReprNumber :: Scientific -> JsonRepr (SchemaNumber cs) | |
ReprBoolean :: Bool -> JsonRepr SchemaBoolean | |
ReprNull :: JsonRepr SchemaNull | |
ReprArray :: Vector (JsonRepr s) -> JsonRepr (SchemaArray cs s) | |
ReprObject :: Rec FieldRepr fs -> JsonRepr (SchemaObject fs) | |
ReprOptional :: Maybe (JsonRepr s) -> JsonRepr (SchemaOptional s) | |
ReprUnion :: Union JsonRepr (h ': tl) -> JsonRepr (SchemaUnion (h ': tl)) |
Instances
fromOptional :: SingI s => Sing (SchemaOptional s) -> Value -> Parser (Maybe (JsonRepr s)) Source #
parseUnion :: FromJSON (JsonRepr (SchemaUnion ss)) => sing (ss :: [Schema]) -> Value -> Parser (JsonRepr (SchemaUnion ss)) Source #
class FalseConstraint a Source #
type family TopLevel (schema :: Schema) :: Constraint where ... Source #
Equations
TopLevel (SchemaArray acs s) = () | |
TopLevel (SchemaObject o) = () | |
TopLevel spec = True ~ False |