symbol : String -> Parser ()

Parse symbols like ( and ,. page

symbol : String -> Parser ()

The symbol function has type String -> Parser (). This means it must take in a String argument, and it will definitely return an Parser () value.

run (symbol "[") "[" == Ok () run (symbol "[") "4" == Err ... (ExpectingSymbol "[") ...

Note: This is good for stuff like Brackets and semicolons, but it probably should not be used for binary operators like + and - because you can find yourself in weird situations. For example, is 3--4 a typo? Or is it 3 - -4? I have had better luck with chompWhile isSymbol and sorting out which operator it is afterwards.

~

The empty tuple () is called the Unit type in Elm.

What does () mean? faq : It is the empty tuple or Unit Type. It serves much like void, null, or None in other languages.

> In Haskell, Rust, and Elm, the unit type is called () and its only value is also (), reflecting the 0-tuple interpretation. wikipedia