[{"name":"Morphir.IR.AccessControlled","comment":" Module to manage access to a node in the IR. This is only used to declare access levels\nnot to enforce them. Enforcement can be done through the helper functions\n[withPublicAccess](#withPublicAccess) and [withPrivateAccess](#withPrivateAccess) but it's\nup to the consumer of the API to call the righ function.\n\n@docs AccessControlled, Access\n\n\n# Creation\n\n@docs public, private\n\n\n# Query\n\n@docs withPublicAccess, withPrivateAccess\n\n\n# Transform\n\n@docs map\n\n","unions":[{"name":"Access","comment":" Public or private access.\n","args":[],"cases":[["Public",[]],["Private",[]]]}],"aliases":[{"name":"AccessControlled","comment":" Type that represents different access levels.\n","args":["a"],"type":"{ access : Morphir.IR.AccessControlled.Access, value : a }"}],"values":[{"name":"map","comment":" Apply a function to the access controlled value but keep the access unchanged.\n","type":"(a -> b) -> Morphir.IR.AccessControlled.AccessControlled a -> Morphir.IR.AccessControlled.AccessControlled b"},{"name":"private","comment":" Mark a node as private access. Only actors with private access level can see.\n","type":"a -> Morphir.IR.AccessControlled.AccessControlled a"},{"name":"public","comment":" Mark a node as public access. Actors with both public and private access are allowed to see.\n","type":"a -> Morphir.IR.AccessControlled.AccessControlled a"},{"name":"withPrivateAccess","comment":" Get the value with private access level. Will always return the value.\n\n    withPrivateAccess (public 13) -- 13\n\n    withPrivateAccess (private 13) -- 13\n\n","type":"Morphir.IR.AccessControlled.AccessControlled a -> a"},{"name":"withPublicAccess","comment":" Get the value with public access level. Will return `Nothing` if the value is private.\n\n    withPublicAccess (public 13) -- Just 13\n\n    withPublicAccess (private 13) -- Nothing\n\n","type":"Morphir.IR.AccessControlled.AccessControlled a -> Maybe.Maybe a"}],"binops":[]},{"name":"Morphir.IR.FQName","comment":" Module to work with fully-qualified names. A qualified name is a combination of a package path, a module path and a local name.\n\n@docs FQName, fQName, fromQName, getPackagePath, getModulePath, getLocalName\n\n","unions":[{"name":"FQName","comment":" Type that represents a fully-qualified name.\n","args":[],"cases":[["FQName",["Morphir.IR.Path.Path","Morphir.IR.Path.Path","Morphir.IR.Name.Name"]]]}],"aliases":[],"values":[{"name":"fQName","comment":" Create a fully-qualified name.\n","type":"Morphir.IR.Path.Path -> Morphir.IR.Path.Path -> Morphir.IR.Name.Name -> Morphir.IR.FQName.FQName"},{"name":"fromQName","comment":" Create a fully-qualified from a qualified name.\n","type":"Morphir.IR.Path.Path -> Morphir.IR.QName.QName -> Morphir.IR.FQName.FQName"},{"name":"getLocalName","comment":" Get the local name part of a fully-qualified name.\n","type":"Morphir.IR.FQName.FQName -> Morphir.IR.Name.Name"},{"name":"getModulePath","comment":" Get the module path part of a fully-qualified name.\n","type":"Morphir.IR.FQName.FQName -> Morphir.IR.Path.Path"},{"name":"getPackagePath","comment":" Get the package path part of a fully-qualified name.\n","type":"Morphir.IR.FQName.FQName -> Morphir.IR.Path.Path"}],"binops":[]},{"name":"Morphir.IR.Module","comment":" Modules are groups of types and values that belong together.\n\n@docs Specification, Definition\n@docs ModulePath, definitionToSpecification, eraseSpecificationAttributes, mapDefinitionAttributes, mapSpecificationAttributes\n\n","unions":[],"aliases":[{"name":"Definition","comment":" Type that represents a module definition. It includes types and values.\n","args":["a"],"type":"{ types : Dict.Dict Morphir.IR.Name.Name (Morphir.IR.AccessControlled.AccessControlled (Morphir.IR.Type.Definition a)), values : Dict.Dict Morphir.IR.Name.Name (Morphir.IR.AccessControlled.AccessControlled (Morphir.IR.Value.Definition a)) }"},{"name":"ModulePath","comment":" ","args":[],"type":"Morphir.IR.Path.Path"},{"name":"Specification","comment":" Type that represents a module specification.\n","args":["a"],"type":"{ types : Dict.Dict Morphir.IR.Name.Name (Morphir.IR.Type.Specification a), values : Dict.Dict Morphir.IR.Name.Name (Morphir.IR.Value.Specification a) }"}],"values":[{"name":"definitionToSpecification","comment":" ","type":"Morphir.IR.Module.Definition a -> Morphir.IR.Module.Specification a"},{"name":"eraseSpecificationAttributes","comment":" ","type":"Morphir.IR.Module.Specification a -> Morphir.IR.Module.Specification ()"},{"name":"mapDefinitionAttributes","comment":" ","type":"(a -> b) -> Morphir.IR.Module.Definition a -> Morphir.IR.Module.Definition b"},{"name":"mapSpecificationAttributes","comment":" ","type":"(a -> b) -> Morphir.IR.Module.Specification a -> Morphir.IR.Module.Specification b"}],"binops":[]},{"name":"Morphir.IR.Name","comment":" `Name` is an abstraction of human-readable identifiers made up of words. This abstraction\nallows us to use the same identifiers across various naming conventions used by the different\nfrontend and backend languages Morphir integrates with.\n\n    name = fromList [ \"value\", \"in\", \"u\", \"s\", \"d\" ]\n\n    toTitleCase name --> \"ValueInUSD\"\n    toCamelCase name --> \"valueInUSD\"\n    toSnakeCase name --> \"value_in_USD\"\n\n\n## Abbreviations\n\nWe frequently use abbreviations in a business context to be more concise.\nFrom a naming perspective abbreviations are challanging because they are not real words and\nbehave slightly differently. In this module we treat abbreviations as a list of single-letter\nwords. This approach fits nicely into camel and title case naming conventions but when using\nsnake-case the direct translation would look unnatural:\n\n    toSnakeCase name -- \"value_in_u_s_d\" ?\n\nTo resolve this and help creating human-readable strings we added functionality to turn\nabbreviations into upper-case words. We treat any series of single letter words as an\nabbreviation:\n\n    toSnakeCase name --> \"value_in_USD\"\n\n@docs Name, fromList, toList\n\n\n# String conversion\n\n@docs fromString, toTitleCase, toCamelCase, toSnakeCase, toHumanWords\n\n","unions":[],"aliases":[{"name":"Name","comment":" Type that represents a name that is made up of words.\n","args":[],"type":"List.List String.String"}],"values":[{"name":"fromList","comment":" Convert a list of strings into a name.\n","type":"List.List String.String -> Morphir.IR.Name.Name"},{"name":"fromString","comment":" Translate a string into a name by splitting it into words. The algorithm is designed\nto work with most well-known naming conventions or mix of them. The general rule is that\nconsecutive letters and numbers are treated as words, upper-case letters and non-alphanumeric\ncharacters start a new word.\n\n    fromString \"fooBar_baz 123\"\n    --> Name.fromList [ \"foo\", \"bar\", \"baz\", \"123\" ]\n\n    fromString \"valueInUSD\"\n    --> Name.fromList [ \"value\", \"in\", \"u\", \"s\", \"d\" ]\n\n    fromString \"ValueInUSD\"\n    --> Name.fromList [ \"value\", \"in\", \"u\", \"s\", \"d\" ]\n\n    fromString \"value_in_USD\"\n    --> Name.fromList [ \"value\", \"in\", \"u\", \"s\", \"d\" ]\n\n    fromString \"_-%\"\n    --> Name.fromList []\n\n","type":"String.String -> Morphir.IR.Name.Name"},{"name":"toCamelCase","comment":" Turns a name into a camel-case string.\n\n    toCamelCase (fromList [ \"foo\", \"bar\", \"baz\", \"123\" ])\n    --> \"fooBarBaz123\"\n\n    toCamelCase (fromList [ \"value\", \"in\", \"u\", \"s\", \"d\" ])\n    --> \"valueInUSD\"\n\n","type":"Morphir.IR.Name.Name -> String.String"},{"name":"toHumanWords","comment":" Turns a name into a list of human-readable strings. The only difference\ncompared to [`toList`](#toList) is how it handles abbreviations. They will\nbe turned into a single upper-case word instead of separate single-character\nwords.\n\n    toHumanWords (fromList [ \"value\", \"in\", \"u\", \"s\", \"d\" ])\n    --> [ \"value\", \"in\", \"USD\" ]\n\n","type":"Morphir.IR.Name.Name -> List.List String.String"},{"name":"toList","comment":" Convert a name to a list of strings.\n","type":"Morphir.IR.Name.Name -> List.List String.String"},{"name":"toSnakeCase","comment":" Turns a name into a snake-case string.\n\n    toSnakeCase (fromList [ \"foo\", \"bar\", \"baz\", \"123\" ])\n    --> \"foo_bar_baz_123\"\n\n    toSnakeCase (fromList [ \"value\", \"in\", \"u\", \"s\", \"d\" ])\n    --> \"value_in_USD\"\n\n","type":"Morphir.IR.Name.Name -> String.String"},{"name":"toTitleCase","comment":" Turns a name into a title-case string.\n\n    toTitleCase (fromList [ \"foo\", \"bar\", \"baz\", \"123\" ])\n    --> \"FooBarBaz123\"\n\n    toTitleCase (fromList [ \"value\", \"in\", \"u\", \"s\", \"d\" ])\n    --> \"ValueInUSD\"\n\n","type":"Morphir.IR.Name.Name -> String.String"}],"binops":[]},{"name":"Morphir.IR.Package","comment":" Tools to work with packages.\n\n@docs Specification\n\n@docs Definition, emptyDefinition\n\n@docs PackagePath, definitionToSpecification, eraseDefinitionAttributes, eraseSpecificationAttributes\n\n","unions":[],"aliases":[{"name":"Definition","comment":" Type that represents a package definition.\n","args":["a"],"type":"{ dependencies : Dict.Dict Morphir.IR.Package.PackagePath (Morphir.IR.Package.Specification a), modules : Dict.Dict Morphir.IR.Module.ModulePath (Morphir.IR.AccessControlled.AccessControlled (Morphir.IR.Module.Definition a)) }"},{"name":"PackagePath","comment":" ","args":[],"type":"Morphir.IR.Path.Path"},{"name":"Specification","comment":" Type that represents a package specification.\n","args":["a"],"type":"{ modules : Dict.Dict Morphir.IR.Module.ModulePath (Morphir.IR.Module.Specification a) }"}],"values":[{"name":"definitionToSpecification","comment":" ","type":"Morphir.IR.Package.Definition a -> Morphir.IR.Package.Specification a"},{"name":"emptyDefinition","comment":" An empty package definition.\n","type":"Morphir.IR.Package.Definition a"},{"name":"eraseDefinitionAttributes","comment":" ","type":"Morphir.IR.Package.Definition a -> Morphir.IR.Package.Definition ()"},{"name":"eraseSpecificationAttributes","comment":" ","type":"Morphir.IR.Package.Specification a -> Morphir.IR.Package.Specification ()"}],"binops":[]},{"name":"Morphir.IR.Path","comment":" `Path` is a list of names that represents a path in the tree. It's used at various\nplaces in the IR to identify types and values.\n\n@docs Path, fromList, toList\n\n\n# String conversion\n\n@docs fromString, toString\n\n\n# Utilities\n\n@docs isPrefixOf\n\n","unions":[],"aliases":[{"name":"Path","comment":" Type that represents a path as a list of names.\n","args":[],"type":"List.List Morphir.IR.Name.Name"}],"values":[{"name":"fromList","comment":" Converts a list of names to a path.\n","type":"List.List Morphir.IR.Name.Name -> Morphir.IR.Path.Path"},{"name":"fromString","comment":" Translates a string into a path by splitting it into names along special characters.\nThe algorithm will treat any non-word charaters that are not spaces as a path separator.\n\n    fromString \"fooBar.Baz\"\n    --> Path.fromList\n    -->     [ Name.fromList [ \"foo\", \"bar\" ]\n    -->     , Name.fromList [ \"baz\" ]\n    -->     ]\n\n    fromString \"foo bar/baz\"\n    --> Path.fromList\n    -->     [ Name.fromList [ \"foo\", \"bar\" ]\n    -->     , Name.fromList [ \"baz\" ]\n    -->     ]\n\n","type":"String.String -> Morphir.IR.Path.Path"},{"name":"isPrefixOf","comment":" Checks if a path is a prefix of another.\n\n    isPrefixOf [ [ \"foo\" ], [ \"bar\" ] ] [ [ \"foo\" ] ] == True\n\n    isPrefixOf [ [ \"foo\" ] ] [ [ \"foo\" ], [ \"bar\" ] ] == False\n\n    isPrefixOf [ [ \"foo\" ], [ \"bar\" ] ] [ [ \"foo\" ], [ \"bar\" ] ] == True\n\n","type":"Morphir.IR.Path.Path -> Morphir.IR.Path.Path -> Basics.Bool"},{"name":"toList","comment":" Converts a path to a list of names.\n","type":"Morphir.IR.Path.Path -> List.List Morphir.IR.Name.Name"},{"name":"toString","comment":" Turn a path into a string using the specified naming convention and separator.\n\n    path =\n        Path.fromList\n            [ Name.fromList [ \"foo\", \"bar\" ]\n            , Name.fromList [ \"baz\" ]\n            ]\n\n    toString Name.toTitleCase \".\" path\n    --> \"FooBar.Baz\"\n\n    toString Name.toSnakeCase \"/\" path\n    --> \"foo_bar/baz\"\n\n","type":"(Morphir.IR.Name.Name -> String.String) -> String.String -> Morphir.IR.Path.Path -> String.String"}],"binops":[]},{"name":"Morphir.IR.QName","comment":" Module to work with qualified names. A qualified name is a combination of a module path and a local name.\n\n@docs QName, toTuple, getModulePath, getLocalName\n\n\n# Creation\n\n@docs fromName, fromTuple\n\n\n# String conversion\n\n@docs toString\n\n","unions":[{"name":"QName","comment":" Type that represents a qualified name.\n","args":[],"cases":[["QName",["Morphir.IR.Path.Path","Morphir.IR.Name.Name"]]]}],"aliases":[],"values":[{"name":"fromName","comment":" Creates a qualified name.\n","type":"Morphir.IR.Path.Path -> Morphir.IR.Name.Name -> Morphir.IR.QName.QName"},{"name":"fromTuple","comment":" Turn a tuple into a qualified name.\n","type":"( Morphir.IR.Path.Path, Morphir.IR.Name.Name ) -> Morphir.IR.QName.QName"},{"name":"getLocalName","comment":" Get the local name part of a qualified name.\n","type":"Morphir.IR.QName.QName -> Morphir.IR.Name.Name"},{"name":"getModulePath","comment":" Get the module path part of a qualified name.\n","type":"Morphir.IR.QName.QName -> Morphir.IR.Path.Path"},{"name":"toString","comment":" Turn a qualified name into a string using the specified\npath and name conventions.\n\n    qname =\n        QName.fromTuple\n            (Path.fromList\n                [ Name.fromList [ \"foo\", \"bar\" ]\n                , Name.fromList [ \"baz\" ]\n                ]\n            , Name.fromList [ \"a\", \"name\" ]\n            )\n\n    toString Name.toTitleCase Name.toCamelCase \".\" qname\n    --> \"FooBar.Baz.aName\"\n\n    toString Name.toSnakeCase Name.toSnakeCase \"/\" qname\n    --> \"foo_bar/baz/a_name\"\n\n","type":"(Morphir.IR.Name.Name -> String.String) -> (Morphir.IR.Name.Name -> String.String) -> String.String -> Morphir.IR.QName.QName -> String.String"},{"name":"toTuple","comment":" Turn a qualified name into a tuple.\n","type":"Morphir.IR.QName.QName -> ( Morphir.IR.Path.Path, Morphir.IR.Name.Name )"}],"binops":[]},{"name":"Morphir.IR.Type","comment":" This module contains the building blocks of types in the Morphir IR.\n\n\n# Type Expression\n\n@docs Type\n\n\n## Creation\n\n@docs variable, reference, tuple, record, extensibleRecord, function, unit\n\n\n# Record Field\n\n@docs Field, mapFieldName, mapFieldType\n\n\n# Specification\n\n@docs Specification, typeAliasSpecification, opaqueTypeSpecification, customTypeSpecification\n\n\n# Definition\n\n@docs Definition, typeAliasDefinition, customTypeDefinition, definitionToSpecification\n\n\n# Constructors\n\n@docs Constructors, Constructor\n\n\n# Mapping\n\n@docs mapTypeAttributes, mapSpecificationAttributes, mapDefinitionAttributes, mapDefinition, eraseAttributes\n\n","unions":[{"name":"Constructor","comment":" ","args":["a"],"cases":[["Constructor",["Morphir.IR.Name.Name","List.List ( Morphir.IR.Name.Name, Morphir.IR.Type.Type a )"]]]},{"name":"Definition","comment":" This syntax represents a type definition. For example:\n\n  - `type alias Foo a = {bar : Maybe a, qux : Int}`\n  - `type MyList a = End | Cons a (MyList a)`\n\nIn the definition, the `List Name` refers to type parameters on the LHS\nand `Type extra` refers to the RHS\n\n","args":["a"],"cases":[["TypeAliasDefinition",["List.List Morphir.IR.Name.Name","Morphir.IR.Type.Type a"]],["CustomTypeDefinition",["List.List Morphir.IR.Name.Name","Morphir.IR.AccessControlled.AccessControlled (Morphir.IR.Type.Constructors a)"]]]},{"name":"Specification","comment":" ","args":["a"],"cases":[["TypeAliasSpecification",["List.List Morphir.IR.Name.Name","Morphir.IR.Type.Type a"]],["OpaqueTypeSpecification",["List.List Morphir.IR.Name.Name"]],["CustomTypeSpecification",["List.List Morphir.IR.Name.Name","Morphir.IR.Type.Constructors a"]]]},{"name":"Type","comment":" An opaque representation of a type. Check out the docs for each building blocks\nfor more details:\n\n  - type variable: [creation](#variable), [matching](#matchVariable)\n  - type reference: [creation](#reference), [matching](#matchReference)\n  - tuple type: [creation](#tuple), [matching](#matchTuple)\n  - record type: [creation](#record), [matching](#matchRecord)\n  - extensible record type: [creation](#extensibleRecord), [matching](#matchExtensibleRecord)\n  - function type: [creation](#function), [matching](#matchFunction)\n  - unit type: [creation](#unit), [matching](#matchUnit)\n\n","args":["a"],"cases":[["Variable",["a","Morphir.IR.Name.Name"]],["Reference",["a","Morphir.IR.FQName.FQName","List.List (Morphir.IR.Type.Type a)"]],["Tuple",["a","List.List (Morphir.IR.Type.Type a)"]],["Record",["a","List.List (Morphir.IR.Type.Field a)"]],["ExtensibleRecord",["a","Morphir.IR.Name.Name","List.List (Morphir.IR.Type.Field a)"]],["Function",["a","Morphir.IR.Type.Type a","Morphir.IR.Type.Type a"]],["Unit",["a"]]]}],"aliases":[{"name":"Constructors","comment":" ","args":["a"],"type":"List.List (Morphir.IR.Type.Constructor a)"},{"name":"Field","comment":" An opaque representation of a field. It's made up of a name and a type.\n","args":["a"],"type":"{ name : Morphir.IR.Name.Name, tpe : Morphir.IR.Type.Type a }"}],"values":[{"name":"customTypeDefinition","comment":" ","type":"List.List Morphir.IR.Name.Name -> Morphir.IR.AccessControlled.AccessControlled (Morphir.IR.Type.Constructors a) -> Morphir.IR.Type.Definition a"},{"name":"customTypeSpecification","comment":" ","type":"List.List Morphir.IR.Name.Name -> Morphir.IR.Type.Constructors a -> Morphir.IR.Type.Specification a"},{"name":"definitionToSpecification","comment":" ","type":"Morphir.IR.Type.Definition a -> Morphir.IR.Type.Specification a"},{"name":"eraseAttributes","comment":" ","type":"Morphir.IR.Type.Definition a -> Morphir.IR.Type.Definition ()"},{"name":"extensibleRecord","comment":" Creates an extensible record type.\n\n    toIR { e | foo = Int }\n        == extensibleRecord (variable [ \"e\" ])\n            [ field [ \"foo\" ] intType\n            ]\n\n    toIR { f | foo = Int, bar = Bool }\n        == extensibleRecord (variable [ \"f\" ])\n            [ field [ \"foo\" ] intType\n            , field [ \"bar\" ] boolType\n            ]\n\n","type":"a -> Morphir.IR.Name.Name -> List.List (Morphir.IR.Type.Field a) -> Morphir.IR.Type.Type a"},{"name":"function","comment":" Creates a function type. Use currying to create functions with more than one argument.\n\n    toIR (Int -> Bool) ==\n        function\n            SDK.Basics.intType\n            SDK.Basics.boolType\n\n    toIR (Int -> Bool -> Char) ==\n        function\n            intType\n            (function\n                SDK.Basics.boolType\n                SDK.Basics.charType\n            )\n\n","type":"a -> Morphir.IR.Type.Type a -> Morphir.IR.Type.Type a -> Morphir.IR.Type.Type a"},{"name":"mapDefinition","comment":" ","type":"(Morphir.IR.Type.Type a -> Result.Result e (Morphir.IR.Type.Type b)) -> Morphir.IR.Type.Definition a -> Result.Result (List.List e) (Morphir.IR.Type.Definition b)"},{"name":"mapDefinitionAttributes","comment":" ","type":"(a -> b) -> Morphir.IR.Type.Definition a -> Morphir.IR.Type.Definition b"},{"name":"mapFieldName","comment":" Map the name of the field to get a new field.\n","type":"(Morphir.IR.Name.Name -> Morphir.IR.Name.Name) -> Morphir.IR.Type.Field a -> Morphir.IR.Type.Field a"},{"name":"mapFieldType","comment":" Map the type of the field to get a new field.\n","type":"(Morphir.IR.Type.Type a -> Morphir.IR.Type.Type b) -> Morphir.IR.Type.Field a -> Morphir.IR.Type.Field b"},{"name":"mapSpecificationAttributes","comment":" ","type":"(a -> b) -> Morphir.IR.Type.Specification a -> Morphir.IR.Type.Specification b"},{"name":"mapTypeAttributes","comment":" ","type":"(a -> b) -> Morphir.IR.Type.Type a -> Morphir.IR.Type.Type b"},{"name":"opaqueTypeSpecification","comment":" ","type":"List.List Morphir.IR.Name.Name -> Morphir.IR.Type.Specification a"},{"name":"record","comment":" Creates a record type.\n\n    toIR {} == record []\n\n    toIR { foo = Int }\n        == record\n            [ field [ \"foo\" ] SDK.Basics.intType\n            ]\n\n    toIR { foo = Int, bar = Bool }\n        == record\n            [ field [ \"foo\" ] SDK.Basics.intType\n            , field [ \"bar\" ] SDK.Basics.boolType\n            ]\n\n","type":"a -> List.List (Morphir.IR.Type.Field a) -> Morphir.IR.Type.Type a"},{"name":"reference","comment":" Creates a fully-qualified reference to a type.\n\n    toIR (List Int)\n        == reference SDK.List.listType [ intType ]\n\n    toIR Foo.Bar\n        == reference\n            ( [ [ \"my\" ], [ \"lib\" ] ], [ [ \"foo\" ] ], [ \"bar\" ] )\n            []\n\n","type":"a -> Morphir.IR.FQName.FQName -> List.List (Morphir.IR.Type.Type a) -> Morphir.IR.Type.Type a"},{"name":"tuple","comment":" Creates a tuple type.\n\n    toIR ( Int, Bool )\n        == tuple [ basic intType, basic boolType ]\n\n","type":"a -> List.List (Morphir.IR.Type.Type a) -> Morphir.IR.Type.Type a"},{"name":"typeAliasDefinition","comment":" ","type":"List.List Morphir.IR.Name.Name -> Morphir.IR.Type.Type a -> Morphir.IR.Type.Definition a"},{"name":"typeAliasSpecification","comment":" ","type":"List.List Morphir.IR.Name.Name -> Morphir.IR.Type.Type a -> Morphir.IR.Type.Specification a"},{"name":"unit","comment":" Creates a unit type.\n\n    toIR () == unit\n\n","type":"a -> Morphir.IR.Type.Type a"},{"name":"variable","comment":" Creates a type variable.\n\n    toIR a == variable [ \"a\" ] ()\n\n    toIR fooBar == variable [ \"foo\", \"bar\" ] ()\n\n","type":"a -> Morphir.IR.Name.Name -> Morphir.IR.Type.Type a"}],"binops":[]},{"name":"Morphir.IR.Value","comment":" This module contains the building blocks of values in the Morphir IR.\n\n\n# Value\n\nValue is the top level building block for data and logic. See the constructor functions below for details on each node type.\n\n@docs Value, literal, constructor, apply, field, fieldFunction, lambda, letDef, letDestruct, letRec, list, record, reference\n@docs tuple, variable, ifThenElse, patternMatch, update, unit\n@docs mapValueAttributes\n\n\n# Literal\n\nLiterals represent fixed values in the IR. We support the same set of basic types as Elm which almost matches JSON's supported values:\n\n  - Bool\n  - Char\n  - String\n  - Int\n  - Float\n\n@docs Literal, boolLiteral, charLiteral, stringLiteral, intLiteral, floatLiteral\n\n\n# Pattern\n\nPatterns are used in multiple ways in the IR: they can take apart a structured value into smaller pieces (destructure) and they\ncan also filter values. The combination of these two features creates a very powerful method tool that can be used in two ways:\ndestructuring and pattern-matching. Pattern-matching is a combination of destructuring, filtering and branching.\n\n@docs Pattern, wildcardPattern, asPattern, tuplePattern, recordPattern, constructorPattern, emptyListPattern, headTailPattern, literalPattern\n\n\n# Specification\n\nThe specification of what the value or function\nis without the actual data or logic behind it.\n\n@docs Specification, mapSpecificationAttributes\n\n\n# Definition\n\nA definition is the actual data or logic as opposed to a specification\nwhich is just the specification of those. Value definitions can be typed or untyped. Exposed values have to be typed.\n\n@docs Definition, typedDefinition, untypedDefinition, mapDefinition, mapDefinitionAttributes\n\n","unions":[{"name":"Literal","comment":" Type that represents a literal value.\n","args":[],"cases":[["BoolLiteral",["Basics.Bool"]],["CharLiteral",["Char.Char"]],["StringLiteral",["String.String"]],["IntLiteral",["Basics.Int"]],["FloatLiteral",["Basics.Float"]]]},{"name":"Pattern","comment":" Type that represents a pattern.\n","args":["a"],"cases":[["WildcardPattern",["a"]],["AsPattern",["a","Morphir.IR.Value.Pattern a","Morphir.IR.Name.Name"]],["TuplePattern",["a","List.List (Morphir.IR.Value.Pattern a)"]],["RecordPattern",["a","List.List Morphir.IR.Name.Name"]],["ConstructorPattern",["a","Morphir.IR.FQName.FQName","List.List (Morphir.IR.Value.Pattern a)"]],["EmptyListPattern",["a"]],["HeadTailPattern",["a","Morphir.IR.Value.Pattern a","Morphir.IR.Value.Pattern a"]],["LiteralPattern",["a","Morphir.IR.Value.Literal"]],["UnitPattern",["a"]]]},{"name":"Value","comment":" Type that represents a value.\n","args":["a"],"cases":[["Literal",["a","Morphir.IR.Value.Literal"]],["Constructor",["a","Morphir.IR.FQName.FQName"]],["Tuple",["a","List.List (Morphir.IR.Value.Value a)"]],["List",["a","List.List (Morphir.IR.Value.Value a)"]],["Record",["a","List.List ( Morphir.IR.Name.Name, Morphir.IR.Value.Value a )"]],["Variable",["a","Morphir.IR.Name.Name"]],["Reference",["a","Morphir.IR.FQName.FQName"]],["Field",["a","Morphir.IR.Value.Value a","Morphir.IR.Name.Name"]],["FieldFunction",["a","Morphir.IR.Name.Name"]],["Apply",["a","Morphir.IR.Value.Value a","Morphir.IR.Value.Value a"]],["Lambda",["a","Morphir.IR.Value.Pattern a","Morphir.IR.Value.Value a"]],["LetDefinition",["a","Morphir.IR.Name.Name","Morphir.IR.Value.Definition a","Morphir.IR.Value.Value a"]],["LetRecursion",["a","Dict.Dict Morphir.IR.Name.Name (Morphir.IR.Value.Definition a)","Morphir.IR.Value.Value a"]],["Destructure",["a","Morphir.IR.Value.Pattern a","Morphir.IR.Value.Value a","Morphir.IR.Value.Value a"]],["IfThenElse",["a","Morphir.IR.Value.Value a","Morphir.IR.Value.Value a","Morphir.IR.Value.Value a"]],["PatternMatch",["a","Morphir.IR.Value.Value a","List.List ( Morphir.IR.Value.Pattern a, Morphir.IR.Value.Value a )"]],["UpdateRecord",["a","Morphir.IR.Value.Value a","List.List ( Morphir.IR.Name.Name, Morphir.IR.Value.Value a )"]],["Unit",["a"]]]}],"aliases":[{"name":"Definition","comment":" Type that represents a value or function definition. A definition is the actual data or logic as opposed to a specification\nwhich is just the specification of those. Value definitions can be typed or untyped. Exposed values have to be typed.\n","args":["a"],"type":"{ valueType : Maybe.Maybe (Morphir.IR.Type.Type a), arguments : List.List ( Morphir.IR.Name.Name, a ), body : Morphir.IR.Value.Value a }"},{"name":"Specification","comment":" Type that represents a value or function specification. The specification of what the value or function\nis without the actual data or logic behind it.\n","args":["a"],"type":"{ inputs : List.List ( Morphir.IR.Name.Name, Morphir.IR.Type.Type a ), output : Morphir.IR.Type.Type a }"}],"values":[{"name":"apply","comment":" Represents a function invocation. We use currying to represent function invocations with multiple arguments.\n\n**Note**: Operators are mapped to well-known function names.\n\n    not True -- Apply (Reference ( ..., [ [ \"basics\" ] ], [ \"not\" ])) (Literal (BoolLiteral True))\n\n    True || False -- Apply (Apply (Reference ( ..., [ [ \"basics\" ] ], [ \"and\" ]))) (Literal (BoolLiteral True)) (Literal (BoolLiteral True))\n\n","type":"a -> Morphir.IR.Value.Value a -> Morphir.IR.Value.Value a -> Morphir.IR.Value.Value a"},{"name":"asPattern","comment":" Assigns a variable name to a pattern.\n\n    _ as foo -- AsPattern WildcardPattern [\"foo\"]\n\n    foo -- AsPattern WildcardPattern [\"foo\"]\n\n    [] as foo -- AsPattern EmptyListPattern [\"foo\"]\n\n","type":"a -> Morphir.IR.Value.Pattern a -> Morphir.IR.Name.Name -> Morphir.IR.Value.Pattern a"},{"name":"boolLiteral","comment":" Represents a boolean value. Only possible values are: `True`, `False`\n","type":"Basics.Bool -> Morphir.IR.Value.Literal"},{"name":"charLiteral","comment":" Represents a character value. Some possible values: `'a'`, `'Z'`, `'3'`\n","type":"Char.Char -> Morphir.IR.Value.Literal"},{"name":"constructor","comment":" A reference to a constructor of a custom type.\n\n    Nothing -- Constructor ( ..., [ [ \"maybe\" ] ], [ \"nothing\" ] )\n\n    Foo.Bar -- Constructor ( ..., [ [ \"foo\" ] ], [ \"bar\" ] )\n\n","type":"a -> Morphir.IR.FQName.FQName -> Morphir.IR.Value.Value a"},{"name":"constructorPattern","comment":" Matches on a custom type's constructor.\n\n**Note**: When the custom type has a single constructor this can be used for destructuring.\nWhen there are multiple constructors it also does filtering so it cannot be used in a\n[`LetDestruct`](#letDestruct) but it can be used in a [pattern-match](#patternMatch).\n\n    Just _ -- ConstructorPattern ( ..., [[\"maybe\"]], [\"just\"]) [ WildcardPattern ]\n\n","type":"a -> Morphir.IR.FQName.FQName -> List.List (Morphir.IR.Value.Pattern a) -> Morphir.IR.Value.Pattern a"},{"name":"emptyListPattern","comment":" Matches an empty list. Can be used standalon but frequently used as a terminal pattern\nin a [`HeadTailPattern`](#headTailPattern).\n\n    [] -- EmptyListPattern\n\n    [ _ ]\n    -- HeadTailPattern\n    --     WildcardPattern\n    --     EmptyListPattern\n\n","type":"a -> Morphir.IR.Value.Pattern a"},{"name":"field","comment":" Extracts the value of a record's field.\n\n    a.foo -- Field (Variable [ \"a\" ]) [ \"foo\" ]\n\n","type":"a -> Morphir.IR.Value.Value a -> Morphir.IR.Name.Name -> Morphir.IR.Value.Value a"},{"name":"fieldFunction","comment":" Represents a function that extract a field from a record value passed to it.\n\n    .foo -- FieldFunction [ \"foo\" ]\n\n","type":"a -> Morphir.IR.Name.Name -> Morphir.IR.Value.Value a"},{"name":"floatLiteral","comment":" Represents a floating-point number. Some possible values: `1.25`, `-13.4`\n","type":"Basics.Float -> Morphir.IR.Value.Literal"},{"name":"headTailPattern","comment":" Matches the head and the tail of a list. It can be used to match lists of at least N items\nby nesting this pattern N times and terminating with [`EmptyListPattern`](#emptyListPattern).\n\n    [ a ]\n    -- HeadTailPattern\n    --     (AsPattern WildcardPattern [\"a\"])\n    --     EmptyListPattern\n\n    a :: b\n    -- HeadTailPattern\n    --     (AsPattern WildcardPattern [\"a\"])\n    --     (AsPattern WildcardPattern [\"b\"])\n\n    [ a, b ]\n    -- HeadTailPattern\n    --     (AsPattern WildcardPattern [\"a\"])\n    --     (HeadTailPattern\n    --         (AsPattern WildcardPattern [\"b\"])\n    --         EmptyListPattern\n    --     )\n\n","type":"a -> Morphir.IR.Value.Pattern a -> Morphir.IR.Value.Pattern a -> Morphir.IR.Value.Pattern a"},{"name":"ifThenElse","comment":" Represents and if/then/else expression.\n\n    if a then\n        b\n    else\n        c\n    -- IfThenElse (Variable [\"a\"])\n    --     (Variable [\"b\"])\n    --     (Variable [\"c\"])\n\n","type":"a -> Morphir.IR.Value.Value a -> Morphir.IR.Value.Value a -> Morphir.IR.Value.Value a -> Morphir.IR.Value.Value a"},{"name":"intLiteral","comment":" Represents an integer value. Some possible values: `0`, `-1`, `9832479`\n","type":"Basics.Int -> Morphir.IR.Value.Literal"},{"name":"lambda","comment":" Represents a lambda abstraction.\n\n**Note**:\n\n  - We use currying to represent lambda abstractions with multiple arguments.\n  - Arguments are not just names, they are patterns.\n\n```\n\\a -> a -- Lambda (AsPattern WildcardPattern [ \"a\" ]) (Variable [ \"a\" ])\n\n\\a b -> a -- Lambda (AsPattern WildcardPattern [ \"a\" ]) (Lambda (AsPattern WildcardPattern [ \"b\" ]) (Variable [ \"a\" ]))\n```\n\n","type":"a -> Morphir.IR.Value.Pattern a -> Morphir.IR.Value.Value a -> Morphir.IR.Value.Value a"},{"name":"letDef","comment":" Represents a let expression that assigns a value (and optionally type) to a name.\n\n**Note**: We use currying to represent let expressions with multiple name bindings.\n\n    let\n        a =\n            b\n    in\n    a\n    -- LetDef [ \"a\" ]\n    --     (UntypedDefinition [] (Variable [ \"b\" ]))\n    --     (Variable [ \"a\" ])\n\n    let\n        a : Bool\n        a =\n            b\n\n        c x =\n            a\n    in\n    c\n    -- LetDef [ \"a\" ]\n    --     (TypedDefinition (Basic BoolType) [] (Variable [ \"b\" ]))\n    --     (LetDef [ \"c\" ]\n    --         (UntypedDefinition [ [ \"x\" ] ] (Variable [ \"a\" ]))\n    --         (Variable [ \"c\" ])\n    --     )\n\n","type":"a -> Morphir.IR.Name.Name -> Morphir.IR.Value.Definition a -> Morphir.IR.Value.Value a -> Morphir.IR.Value.Value a"},{"name":"letDestruct","comment":" Represents a let expression that extracts values using a pattern.\n\n    let\n        ( a, b ) =\n            c\n    in\n    a\n    -- LetDestruct\n    --     (TuplePattern [ AsPattern WildcardPattern [\"a\"], AsPattern WildcardPattern [\"b\"] ])\n    --     (Variable [\"a\"])\n\n","type":"a -> Morphir.IR.Value.Pattern a -> Morphir.IR.Value.Value a -> Morphir.IR.Value.Value a -> Morphir.IR.Value.Value a"},{"name":"letRec","comment":" Represents a let expression with one or many recursive definitions.\n\n    let\n        a =\n            b\n\n        b =\n            a\n    in\n    a\n    -- LetRec\n    --     [ ( [ \"a\" ], UntypedDefinition [] (Variable [ \"b\" ]) )\n    --     , ( [ \"b\" ], UntypedDefinition [] (Variable [ \"a\" ]) )\n    --     ]\n    --     (Variable [ \"a\" ])\n\n","type":"a -> Dict.Dict Morphir.IR.Name.Name (Morphir.IR.Value.Definition a) -> Morphir.IR.Value.Value a -> Morphir.IR.Value.Value a"},{"name":"list","comment":" A [list] represents an ordered list of values where every value has to be of the same type.\n\n    [ 1, 3, 5 ] -- List [ Literal (IntLiteral 1), Literal (IntLiteral 3), Literal (IntLiteral 5) ]\n\n    [] -- List []\n\n[list]: https://en.wikipedia.org/wiki/List_(abstract_data_type)\n\n","type":"a -> List.List (Morphir.IR.Value.Value a) -> Morphir.IR.Value.Value a"},{"name":"literal","comment":" A [literal][lit] represents a fixed value in the IR. We only allow values of basic types: bool, char, string, int, float.\n\n    True -- Literal (BoolLiteral True)\n\n    'a' -- Literal (CharLiteral 'a')\n\n    \"foo\" -- Literal (StringLiteral \"foo\")\n\n    13 -- Literal (IntLiteral 13)\n\n    15.4 -- Literal (FloatLiteral 15.4)\n\n[lit]: https://en.wikipedia.org/wiki/Literal_(computer_programming)\n\n","type":"a -> Morphir.IR.Value.Literal -> Morphir.IR.Value.Value a"},{"name":"literalPattern","comment":" Matches a specific literal value. This pattern can only be used in a [pattern-match](#patternMatch)\nsince it always filters.\n\n    True -- LiteralPattern (BoolLiteral True)\n\n    'a' -- LiteralPattern (CharLiteral 'a')\n\n    \"foo\" -- LiteralPattern (StringLiteral \"foo\")\n\n    13 -- LiteralPattern (IntLiteral 13)\n\n    15.4 -- LiteralPattern (FloatLiteral 15.4)\n\n","type":"a -> Morphir.IR.Value.Literal -> Morphir.IR.Value.Pattern a"},{"name":"mapDefinition","comment":" ","type":"(Morphir.IR.Type.Type a -> Result.Result e (Morphir.IR.Type.Type a)) -> (Morphir.IR.Value.Value a -> Result.Result e (Morphir.IR.Value.Value a)) -> Morphir.IR.Value.Definition a -> Result.Result (List.List e) (Morphir.IR.Value.Definition a)"},{"name":"mapDefinitionAttributes","comment":" ","type":"(a -> b) -> Morphir.IR.Value.Definition a -> Morphir.IR.Value.Definition b"},{"name":"mapSpecificationAttributes","comment":" ","type":"(a -> b) -> Morphir.IR.Value.Specification a -> Morphir.IR.Value.Specification b"},{"name":"mapValueAttributes","comment":" ","type":"(a -> b) -> Morphir.IR.Value.Value a -> Morphir.IR.Value.Value b"},{"name":"patternMatch","comment":" Represents a pattern-match.\n\n    case a of\n        1 ->\n            \"yea\"\n\n        _ ->\n            \"nay\"\n    -- PatternMatch (Variable [\"a\"])\n    --     [ ( LiteralPattern (IntLiteral 1), Literal (StringLiteral \"yea\") )\n    --     , ( WildcardPattern, Literal (StringLiteral \"nay\") )\n    --     ]\n\n","type":"a -> Morphir.IR.Value.Value a -> List.List ( Morphir.IR.Value.Pattern a, Morphir.IR.Value.Value a ) -> Morphir.IR.Value.Value a"},{"name":"record","comment":" A [record] represents a list of fields where each field has a name and a value.\n\n    { foo = \"bar\" } -- Record [ ( [ \"foo\" ], Literal (StringLiteral \"bar\") ) ]\n\n    { foo = \"bar\", baz = 1 } -- Record [ ( [ \"foo\" ], Literal (StringLiteral \"bar\") ), ( [ \"baz\" ], Literal (IntLiteral 1) ) ]\n\n    {} -- Record []\n\n[record]: https://en.wikipedia.org/wiki/Record_(computer_science)\n\n","type":"a -> List.List ( Morphir.IR.Name.Name, Morphir.IR.Value.Value a ) -> Morphir.IR.Value.Value a"},{"name":"recordPattern","comment":" Pulls out the values of some fields from a record value.\n\n    { foo, bar } -- RecordPattern [ [\"foo\"], [\"bar\"] ]\n\n","type":"a -> List.List Morphir.IR.Name.Name -> Morphir.IR.Value.Pattern a"},{"name":"reference","comment":" A reference that refers to a function or a value with its fully-qualified name.\n\n    List.map -- Reference ( [ ..., [ [ \"list\" ] ], [ \"map\" ] )\n\n","type":"a -> Morphir.IR.FQName.FQName -> Morphir.IR.Value.Value a"},{"name":"stringLiteral","comment":" Represents a string value. Some possible values: `\"\"`, `\"foo\"`, `\"Bar baz: 123\"`\n","type":"String.String -> Morphir.IR.Value.Literal"},{"name":"tuple","comment":" A [tuple] represents an ordered list of values where each value can be of a different type.\n\n**Note**: Tuples with zero values are considered to be the special value [`Unit`](#unit)\n\n    ( 1, True ) -- Tuple [ Literal (IntLiteral 1), Literal (BoolLiteral True) ]\n\n    ( \"foo\", True, 3 ) -- Tuple [ Literal (StringLiteral \"foo\"), Literal (BoolLiteral True), Literal (IntLiteral 3) ]\n\n    () -- Unit\n\n[tuple]: https://en.wikipedia.org/wiki/Tuple\n\n","type":"a -> List.List (Morphir.IR.Value.Value a) -> Morphir.IR.Value.Value a"},{"name":"tuplePattern","comment":" Destructures a tuple using a pattern for every element.\n\n    ( _, foo ) -- TuplePattern [ WildcardPattern, AsPattern WildcardPattern [\"foo\"] ]\n\n","type":"a -> List.List (Morphir.IR.Value.Pattern a) -> Morphir.IR.Value.Pattern a"},{"name":"typedDefinition","comment":" Typed value or function definition.\n\n**Note**: Elm uses patterns instead of argument names which is flexible but makes it more\ndifficult to understand the model. Since most business models will actually use names which\nis represented as `AsPattern WildcardPattern name` in the IR we will extract those into the\ndefinition. This is a best-efforts process and stops when it runs into a more complex pattern.\nWhen that happens the rest of the argument patterns will be pushed down to the body as lambda\narguments. The examples below try to visualize the process.\n\n    myFun : Int -> Int -> { foo : Int } -> Int\n    myFun a b { foo } =\n        body\n\n    -- the above is logically translated to the below\n    myFun :\n        Int\n        -> Int\n        -> { foo : Int }\n        -> Int -- the value type does not change in the process\n    myFun a b =\n        \\{ foo } ->\n            body\n\n","type":"Morphir.IR.Type.Type a -> List.List ( Morphir.IR.Name.Name, a ) -> Morphir.IR.Value.Value a -> Morphir.IR.Value.Definition a"},{"name":"unit","comment":" Represents the unit value.\n\n    () -- Unit\n\n","type":"a -> Morphir.IR.Value.Value a"},{"name":"untypedDefinition","comment":" Untyped value or function definition.\n\n**Note**: Elm uses patterns instead of argument names which is flexible but makes it more\ndifficult to understand the model. Since most business models will actually use names which\nis represented as `AsPattern WildcardPattern name` in the IR we will extract those into the\ndefinition. This is a best-efforts process and stops when it runs into a more complex pattern.\nWhen that happens the rest of the argument patterns will be pushed down to the body as lambda\narguments. The examples below try to visualize the process.\n\n    myFun a b { foo } =\n        body\n\n    -- the above is logically translated to the below\n    myFun a b =\n        \\{ foo } ->\n            body\n\n","type":"List.List ( Morphir.IR.Name.Name, a ) -> Morphir.IR.Value.Value a -> Morphir.IR.Value.Definition a"},{"name":"update","comment":" Update one or many fields of a record value.\n\n    { a | foo = 1 } -- Update (Variable [\"a\"]) [ ( [\"foo\"], Literal (IntLiteral 1) ) ]\n\n","type":"a -> Morphir.IR.Value.Value a -> List.List ( Morphir.IR.Name.Name, Morphir.IR.Value.Value a ) -> Morphir.IR.Value.Value a"},{"name":"variable","comment":" A [variable] represents a reference to a named value in the scope.\n\n    a -- Variable [ \"a\" ]\n\n    fooBar15 -- Variable [ \"foo\", \"bar\", \"15\" ]\n\n[variable]: https://en.wikipedia.org/wiki/Variable_(computer_science)\n\n","type":"a -> Morphir.IR.Name.Name -> Morphir.IR.Value.Value a"},{"name":"wildcardPattern","comment":" Matches any value and ignores it (assigns no variable name).\n\n    _ -- WildcardPattern\n\n","type":"a -> Morphir.IR.Value.Pattern a"}],"binops":[]},{"name":"Morphir.SDK.StatefulApp","comment":" Utilities for modeling stateful applications.\n\n@docs StatefulApp\n\n","unions":[],"aliases":[{"name":"StatefulApp","comment":" Type that represents a stateful application.\n","args":["k","c","s","e"],"type":"{ businessLogic : k -> Maybe.Maybe s -> c -> ( k, Maybe.Maybe s, e ) }"}],"values":[],"binops":[]}]