Formerly NeoVier/elm-eos. Search finds this package by either name.
A symbol code is usually used in a Symbol, along with a precision.
StringConvert a SymbolCode to a String
fromString "EOS"
|> Result.map toString
--> Ok "EOS"Convert a String into a SymbolCode. A SymbolCode must be
a String of up to 7 characters, all uppercase letters (A-Z).
fromString "Test"
--> Err (InvalidCharacters ( 'e', [ 's', 't' ] ))
fromString "VERYLONG"
--> Err TooLong
fromString "EOS"
|> Result.map toString
--> Ok ("EOS")Converting a String into a SymbolCode (with fromString)
can fail. This type represents all of the possible errors.
fromString "Test"
--> Err (InvalidCharacters ( 'e', [ 's', 't' ] ))
fromString "VERYLONG"
--> Err TooLong
fromString "EOS"
|> Result.map toString
--> Ok ("EOS")You can use this function to convert an Error into a human-readable
String.
Encode a SymbolCode into JSON.
Decode a SymbolCode from JSON. It already does all of the validation necessary to ensure the SymbolCode is valid.
The symbol code is the "name" of the symbol. For example, the symbol
0,ABChas precision0and symbol codeABC.A symbol code is a
Stringof up to 7 characters, consisting of uppercase letters from A-Z.