eco-pro / project-metadata-utils / Elm.Module

Helpers for working with module name strings in elm.json files.

Modules


type Name

A guaranteed valid Elm module name.

String Conversions

toString : Name -> String

Convert a Name to a String that works in elm.json

fromString : String -> Maybe Name

Try to convert a String into a Name:

fromString "Maybe"       == Just ...
fromString "Elm.Name"  == Just ...
fromString "Json.Decode" == Just ...
fromString "json.decode" == Nothing
fromString "Json_Decode" == Nothing

JSON Conversions

encode : Name -> Json.Encode.Value

Turn a Name into a string for use in elm.json

decoder : Json.Decode.Decoder Name

Decode the module name strings that appear in elm.json