This library helps you turn data into nicely formatted strings in a type-safe manner.
The API deliberately mirrors url-parser which is based on the same idea (see references).
Here is a formatter that, when applied with 'sprintf', will accept a string output the string
hello : Format a (String -> a) hello = s "hello " <++> string <++> s "!"
You can combined formatters using
<++> to get more complex formatters. For example:
doubleHello : Format a (String -> String -> a) doubleHello = hello <++> hello
myMessage : Format a (Char -> Char -> a) myMessage = s "Elm gets me from " <++> char <++> s " to " <++> char
See the examples for more examples.
elm package install enetsee/typed-format
The library is based on the final representation of the
Printer type from
Oleg Kiselyov's Formatted Printer Parsers
The url-parser library is based on the