Easy and type-safe format strings for parsing and printing
|LTS Haskell 20.16:||0.1.0.0|
|Stackage Nightly 2023-03-31:||0.1.0.0|
|Latest on Hackage:||0.1.0.0|
Maintained by email@example.com
This version can be pinned in stack with:
Module documentation for 0.1.0.0
A lightweight library for one-off parsing and printing.
scanf [fmt|%d lazy %s and %d strict %s|] "3 lazy functions and 2 strict fields" = Just (3 :+ "functions" :+ 2 :+ "fields" :+ ())
Quasiquotes are optional. Format strings can also be defined with pure Haskell combinators.
printf (fmt_ (int . " lazy " % string . " and " % int . " strict " % string) (8 :+ "dogs" :+ 9 :+ "cats" :+ ()) = "8 lazy dogs and 9 strict cats"
With quasiquotes, the following conversion strings are supported:
%d: signed integer (
%l: signed integer (
%f: floating point (
%s: string of non-space characters (
%c: single character (
%%: parse/print a literal percent character
scanf, spaces in the format string match any number of whitespace
character until the next nonspace character.
Though it also offers a
printf function, scanf is thus named as
there are only few other preexisting Haskell implementations,
whereas many Haskell printf libraries can already be found on Hackage.
- xformat (scanf and printf)
- fmt (printf)
- formatting (printf)