Safe Haskell | None |
---|---|
Language | Haskell2010 |
Consume a Schema
and emit types intended for code generation.
- emitSchema :: Schema -> Emit ()
- emitElement :: Element -> Emit Type
- emitSimpleType :: SimpleType -> Emit Type
- emitComplexType :: Maybe QN -> ComplexType -> Emit Type
- emitCompositor :: [QN] -> Compositor -> Emit [Field]
- emitGroup :: [QN] -> Group -> Emit [Field]
- emitChoice :: [QN] -> Choice -> Maybe Documentation -> Emit [Field]
- emitSequence :: [QN] -> Maybe Occurs -> Sequence -> Maybe Documentation -> Emit [Field]
- emitParticle :: [QN] -> Particle -> Emit [Field]
- emitAttrFields :: Attributes -> Emit [Field]
- type Emit a = ReaderT Env (StateT EmitState IO) a
- data Env = Env {}
- schema :: Iso' Env Schema
- data EmitState = EmitState {}
- types :: Lens' EmitState (Map Name Type)
- stack :: Lens' EmitState [Name]
- runEmit :: Env -> EmitState -> Emit a -> IO (a, EmitState)
- die :: MonadIO m => String -> m a
- data Name = Name {}
- data Namespace
- data Cardinality
- data Field = Field {}
- fieldName :: Lens' Field QN
- fieldType :: Lens' Field Type
- fieldCardinality :: Lens' Field Cardinality
- fieldXmlEmit :: Lens' Field FieldEmit
- fieldIdx :: Lens' Field Int
- data FieldEmit
- data Ctor = Ctor {
- _ctorName :: String
- _ctorFields :: [Field]
- ctorName :: Lens' Ctor String
- ctorFields :: Lens' Ctor [Field]
- data Type
- = NewType {
- _typeName :: Name
- _typeType :: Type
- _typeDerives :: DerivesFamily
- _typeImpls :: [Impl]
- _typeDoc :: Maybe Documentation
- | DataType {
- _typeName :: Name
- _typeCtors :: [Ctor]
- _typeDerives :: DerivesFamily
- _typeImpls :: [Impl]
- _typeEmit :: DataTypeEmit
- _typeDoc :: Maybe Documentation
- | EnumType {
- _typeName :: Name
- _typeEnumValues :: [String]
- _typeDerives :: DerivesFamily
- _typeImpls :: [Impl]
- _typeDoc :: Maybe Documentation
- | BuiltIn {
- _typeName :: Name
- _coreType :: CoreType
- _typeDerives :: DerivesFamily
- _typeImpls :: [Impl]
- = NewType {
- typeName :: Lens' Type Name
- typeType :: Traversal' Type Type
- typeDerives :: Lens' Type DerivesFamily
- typeImpls :: Lens' Type [Impl]
- typeEmit :: Traversal' Type DataTypeEmit
- typeCtors :: Traversal' Type [Ctor]
- typeEnumValues :: Traversal' Type [String]
- coreType :: Traversal' Type CoreType
- data DerivesFamily
- data DataTypeEmit
- data CoreType
- data Impl
XSD Schema to types
emitSchema :: Schema -> Emit () Source #
Emit schema types. Starts with element productions and emits all dependent types.
Emit various productions
emitElement :: Element -> Emit Type Source #
Emit type for element content; element name production captured in containing field.
emitSimpleType :: SimpleType -> Emit Type Source #
Handle simpleType production.
emitComplexType :: Maybe QN -> ComplexType -> Emit Type Source #
Complex type. anon
arg indicates element-defined complex type, therefore unique;
otherwise defined type.
emitCompositor :: [QN] -> Compositor -> Emit [Field] Source #
Emit compositor field.
emitGroup :: [QN] -> Group -> Emit [Field] Source #
Emit group. Referenced groups make types, others pass through.
emitChoice :: [QN] -> Choice -> Maybe Documentation -> Emit [Field] Source #
Choice production.
emitSequence :: [QN] -> Maybe Occurs -> Sequence -> Maybe Documentation -> Emit [Field] Source #
Sequence production.
emitParticle :: [QN] -> Particle -> Emit [Field] Source #
Particle field production. Element fields emit containing element.
emitAttrFields :: Attributes -> Emit [Field] Source #
Handle attribute and attribute group productions as fields.
Emit monad
State data.
Types
Type name.
Namespaces for various productions.
data Cardinality Source #
Field cardinality
Type field.
Field | |
|
Field xml emit cue.
Datatype constructor.
Ctor | |
|
Emitted type.
NewType | |
| |
DataType | |
| |
EnumType | |
| |
BuiltIn | |
|
data DerivesFamily Source #
Derive type "families".
data DataTypeEmit Source #
Data type xml emit cue.
newtype base types. Name after CT should be Haskell base type.
Impls of classes, but also grab-bag of type deets.