harrysarson/elm-decode-elmi/1.0.0

Ast.Canonical

type Alias
= Alias (List String) Type

A type alias.

= Holey Type
| Filled Type

An type alias can either be holey or filled.

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

= Annotation (Set String) Type

An elm type annotation.

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

= FieldType Int Type

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

type Type
= TLambda Type Type
| TVar String
| TType Name String (List Type)
| TRecord (Dict String FieldType) (Maybe String)
| TUnit
| TTuple Type Type (Maybe Type)
| TAlias 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.

= UnionCtor String Int Int (List Type)

A contructor for a custom type alternative.

TODO: document the meaning of each arg.

Note: some of these ints are redundant.