json-autotype-3.1.1: Automatic type declaration for JSON input data
Safe HaskellNone
LanguageHaskell2010

Data.Aeson.AutoType.Nested

Description

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

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.

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

Constructors

DeclaredType 

Fields

Instances

Instances details
Eq DeclaredType Source # 
Instance details

Defined in Data.Aeson.AutoType.Nested

Show DeclaredType Source # 
Instance details

Defined in Data.Aeson.AutoType.Nested

Generic DeclaredType Source # 
Instance details

Defined in Data.Aeson.AutoType.Nested

Associated Types

type Rep DeclaredType :: Type -> Type #

Default DeclaredType Source # 
Instance details

Defined in Data.Aeson.AutoType.Nested

Methods

def :: DeclaredType

type Rep DeclaredType Source # 
Instance details

Defined in Data.Aeson.AutoType.Nested