[{"name":"Checker","comment":" Implements a checker that ensures a data model is valid as a level 2\nconstruct.\n\n\n# Model checking processor.\n\n@docs processorImpl, errorCatalogue\n\n","unions":[],"aliases":[],"values":[{"name":"errorCatalogue","comment":" The error catalogue for this checker.\n","type":"Dict.Dict Basics.Int Errors.ErrorMessage"},{"name":"processorImpl","comment":" SPI for this L2 checker. Use `L2.builder` to create an `L2.Processor` out\nof this.\n","type":"L2.ProcessorImpl pos (Checker.ModelCheckingError pos)"}],"binops":[]},{"name":"Errors","comment":" Errors defines a format for describing human readable error messages,\nthat can also quote some source, in order to identify the source of an error.\n\n\n# Errors and Error Messages\n\n@docs Error, ErrorMessage\n\n\n# Instantiating Error Messages into Errors\n\n@docs ErrorBuilder, lookupError, lookupErrorNoArgs\n\n\n# Error formatting and printing\n\n@docs document, asConsoleString, htmlRenderer\n\n","unions":[],"aliases":[{"name":"Error","comment":" Common Error definition, for reporting errors to users.\n\nThis contains all the information needed to build a nice human readable error\nmessage. The body is written in `mdgriffith/elm-markup` and looks like this:\n\n    There was an error in your code.\n\n    |> Source\n        label = Look, here it is:\n        pos = 0\n\n    Please fix it. This is not a helpful error message.\n\n","args":[],"type":"{ code : Basics.Int, title : String.String, body : String.String, args : Dict.Dict String.String String.String, sources : List.List SourcePos.SourceLines }"},{"name":"ErrorBuilder","comment":" Defines the signature of a function for building Errors. This keeps the\npositional information variable, but requires a function to turn source code\npositions into quotes lines of source code.\n\nTypically implementation of this will use the `lookupError` functions and an\nerror catalogue of error messages.\n\n","args":["pos","err"],"type":"(pos -> SourcePos.SourceLines) -> err -> Errors.Error"},{"name":"ErrorMessage","comment":" Defines the content of an error message.\n\nThe body is written in `mdgriffith/elm-markup` and looks like this:\n\n    There was an error in your code.\n\n    |> Source\n        label = Look, here it is:\n        pos = 0\n\n    Please fix it. This is not a helpful error message.\n\nAn `ErrorMessage` will be combined with some lines of source code that it can\nquote, in order to produce an `Error`.\n\n","args":[],"type":"{ title : String.String, body : String.String }"}],"values":[{"name":"asConsoleString","comment":" Renders an Error as a String for printing to the console with ANSI colours.\n","type":"Errors.Error -> String.String"},{"name":"document","comment":" elm-markup Document describing the format of an error.\n","type":"Errors.Renderer content -> Errors.Error -> Mark.Document (List.List content)"},{"name":"htmlRenderer","comment":" Renders an Error as HTML.\n","type":"Errors.Renderer (Html.Styled.Html msg)"},{"name":"lookupError","comment":" Looks up an ErrorMessage in an error catalogue and fills in its quoted\nsource code and parameters to produce an Error.\n","type":"Dict.Dict Basics.Int Errors.ErrorMessage -> Basics.Int -> Dict.Dict String.String String.String -> List.List SourcePos.SourceLines -> Errors.Error"},{"name":"lookupErrorNoArgs","comment":" Looks up an ErrorMessage in an error catalogue and fills in its quoted\nsource code to produce an Error.\n","type":"Dict.Dict Basics.Int Errors.ErrorMessage -> Basics.Int -> List.List SourcePos.SourceLines -> Errors.Error"}],"binops":[]},{"name":"L1","comment":" Defines the level 1 language for data modelling.\n\n\n# The L1 data modelling AST.\n\n@docs Basic, Container, Type, Restricted, Declarable, L1\n\n\n# Properties that can be held against the L1 mode.\n\n@docs PropSpec, Property, Properties, PropSpecs\n@docs defineProperties, emptyProperties\n\n\n# Ref checking status - L1 is unchecked.\n\n@docs Unchecked\n\n\n# Helper functions for extracting info from the L1 model.\n\n@docs positionOfDeclarable, positionOfType, propertiesOfDeclarable\n\n","unions":[{"name":"Basic","comment":" The basic data types.\n","args":[],"cases":[["BBool",[]],["BInt",[]],["BReal",[]],["BString",[]]]},{"name":"Container","comment":" Containers for 0..n instances of some type.\n","args":["pos","ref"],"cases":[["CList",["L1.Type pos ref"]],["CSet",["L1.Type pos ref"]],["CDict",["L1.Type pos ref","L1.Type pos ref"]],["COptional",["L1.Type pos ref"]]]},{"name":"Declarable","comment":" Things that can be declared as named constructs.\n","args":["pos","ref"],"cases":[["DAlias",["pos","L1.Properties","L1.Type pos ref"]],["DSum",["pos","L1.Properties","List.Nonempty.Nonempty ( String.String, List.List ( String.String, L1.Type pos ref, L1.Properties ) )"]],["DEnum",["pos","L1.Properties","List.Nonempty.Nonempty String.String"]],["DRestricted",["pos","L1.Properties","L1.Restricted"]]]},{"name":"PropSpec","comment":" Defines the kinds of additional property that can be placed in the model.\n","args":[],"cases":[["PSString",[]],["PSEnum",["Enum.Enum String.String"]],["PSQName",[]],["PSBool",[]],["PSOptional",["L1.PropSpec"]]]},{"name":"Property","comment":" Allows additional properties from a variety of possible kinds to be placed\nin the model.\n","args":[],"cases":[["PString",["String.String"]],["PEnum",["Enum.Enum String.String","String.String"]],["PQName",["List.List String.String"]],["PBool",["Basics.Bool"]],["POptional",["L1.PropSpec","Maybe.Maybe L1.Property"]]]},{"name":"Restricted","comment":" Restricted forms that are subsets of the basic data types.\n","args":[],"cases":[["RInt",["{ min : Maybe.Maybe Basics.Int, max : Maybe.Maybe Basics.Int, width : Maybe.Maybe Basics.Int }"]],["RString",["{ minLength : Maybe.Maybe Basics.Int, maxLength : Maybe.Maybe Basics.Int, regex : Maybe.Maybe String.String }"]]]},{"name":"Type","comment":" The possible type constructs.\n","args":["pos","ref"],"cases":[["TUnit",["pos","L1.Properties"]],["TBasic",["pos","L1.Properties","L1.Basic"]],["TNamed",["pos","L1.Properties","String.String","ref"]],["TProduct",["pos","L1.Properties","List.Nonempty.Nonempty ( String.String, L1.Type pos ref, L1.Properties )"]],["TEmptyProduct",["pos","L1.Properties"]],["TContainer",["pos","L1.Properties","L1.Container pos ref"]],["TFunction",["pos","L1.Properties","L1.Type pos ref","L1.Type pos ref"]]]},{"name":"Unchecked","comment":" Indicates that the model has not been checked.\n","args":[],"cases":[["Unchecked",[]]]}],"aliases":[{"name":"L1","comment":" L1 is a list of unchecked declarables.\n","args":["pos"],"type":"List.List ( String.String, L1.Declarable pos L1.Unchecked )"},{"name":"PropSpecs","comment":" A set of additional property kinds that can or must be defined against\nthe model.\n","args":[],"type":"Dict.Dict String.String L1.PropSpec"},{"name":"Properties","comment":" A set of additional properties on the model.\n","args":[],"type":"Dict.Dict String.String L1.Property"}],"values":[{"name":"defineProperties","comment":" Defines a set of property specifications with possible defaults. The first argument is a\nlist of property specs, and the second is a list of default values.\n\nValues may appear in the second argument that are not in the first, in which case a specification\nfor them will be infered.\n\nValues in the second argument that are also in the first should be of the same kind, but will be\noverriden by the second argument if not.\n\n","type":"List.List ( String.String, L1.PropSpec ) -> List.List ( String.String, L1.Property ) -> ( L1.PropSpecs, L1.Properties )"},{"name":"emptyProperties","comment":" Creates an empty set of properties.\n","type":"L1.Properties"},{"name":"positionOfDeclarable","comment":" Gets the position context from a Declarable.\n","type":"L1.Declarable pos ref -> pos"},{"name":"positionOfType","comment":" Gets the position context from a Type.\n","type":"L1.Type pos ref -> pos"},{"name":"propertiesOfDeclarable","comment":" Gets the properties from a Declarable.\n","type":"L1.Declarable pos ref -> L1.Properties"}],"binops":[]},{"name":"L2","comment":" Defines the level 2 language for data models that have been checked for\nconsitency, and have been processed for general data modelling concerns without\nregard to specific code generators.\n\n\n# The L2 data modelling language.\n\n@docs L2\n\n\n# Ref checking status - L2 is checked.\n\n@docs RefChecked\n\n\n# Standardized interface to an L2 processor.\n\n@docs Processor, ProcessorImpl, builder\n\n","unions":[{"name":"RefChecked","comment":" Indicates that named types in the model have been reference checked to\nenusure that they name something that actually exists in the L2 dictionary.\n\nSome summary information of what they refer to is also cached during ref\nchecking. This can be very convenient during code generation to avoid having\nto look up in the dictionary all the time, to find out what kind of thing a\nnamed type is.\n\n","args":[],"cases":[["RcEnum",[]],["RcRestricted",["L1.Basic"]],["RcSum",[]],["RcTUnit",[]],["RcTBasic",[]],["RcTNamed",[]],["RcTProduct",[]],["RcTEmptyProduct",[]],["RcTContainer",[]],["RcTFunction",[]]]}],"aliases":[{"name":"L2","comment":" L2 is a dictionary of named data model components, which has also been\nreference checked to ensure that all references in the model have named\nentries in the dictionary.\n","args":["pos"],"type":"Dict.Dict String.String (L1.Declarable pos L2.RefChecked)"},{"name":"Processor","comment":" API for an L2 model processor.\n","args":["pos"],"type":"{ name : String.String, check : L1.L1 pos -> ResultME.ResultME Errors.Error (L2.L2 pos) }"},{"name":"ProcessorImpl","comment":" SPI for an L2 model processor. Use the `builder` to turn one of these into\na `Processor`.\n","args":["pos","err"],"type":"{ name : String.String, check : L1.L1 pos -> ResultME.ResultME err (L2.L2 pos), buildError : Errors.ErrorBuilder pos err }"}],"values":[{"name":"builder","comment":" Builds an L2 Processor API from an implementation. A function to turn\nsource code positions into quoted lines of source code needs to be supplied.\n","type":"(pos -> SourcePos.SourceLines) -> L2.ProcessorImpl pos err -> L2.Processor pos"}],"binops":[]},{"name":"L3","comment":" Defines the level 3 language for data models that have been annotated with\nproperties indicating that the model has particular features needed by particular\ncode generators.\n\nA level 3 language ensures the specific requirements for processing by a specific\ncode generator are being met.\n\n\n# The L3 data modelling language.\n\n@docs L3\n\n\n# Defaulting of properties across the data model, and APIs to read properties.\n\n@docs DefaultProperties, PropertiesAPI, PropertyGet, makePropertiesAPI\n\n\n# Standardized interface to an L3 processor.\n\n@docs Processor, ProcessorImpl, builder\n\n\n# Default error catalogue for property errors.\n\n@docs PropCheckError, errorBuilder, errorCatalogue\n\n","unions":[{"name":"PropCheckError","comment":" Once properties have been checked, then reading properties as per the property\nspecification should always succeed, since those properties have been verified to be\npresent and of the correct kind.\n\nIf reading a property fails, it is a coding error and should be reported as a bug.\nThis error type enumerates the possible properties bugs.\n\n","args":[],"cases":[["CheckedPropertyMissing",["String.String","L1.PropSpec"]],["CheckedPropertyWrongKind",["String.String","L1.PropSpec"]]]}],"aliases":[{"name":"DefaultProperties","comment":" Allows the default properties on parts of the model to be defined.\n","args":[],"type":"{ top : ( L1.PropSpecs, L1.Properties ), alias : ( L1.PropSpecs, L1.Properties ), sum : ( L1.PropSpecs, L1.Properties ), enum : ( L1.PropSpecs, L1.Properties ), restricted : ( L1.PropSpecs, L1.Properties ), fields : ( L1.PropSpecs, L1.Properties ), unit : ( L1.PropSpecs, L1.Properties ), basic : ( L1.PropSpecs, L1.Properties ), named : ( L1.PropSpecs, L1.Properties ), product : ( L1.PropSpecs, L1.Properties ), emptyProduct : ( L1.PropSpecs, L1.Properties ), container : ( L1.PropSpecs, L1.Properties ), function : ( L1.PropSpecs, L1.Properties ) }"},{"name":"L3","comment":" The L3 model. This consists of an L2 model and a set of top-level properties\nthat a code generator needs to know.\n","args":["pos"],"type":"{ properties : L1.Properties, declarations : Dict.Dict String.String (L1.Declarable pos L2.RefChecked) }"},{"name":"Processor","comment":" API for an L3 model processor.\n","args":["pos"],"type":"{ name : String.String, defaults : L3.DefaultProperties, check : L3.L3 pos -> ResultME.ResultME Errors.Error (L3.L3 pos) }"},{"name":"ProcessorImpl","comment":" SPI for an L3 model processor. Use the `builder` to turn one of these into\na `Processor`.\n","args":["pos","err"],"type":"{ name : String.String, defaults : L3.DefaultProperties, check : L3.L3 pos -> ResultME.ResultME err (L3.L3 pos), buildError : Errors.ErrorBuilder pos err }"},{"name":"PropertiesAPI","comment":" An API for supplying property readers for various parts of the data model.\n","args":["pos"],"type":"{ top : L3.PropertyGet, declarable : L1.Declarable pos L2.RefChecked -> L3.PropertyGet, field : L1.Properties -> L3.PropertyGet, type_ : L1.Type pos L2.RefChecked -> L3.PropertyGet }"},{"name":"PropertyGet","comment":" An API for reading properties of various expected kinds.\n","args":[],"type":"{ getStringProperty : String.String -> ResultME.ResultME L3.PropCheckError String.String, getEnumProperty : Enum.Enum String.String -> String.String -> ResultME.ResultME L3.PropCheckError String.String, getQNameProperty : String.String -> ResultME.ResultME L3.PropCheckError (List.List String.String), getBoolProperty : String.String -> ResultME.ResultME L3.PropCheckError Basics.Bool, getOptionalStringProperty : String.String -> ResultME.ResultME L3.PropCheckError (Maybe.Maybe String.String), getOptionalEnumProperty : Enum.Enum String.String -> String.String -> ResultME.ResultME L3.PropCheckError (Maybe.Maybe String.String) }"}],"values":[{"name":"builder","comment":" Builds an L3 Processor API from an implementation. A function to turn\nsource code positions into quoted lines of source code needs to be supplied.\n","type":"(pos -> SourcePos.SourceLines) -> L3.ProcessorImpl pos err -> L3.Processor pos"},{"name":"errorBuilder","comment":" Convert prop check errors to standard errors.\n","type":"(pos -> SourcePos.SourceLines) -> L3.PropCheckError -> Errors.Error"},{"name":"errorCatalogue","comment":" The error catalogue for this property checking.\n\nThe error message here are quite generic, and you likely want to re-write\nthis error catalogue for specific modules in order to give better messages.\n\n","type":"Dict.Dict Basics.Int Errors.ErrorMessage"},{"name":"makePropertiesAPI","comment":" Creates a properties API from a set of defaulted property specs, and an\nL3 model.\n","type":"L3.DefaultProperties -> L3.L3 pos -> L3.PropertiesAPI pos"}],"binops":[]},{"name":"Naming","comment":" Helper functions for working with names in source code.\n\n\n# Check names are valid.\n\n@docs checkName\n\n\n# Build valid names.\n\n@docs safeName, safeCCU, safeCCL\n\n\n# Sort things by name.\n\n@docs sortNamed, sortNonemptyNamed\n\n","unions":[],"aliases":[],"values":[{"name":"checkName","comment":" Checks that a name starts with an alpha character, and is followed only\nby alpha and numeric characters.\n","type":"String.String -> Basics.Bool"},{"name":"safeCCL","comment":" CCL stands for camel-case-lower. This puts a name into camel case lower\nformat.\n\nAdditional it checks if the name matches an Elm keyword, and proposes a\ndifferent name to use instead, which is the original with an underscore appended.\n\n    safeCCL \"type\" == \"type_\"\n\n    safeCCL \"someVar\" == \"someVar\"\n\n    safeCCL \"MyList\" == \"myList\"\n\n","type":"String.String -> String.String"},{"name":"safeCCU","comment":" CCL stands for camel-case-upper. This puts a name into camel case upper\nformat.\n\nAdditional it checks if the name matches an Elm keyword, and proposes a\ndifferent name to use instead, which is the original with an underscore appended.\n\n    safeCCL \"type\" == \"Type_\"\n\n    safeCCL \"someVar\" == \"SomeVar\"\n\n    safeCCL \"MyList\" == \"MyList\"\n\n","type":"String.String -> String.String"},{"name":"safeName","comment":" Checks if a name matches an Elm keyword, and proposes a different name to\nuse instead, which is the original with an underscore appended.\n\n    safeName \"type\" == \"type_\"\n\n","type":"String.String -> String.String"},{"name":"sortNamed","comment":" Sorts a list of named things alphabetically.\n","type":"List.List ( String.String, a ) -> List.List ( String.String, a )"},{"name":"sortNonemptyNamed","comment":" Sorts an non-empty list of named things alphabetically.\n","type":"List.Nonempty.Nonempty ( String.String, a, b ) -> List.Nonempty.Nonempty ( String.String, a, b )"}],"binops":[]},{"name":"SourcePos","comment":" SourcePos provides a way of defining regions of text to quote or to\nhighlight mainly for the purpose of showing where errors exist within some\nsource code.\n\nThe code is treated as lines of text, and positions within that described by row\nand column number.\n\n\n# Regions of text\n\n@docs Region, RowCol\n\n\n# Quoted and highlighted blocks of text\n\n@docs SourceLines, sourceLinesForRegions\n\n","unions":[],"aliases":[{"name":"Region","comment":" Describes a region of text running from a start to an end position.\n","args":[],"type":"{ start : SourcePos.RowCol, end : SourcePos.RowCol }"},{"name":"RowCol","comment":" Describes a position within some lines of text.\n","args":[],"type":"{ row : Basics.Int, col : Basics.Int }"},{"name":"SourceLines","comment":" Captures a set of source code lines which are indexed by their line numbers,\n\nA highlight region may also be specified, and if set is used to indicate where\nwithin the source lines an error is located. All lines within the highlight\nregion are expected to be in the line dict.\n\n","args":[],"type":"{ lines : Dict.Dict Basics.Int String.String, highlight : Maybe.Maybe SourcePos.Region }"}],"values":[{"name":"sourceLinesForRegions","comment":" Quotes a region of text as `SourceLines`.\n","type":"Dict.Dict Basics.Int String.String -> List.List SourcePos.Region -> List.List SourcePos.SourceLines"}],"binops":[]},{"name":"Templates.Elm","comment":" Elm code generation from L2 models. This can be used when writing an L3 code\ngenerator that output Elm code. It can be used to generate type declarations,\ntype annotations and JSON codecs for Elm data models.\n\nType declarations:\n\n@docs typeDecl, codec\n\nLowerings of L2 into Elm type annotations:\n\n@docs lowerType, lowerFun\n\n","unions":[],"aliases":[],"values":[{"name":"codec","comment":" Generates a Codec for an L1 type declaration.\n","type":"String.String -> L1.Declarable pos L2.RefChecked -> ( Elm.CodeGen.Declaration, Elm.CodeGen.Linkage )"},{"name":"lowerFun","comment":" Lowers an L1 function type into an Elm type annotation\n","type":"L1.Type pos L2.RefChecked -> L1.Type pos L2.RefChecked -> ( Elm.CodeGen.TypeAnnotation, Elm.CodeGen.Linkage )"},{"name":"lowerType","comment":" Lowers an L1 type into an Elm type annotation.\n","type":"L1.Type pos L2.RefChecked -> ( Elm.CodeGen.TypeAnnotation, Elm.CodeGen.Linkage )"},{"name":"typeDecl","comment":" Turns an L1 type declaration into Elm code.\n\nA type can result in a list of declarations - enums in addition to declaring a\ntype can also declare the permitted enum values.\n\n","type":"String.String -> Elm.CodeGen.Comment Elm.CodeGen.DocComment -> L1.Declarable pos L2.RefChecked -> ( List.List Elm.CodeGen.Declaration, Elm.CodeGen.Linkage )"}],"binops":[]}]