This is an alternative site for discovering Elm packages. You may be looking for the official Elm package site instead.
1.0.0
A type-safe 'sprintf' format printer.
version 1.0.0
license BSD3
native-modules False
elm-version 0.17.1 <= v < 0.18.0
Tag 1.0.1
Committed At 2016-10-03 23:28:07 UTC
elm-lang/html 1.1.0 <= v < 2.0.0 1.1.0
elm-lang/core 4.0.5 <= v < 5.0.0 4.0.5

Modules

README

Typed Format

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).

Examples

Here is a formatter that, when applied with 'sprintf', will accept a string output the string hello [X]!

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

and

myMessage : Format a (Char -> Char -> a)
myMessage =
    s "Elm gets me from " <++> char <++> s " to " <++> char

See the examples for more examples.

Installation

elm package install enetsee/typed-format

References

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 corresponding Scanner type.