th-printf 0.2.0.0 → 0.2.0.1
raw patch · 2 files changed
+34/−1 lines, 2 files
Files
- src/Text/Printf/TH.hs +33/−0
- th-printf.cabal +1/−1
src/Text/Printf/TH.hs view
@@ -6,6 +6,11 @@ {-# LANGUAGE TupleSections #-} {-# LANGUAGE QuasiQuotes #-} +-- | A module with behavior as close to realistically possible to+-- C printf, including variadic width and precision specifiers.+--+-- The only thing you don't get with this package is printing pointers+-- (although if you really want this behavior, send a pull request). module Text.Printf.TH (s, st, lt, sb, lb, sP, stP, ltP, sbP, lbP) where import Control.Applicative@@ -68,15 +73,43 @@ s, st, lt, sb, lb, sP, stP, ltP, sbP, lbP :: QuasiQuoter +-- | A formatter that produces a 'String'.+--+-- >>> [s|%s %d %.3f|] "foobar" 10 1.23456+-- "foobar 10 1.235" s = quoterOfType ''String False++-- | A formatter that produces 'T.Text'. See 's'. st = quoterOfType ''T.Text False++-- | A formatter that produces lazy 'LT.Text'. See 's'. lt = quoterOfType ''LT.Text False++-- | A formatter that produces 'B.ByteString'. See 's'. sb = quoterOfType ''B.ByteString False++-- | A formatter that produces lazy 'LB.ByteString'. See 's'. lb = quoterOfType ''LB.ByteString False++-- | A formatter that produces and prints a 'String'.+--+-- >>> [s|%s %d %.3f|] "foobar" 10 1.23456+-- <IO ()>+--+-- This formatter WILL output a newline after the expanded string. If you+-- don't want this behavior, use 's' and 'putStr' the result. sP = quoterOfType ''String True++-- | A formatter that produces and prints 'T.Text'. See 'sP'. stP = quoterOfType ''T.Text True++-- | A formatter that produces and prints lazy 'LT.Text'. See 'sP'. ltP = quoterOfType ''LT.Text True++-- | A formatter that produces and prints 'B.ByteString'. See 'sP'. sbP = quoterOfType ''B.ByteString True++-- | A formatter that produces and prints lazy 'LB.ByteString'. See 'sP'. lbP = quoterOfType ''LB.ByteString True formatP :: Parser [Chunk]
th-printf.cabal view
@@ -2,7 +2,7 @@ -- documentation, see http://haskell.org/cabal/users-guide/ name: th-printf-version: 0.2.0.0+version: 0.2.0.1 synopsis: Compile-time printf description: Quasiquoters for printf: string, bytestring, text. homepage: https://github.com/joelteon/th-printf