formatting 3.1.1 → 3.1.2
raw patch · 2 files changed
+30/−2 lines, 2 filesdep ~base
Dependency ranges changed: base
Files
- formatting.cabal +3/−2
- src/Formatting/Internal.hs +27/−0
formatting.cabal view
@@ -1,5 +1,5 @@ name: formatting-version: 3.1.1+version: 3.1.2 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@@ -17,7 +17,8 @@ Formatting.Formatters, Formatting.ShortFormatters, Formatting.Examples,- Formatting.Time+ Formatting.Time,+ Formatting.Internal build-depends: base >= 4 && < 5, text-format, text,
+ src/Formatting/Internal.hs view
@@ -0,0 +1,27 @@+-- | Internal format starters.++module Formatting.Internal where++import Formatting.Holey++import Data.Text.Lazy (Text)+import Data.Text.Lazy.Builder (Builder)+import qualified Data.Text.Lazy.Builder as T+import qualified Data.Text.Lazy.IO as T+import System.IO++-- | Run the formatter and return a "Text" value.+format :: Holey Builder Text a -> a+format m = runHM m T.toLazyText++-- | Run the formatter and return a "Builder" value.+bprint :: Holey Builder Builder a -> a+bprint m = runHM m id++-- | Run the formatter and print out the text to stdout.+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".+hprint :: Handle -> Holey Builder (IO ()) a -> a+hprint h m = runHM m (T.hPutStr h . T.toLazyText)