formatting 4.0 → 4.1
raw patch · 4 files changed
+13/−18 lines, 4 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
+ Formatting: sformat :: Holey Builder Text a -> a
+ Formatting.Internal: sformat :: Holey Builder Text a -> a
Files
- formatting.cabal +1/−1
- src/Formatting.hs +1/−0
- src/Formatting/Internal.hs +11/−5
- src/Formatting/Time.hs +0/−12
formatting.cabal view
@@ -1,5 +1,5 @@ name: formatting-version: 4.0+version: 4.1 synopsis: Combinator-based type-safe formatting (like printf() or FORMAT) description: Combinator-based type-safe formatting (like printf() or FORMAT), modelled from the HoleyMonoids package. license: BSD3
src/Formatting.hs view
@@ -23,6 +23,7 @@ ( -- * Top-level functions format,+ sformat, bprint, fprint, hprint,
src/Formatting/Internal.hs view
@@ -4,17 +4,23 @@ import Formatting.Holey -import Data.Text.Lazy (Text)+import qualified Data.Text as S (Text)+import Data.Text.Lazy (Text)+import qualified Data.Text.Lazy as T import Data.Text.Lazy.Builder (Builder) import qualified Data.Text.Lazy.Builder as T-import qualified Data.Text.Lazy.IO as T+import qualified Data.Text.Lazy.IO as T import System.IO --- | Run the formatter and return a "Text" value.+-- | Run the formatter and return a lazy 'Text' value. format :: Holey Builder Text a -> a format m = runHM m T.toLazyText --- | Run the formatter and return a "Builder" value.+-- | Run the formatter and return a strict 'S.Text' value.+sformat :: Holey Builder S.Text a -> a+sformat m = runHM m (T.toStrict . T.toLazyText)++-- | Run the formatter and return a 'Builder' value. bprint :: Holey Builder Builder a -> a bprint m = runHM m id @@ -22,6 +28,6 @@ fprint :: Holey Builder (IO ()) a -> a fprint m = runHM m (T.putStr . T.toLazyText) --- | Run the formatter and put the output onto the given "Handle".+-- | Run the formatter and put the output onto the given 'Handle'. hprint :: Handle -> Holey Builder (IO ()) a -> a hprint h m = runHM m (T.hPutStr h . T.toLazyText)
src/Formatting/Time.hs view
@@ -1,19 +1,7 @@ {-# LANGUAGE RankNTypes #-}-{-# LANGUAGE NoMonomorphismRestriction #-} {-# LANGUAGE OverloadedStrings #-} -- | Formatters for time.------ Example:------ @--- REPL> before <- getCurrentTime--- REPL> after <- getCurrentTime--- REPL> format (hms % \" - \" % hms % \" = \" % diff False) before after (before,after)--- \"19:05:06 - 19:05:08 = 3 seconds\"--- REPL>--- @--- module Formatting.Time where