the-sett / salix / Elm.Lang

Elm code generation from L2 models. This can be used when writing a code generator that outputs Elm code. It can be used to generate type declarations and type annotations for Elm data models.

Type declarations:

typeDecl : String -> Elm.CodeGen.Comment Elm.CodeGen.DocComment -> L1.Declarable pos L2.RefChecked -> ( List Elm.CodeGen.Declaration, Elm.CodeGen.Linkage )

Turns an L1 type declaration into Elm code.

A type can result in a list of declarations - enums in addition to declaring a type can also declare the permitted enum values.

lowerType : L1.Type pos L2.RefChecked -> ( Elm.CodeGen.TypeAnnotation, Elm.CodeGen.Linkage )

Lowers an L1 type into an Elm type annotation.

lowerFun : L1.Type pos L2.RefChecked -> L1.Type pos L2.RefChecked -> ( Elm.CodeGen.TypeAnnotation, Elm.CodeGen.Linkage )

Lowers an L1 function type into an Elm type annotation