Safe Haskell | None |
---|---|
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.
Synopsis
- defaultImportedModules :: [ModuleImport]
- generateModuleImports :: [ModuleImport] -> Text
- inferType :: Text -> [Value] -> DeclaredType
- type CodeFragment = Text
- type TypeName = Text
- data DeclaredType = DeclaredType {
- typeCodeFragment :: CodeFragment
- typeName :: TypeName
- typeImportedModules :: [ImportedModule]
- typePackages :: [PackageName]
Documentation
defaultImportedModules :: [ModuleImport] Source #
List of modules imported for Autotyped declarations
generateModuleImports :: [ModuleImport] -> Text Source #
inferType :: Text -> [Value] -> DeclaredType 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.
type CodeFragment = Text Source #
data DeclaredType Source #
Type declaration and its requirements Content to embed in an autogenerated module: * name of the type to reference * declarations to describe it * module imports necessary for declarations to work
DeclaredType | |
|
Instances
Eq DeclaredType Source # | |
Defined in Data.Aeson.AutoType.Nested (==) :: DeclaredType -> DeclaredType -> Bool # (/=) :: DeclaredType -> DeclaredType -> Bool # | |
Show DeclaredType Source # | |
Defined in Data.Aeson.AutoType.Nested showsPrec :: Int -> DeclaredType -> ShowS # show :: DeclaredType -> String # showList :: [DeclaredType] -> ShowS # | |
Generic DeclaredType Source # | |
Defined in Data.Aeson.AutoType.Nested type Rep DeclaredType :: Type -> Type # from :: DeclaredType -> Rep DeclaredType x # to :: Rep DeclaredType x -> DeclaredType # | |
Default DeclaredType Source # | |
Defined in Data.Aeson.AutoType.Nested def :: DeclaredType | |
type Rep DeclaredType Source # | |
Defined in Data.Aeson.AutoType.Nested |