harrysarson / elm-decode-elmi / Ast.Canonical


type Alias
    = Alias (List String) Type

A type alias.


type AliasType
    = Holey Type
    | Filled Type

An type alias can either be holey or filled.

I believe that holey type aliases are those with generic parameters.


type Annotation
    = Annotation (Set String) Type

An elm type annotation.

The set of strings are the free type variables that the annotation contains.


type FieldType
    = FieldType Basics.Int Type

A field in an elm record with an index and a type.


type Type
    = TLambda Type Type
    | TVar String
    | TType ElmFile.Module.Name String (List Type)
    | TRecord (Dict String FieldType) (Maybe String)
    | TUnit
    | TTuple Type Type (Maybe Type)
    | TAlias ElmFile.Module.Name String (List ( String, Type )) AliasType

A type definition or alias in elm.


type Union
    = Union ({ vars : List String, alts : List UnionCtor })

An elm custom type.

This record stores the type variables in vars and the "options that you would write a case statement for" in alts.

Note: the binary data also includes the number of alternatives and some optimation information - this is all currently discarded.


type UnionCtor
    = UnionCtor String Basics.Int Basics.Int (List Type)

A contructor for a custom type alternative.

TODO: document the meaning of each arg.

Note: some of these ints are redundant.