fields-and-cases-0.2.0.0: Codegen Haskell types to other languages
Safe HaskellSafe-Inferred
LanguageHaskell2010

FieldsAndCases

Description

Code generate type definitions in any language based on Haskell types.

Synopsis

Documentation

matchRecordLikeDataType :: TypeDef texpr -> Maybe (Text, [Field texpr]) Source #

Data types with a single constructor and labeled fields | are considered record-like.

isEnumWithoutData :: TypeDef texpr -> Bool Source #

Data types with all of their constructors having no arguments

class ToTypeDefs (xs :: [Type]) texpr where Source #

Like ToTypeDef but for a list of types.

Methods

toTypeDefs :: [TypeDef texpr] Source #

Instances

Instances details
ToTypeDefs ('[] :: [Type]) texpr Source # 
Instance details

Defined in FieldsAndCases

Methods

toTypeDefs :: [TypeDef texpr] Source #

(ToTypeDef x texpr, ToTypeDefs xs texpr) => ToTypeDefs (x ': xs) texpr Source # 
Instance details

Defined in FieldsAndCases

Methods

toTypeDefs :: [TypeDef texpr] Source #

class ToTypeDef a texpr where Source #

Get the type definition of a type.

Methods

toTypeDef :: TypeDef texpr Source #

Instances

Instances details
(Generic a, GToTypeDef (Rep a) (TypeDef texpr)) => ToTypeDef (a :: Type) texpr Source # 
Instance details

Defined in FieldsAndCases

Methods

toTypeDef :: TypeDef texpr Source #

class IsTypeExpr texpr where Source #

A class of types which can be used as type expressions.

Methods

typeRef :: QualifiedName -> texpr Source #

Instances

Instances details
IsTypeExpr Text Source # 
Instance details

Defined in FieldsAndCases

class TypeExpr a texpr where Source #

Describes how to convert a type to a type expression of a specific language.

Minimal complete definition

Nothing

Methods

typeExpr :: texpr Source #

default typeExpr :: (IsTypeExpr texpr, Generic a, GToTypeRef (Rep a)) => texpr Source #

data TypeDef texpr Source #

Haskell type definition.

Constructors

TypeDef 

Fields

Instances

Instances details
Show texpr => Show (TypeDef texpr) Source # 
Instance details

Defined in FieldsAndCases

Methods

showsPrec :: Int -> TypeDef texpr -> ShowS #

show :: TypeDef texpr -> String #

showList :: [TypeDef texpr] -> ShowS #

Eq texpr => Eq (TypeDef texpr) Source # 
Instance details

Defined in FieldsAndCases

Methods

(==) :: TypeDef texpr -> TypeDef texpr -> Bool #

(/=) :: TypeDef texpr -> TypeDef texpr -> Bool #

data Case texpr Source #

Haskell type constructor.

Constructors

Case 

Fields

Instances

Instances details
Show texpr => Show (Case texpr) Source # 
Instance details

Defined in FieldsAndCases

Methods

showsPrec :: Int -> Case texpr -> ShowS #

show :: Case texpr -> String #

showList :: [Case texpr] -> ShowS #

Eq texpr => Eq (Case texpr) Source # 
Instance details

Defined in FieldsAndCases

Methods

(==) :: Case texpr -> Case texpr -> Bool #

(/=) :: Case texpr -> Case texpr -> Bool #

data CaseArgs texpr Source #

Haskell type constructor arguments.

Constructors

CasePositionalArgs [PositionalArg texpr] 
CaseFields [Field texpr] 

Instances

Instances details
Show texpr => Show (CaseArgs texpr) Source # 
Instance details

Defined in FieldsAndCases

Methods

showsPrec :: Int -> CaseArgs texpr -> ShowS #

show :: CaseArgs texpr -> String #

showList :: [CaseArgs texpr] -> ShowS #

Eq texpr => Eq (CaseArgs texpr) Source # 
Instance details

Defined in FieldsAndCases

Methods

(==) :: CaseArgs texpr -> CaseArgs texpr -> Bool #

(/=) :: CaseArgs texpr -> CaseArgs texpr -> Bool #

data Field texpr Source #

Haskell type labeled field.

Constructors

Field 

Fields

Instances

Instances details
Show texpr => Show (Field texpr) Source # 
Instance details

Defined in FieldsAndCases

Methods

showsPrec :: Int -> Field texpr -> ShowS #

show :: Field texpr -> String #

showList :: [Field texpr] -> ShowS #

Eq texpr => Eq (Field texpr) Source # 
Instance details

Defined in FieldsAndCases

Methods

(==) :: Field texpr -> Field texpr -> Bool #

(/=) :: Field texpr -> Field texpr -> Bool #

newtype PositionalArg texpr Source #

Haskell type positional field.

Constructors

PositionalArg 

Fields

Instances

Instances details
Show texpr => Show (PositionalArg texpr) Source # 
Instance details

Defined in FieldsAndCases

Methods

showsPrec :: Int -> PositionalArg texpr -> ShowS #

show :: PositionalArg texpr -> String #

showList :: [PositionalArg texpr] -> ShowS #

Eq texpr => Eq (PositionalArg texpr) Source # 
Instance details

Defined in FieldsAndCases

Methods

(==) :: PositionalArg texpr -> PositionalArg texpr -> Bool #

(/=) :: PositionalArg texpr -> PositionalArg texpr -> Bool #

data QualifiedName Source #

Haskell type qualified name.

Constructors

QualifiedName 

Fields

Instances

Instances details
Show QualifiedName Source # 
Instance details

Defined in FieldsAndCases

Eq QualifiedName Source # 
Instance details

Defined in FieldsAndCases