Morgan-Stanley/morphir-elm/1.1.0

NOTE: the latest version is 3.0.0

Renamed to finos/morphir-elm. It is published under that name, and new versions come out there.

Versions published as Morgan-Stanley/morphir-elm still install under that name. 5 versions of 5 come from the new location (see their notes).

Rerouted (fork, verified). The original repository is gone. This copy comes from a fork that still has the tag. The Lamdera package server serves a copy recovered from https://github.com/maoo/morphir-elm (a fork).

What we checked: Rebuilt with git archive from commit 6ba86f1628e9 of https://github.com/maoo/morphir-elm (a fork) (zip prefix Morgan-Stanley-morphir-elm-0232fee/, America/Los_Angeles times): the zip is byte-identical to the one package.elm-lang.org recorded, SHA-1 5d2dd4431a6f31c5530102e5918acc363dd719e1.

The Lamdera compiler uses this copy and prints a one-line notice saying so. elm itself fails to download this version.

Details · package.elm-lang.org's zip: https://github.com/Morgan-Stanley/morphir-elm/zipball/1.1.0/

Morphir.IR.Path

Path is a list of names that represents a path in the tree. It's used at various places in the IR to identify types and values.

type alias Path =
List Name

Type that represents a path as a list of names.

fromList : List Name -> Path

Converts a list of names to a path.

toList : Path -> List Name

Converts a path to a list of names.

String conversion

fromString : String -> Path

Translates a string into a path by splitting it into names along special characters. The algorithm will treat any non-word charaters that are not spaces as a path separator.

fromString "fooBar.Baz"
--> Path.fromList
-->     [ Name.fromList [ "foo", "bar" ]
-->     , Name.fromList [ "baz" ]
-->     ]


fromString "foo bar/baz"
--> Path.fromList
-->     [ Name.fromList [ "foo", "bar" ]
-->     , Name.fromList [ "baz" ]
-->     ]
toString : (Name -> String) -> String -> Path -> String

Turn a path into a string using the specified naming convention and separator.

path =
    Path.fromList
        [ Name.fromList [ "foo", "bar" ]
        , Name.fromList [ "baz" ]
        ]


toString Name.toTitleCase "." path
--> "FooBar.Baz"


toString Name.toSnakeCase "/" path
--> "foo_bar/baz"

Utilities

isPrefixOf : Path -> Path -> Bool

Checks if a path is a prefix of another.

isPrefixOf [ [ "foo" ], [ "bar" ] ] [ [ "foo" ] ] == True


isPrefixOf [ [ "foo" ] ] [ [ "foo" ], [ "bar" ] ] == False


isPrefixOf [ [ "foo" ], [ "bar" ] ] [ [ "foo" ], [ "bar" ] ] == True