aeson-generics-typescript-0.0.0.1: Generates TypeScript definitions that match Generic Aeson encodings
Safe HaskellSafe-Inferred
LanguageGHC2021

Data.Aeson.Generics.TypeScript

Synopsis

Primary generation functions

getPrintedDefinition :: forall a. TypeScriptDefinition a => Proxy a -> String Source #

Get the TypeScriptDefinition as a String

Type Classes

class FieldTypeName a where Source #

Typeclass to determine the FieldSpec from a payload's type

Instances

Instances details
FieldTypeName Text Source # 
Instance details

Defined in Data.Aeson.Generics.TypeScript

FieldTypeName UTCTime Source # 
Instance details

Defined in Data.Aeson.Generics.TypeScript

FieldTypeName String Source #

This needs to overlap so it doesn't get treated as an Array

Instance details

Defined in Data.Aeson.Generics.TypeScript

FieldTypeName Integer Source # 
Instance details

Defined in Data.Aeson.Generics.TypeScript

FieldTypeName () Source # 
Instance details

Defined in Data.Aeson.Generics.TypeScript

FieldTypeName Bool Source # 
Instance details

Defined in Data.Aeson.Generics.TypeScript

FieldTypeName Float Source # 
Instance details

Defined in Data.Aeson.Generics.TypeScript

FieldTypeName Int Source # 
Instance details

Defined in Data.Aeson.Generics.TypeScript

TypeScriptDefinition a => FieldTypeName (a :: Type) Source # 
Instance details

Defined in Data.Aeson.Generics.TypeScript

KnownSymbol s => FieldTypeName (TSGenericVar s :: Type) Source # 
Instance details

Defined in Data.Aeson.Generics.TypeScript

FieldTypeName a => FieldTypeName (Maybe a :: Type) Source # 
Instance details

Defined in Data.Aeson.Generics.TypeScript

FieldTypeName a => FieldTypeName ([a] :: Type) Source #

Lists are Arrays according to Aeson

Instance details

Defined in Data.Aeson.Generics.TypeScript

(FieldTypeName a, FieldTypeName b) => FieldTypeName (Either a b :: Type) Source # 
Instance details

Defined in Data.Aeson.Generics.TypeScript

(FieldTypeName a, FieldTypeName b) => FieldTypeName (Map a b :: Type) Source # 
Instance details

Defined in Data.Aeson.Generics.TypeScript

FieldTypeName a => FieldTypeName (Rec0 a :: k -> Type) Source #

Handle wrapped payload

Instance details

Defined in Data.Aeson.Generics.TypeScript

class TypeScriptDefinition a where Source #

This typeclass provides the ability to derive a TSType from any Generic data type

Minimal complete definition

Nothing

Methods

gen :: TSType Source #

default gen :: (TSType ~ GTypeScriptTail (Rep a), GTypeScriptDef (Rep a)) => TSType Source #

Instances

Instances details
(TypeError (('Text "No instance of TypeScriptDefinition found for: " ':<>: 'ShowType a) ':$$: 'Text "\128160 If you are seeing this for a newtype of something primitive, derive FieldTypeName instead.") :: Constraint) => TypeScriptDefinition a Source #

Custom error for missing TypeScriptDefinition's, as they can be a red herring

Instance details

Defined in Data.Aeson.Generics.TypeScript

Methods

gen :: TSType Source #

TypeScript AST data types

data FieldSpec Source #

Helper for printing fields

Constructors

FieldSpec 

data FieldType Source #

Fields can be concrete types, or generic type variables

Instances

Instances details
Semigroup FieldType Source # 
Instance details

Defined in Data.Aeson.Generics.TypeScript

Bounded FieldType Source # 
Instance details

Defined in Data.Aeson.Generics.TypeScript

Enum FieldType Source # 
Instance details

Defined in Data.Aeson.Generics.TypeScript

Show FieldType Source # 
Instance details

Defined in Data.Aeson.Generics.TypeScript

Eq FieldType Source # 
Instance details

Defined in Data.Aeson.Generics.TypeScript

Ord FieldType Source # 
Instance details

Defined in Data.Aeson.Generics.TypeScript

data IsNewtype Source #

Determine if this is a newtype and will not be wrapped

Constructors

Newtype 
Oldtype 

data TSField Source #

A field within a term constructor

Constructors

TSField 

Instances

Instances details
Show TSField Source # 
Instance details

Defined in Data.Aeson.Generics.TypeScript

Eq TSField Source # 
Instance details

Defined in Data.Aeson.Generics.TypeScript

Methods

(==) :: TSField -> TSField -> Bool #

(/=) :: TSField -> TSField -> Bool #

Ord TSField Source # 
Instance details

Defined in Data.Aeson.Generics.TypeScript

data TSGenericVar s Source #

Type level rep of a named generic type variable

Instances

Instances details
KnownSymbol s => FieldTypeName (TSGenericVar s :: Type) Source # 
Instance details

Defined in Data.Aeson.Generics.TypeScript

data TSInterface Source #

A term constructor in Haskell, most likely an interface in TypeScript

data TSType Source #

The top level TypeScript type declaration

Instances

Instances details
Show TSType Source # 
Instance details

Defined in Data.Aeson.Generics.TypeScript

Eq TSType Source # 
Instance details

Defined in Data.Aeson.Generics.TypeScript

Methods

(==) :: TSType -> TSType -> Bool #

(/=) :: TSType -> TSType -> Bool #

Ord TSType Source # 
Instance details

Defined in Data.Aeson.Generics.TypeScript

Convenience builders

concretely :: String -> FieldSpec Source #

Construct a FieldSpec assuming standard use and a concrete type variable

genericly :: String -> FieldSpec Source #

Construct a FieldSpec assuming standard use and a generic type variable