Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Simple interface for using AutoType inference in other code generators.
Simply takes a list of Aeson values, and returns a type description.
For this type description, we can use function to generate an entire new module.
Note that while we can put more code in the module, it is recommended to avoid multiple automatically generated types in order to avoid name conflicts.
NOTE: this interface is yet unstable
Synopsis
- defaultImportedModules :: [ModuleImport]
- generateModuleImports :: [ModuleImport] -> Text
- inferType :: Text -> [Value] -> TypeFrag
- data CodeFrag a = CodeFrag {
- codeFragCode :: Code
- codeFragName :: a
- codeFragImports :: [ModuleImport]
- codeFragPackages :: [PackageName]
- type TypeName = Text
- type TypeFrag = CodeFrag TypeName
- type ModuleImport = Text
- type PackageName = Text
Documentation
defaultImportedModules :: [ModuleImport] Source #
List of modules imported for Autotyped declarations
generateModuleImports :: [ModuleImport] -> Text Source #
Given a list of imports, generate source code.
inferType :: Text -> [Value] -> TypeFrag Source #
Given intended type name, and a list of
text fields with JSON, return
either an error, or an EndpointResponse
that allows to declare and use this type
in generated module.
Generated code reference and its requirements Content to embed in an autogenerated module:
- name of the reference
- declarations to describe it
- module imports necessary for declarations to work
CodeFrag | |
|
type ModuleImport = Text Source #
Alias for indicating that this is item in module imports list.
type PackageName = Text Source #