Popularity
3.3
Declining
Activity
0.0
Stable
4
3
1

Monthly Downloads: 12
Programming language: Haskell
License: BSD 3-clause "New" or "Revised" License
Tags: Data    
Latest version: v0.1.2.0

th-format alternatives and similar packages

Based on the "Data" category.
Alternatively, view th-format alternatives based on common mentions on social networks and blogs.

Do you think we are missing an alternative of th-format or a related project?

Add another 'Data' Package

README

th-format Hackage version Stackage version Build Status

About

This is th-format, a Haskell package implementing support for format strings using Template Haskell quasi quoters. It requires the GHC extension QuasiQuotes to be enabled. Parsing is implemented using Earley.

This package is BSD3 licensed.

Examples

Using th-format, you can use naive variable interpolation instead of verbosely concatenating strings manually. Thus, instead of

putStrLn $ "Client \"" ++ show client ++ "\" has requested resource \"" ++ show resource ++ "\" at date " ++ show date ++ "."

one can directly write:

putStrLn $ [fmt|Client "$client" has requested resource "$resource" at date $date|]

There are currently two supported ways of interpolation:

  1. Simple interpolation, as in [fmt|Variable foo contains $foo|].
  2. Expression interpolation, as in [fmt|The toggle is ${if toggle then ("on" :: Text) else "off"}|]


*Note that all licence references and agreements mentioned in the th-format README section above are relevant to that project's source code only.