Safe Haskell | None |
---|---|
Language | Haskell2010 |
Mu.Schema.Registry
Description
A registry of schemas saves the different schemas supported by an application. Since messages and protocols may evolve, it's useful to keep an updated view of the different shapes of data we can handle.
Examples of registries are found in Kafka and Compendium.
Synopsis
- type Registry = Mappings Nat Schema'
- fromRegistry :: forall r t. FromRegistry r t => Term -> Maybe t
- data Term where
- data Field where
- Field :: Text -> FieldValue -> Field
- data FieldValue where
- FNull :: FieldValue
- FPrimitive :: (Typeable t, Eq t, Ord t, Show t) => t -> FieldValue
- FSchematic :: Term -> FieldValue
- FOption :: Maybe FieldValue -> FieldValue
- FList :: [FieldValue] -> FieldValue
- FMap :: Map FieldValue FieldValue -> FieldValue
Registry of schemas
fromRegistry :: forall r t. FromRegistry r t => Term -> Maybe t Source #
Terms without an associated schema
Interpretation of a type in a schema.
Constructors
TRecord :: [Field] -> Term | A record given by the value of its fields. |
TEnum :: Int -> Term | An enumeration given by one choice. |
TSimple :: FieldValue -> Term | A primitive value. |
Interpretation of a field.
Constructors
Field :: Text -> FieldValue -> Field | A single field given by its name and its value. |
data FieldValue where Source #
Interpretation of a field type, by giving a value of that type.
Constructors
FNull :: FieldValue | |
FPrimitive :: (Typeable t, Eq t, Ord t, Show t) => t -> FieldValue | |
FSchematic :: Term -> FieldValue | |
FOption :: Maybe FieldValue -> FieldValue | |
FList :: [FieldValue] -> FieldValue | |
FMap :: Map FieldValue FieldValue -> FieldValue |
Instances
Eq FieldValue Source # | |
Defined in Mu.Schema.Interpretation.Schemaless | |
Ord FieldValue Source # | |
Defined in Mu.Schema.Interpretation.Schemaless Methods compare :: FieldValue -> FieldValue -> Ordering # (<) :: FieldValue -> FieldValue -> Bool # (<=) :: FieldValue -> FieldValue -> Bool # (>) :: FieldValue -> FieldValue -> Bool # (>=) :: FieldValue -> FieldValue -> Bool # max :: FieldValue -> FieldValue -> FieldValue # min :: FieldValue -> FieldValue -> FieldValue # | |
Show FieldValue Source # | |
Defined in Mu.Schema.Interpretation.Schemaless Methods showsPrec :: Int -> FieldValue -> ShowS # show :: FieldValue -> String # showList :: [FieldValue] -> ShowS # |