Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package ghc-formatting for openSUSE:Factory checked in at 2021-04-10 15:27:16 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/ghc-formatting (Old) and /work/SRC/openSUSE:Factory/.ghc-formatting.new.2401 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "ghc-formatting" Sat Apr 10 15:27:16 2021 rev:3 rq:883518 version:7.1.2 Changes: -------- --- /work/SRC/openSUSE:Factory/ghc-formatting/ghc-formatting.changes 2020-12-22 11:39:38.293511086 +0100 +++ /work/SRC/openSUSE:Factory/.ghc-formatting.new.2401/ghc-formatting.changes 2021-04-10 15:28:20.370446368 +0200 @@ -1,0 +2,11 @@ +Mon Apr 5 14:46:17 UTC 2021 - [email protected] + +- Update formatting to version 7.1.2. + 7.1.2 + + * Removed direct dependency on integer-gmp, instead using very similar code from the `text` package. This changed the implementation of `build` for `Integer`, which results in better performance in some cases, and no performance degradation. See the benchmarking reports in bench/reports for more details. + * formatting now compiles on GHCJS (due to the change above). + * Added some benchmarking, starting based on code from the `string-interpolate` package. + * Added INLINE pragmas to many very short functions. Results in better performance in the benchmarks. + +------------------------------------------------------------------- Old: ---- formatting-7.1.1.tar.gz New: ---- formatting-7.1.2.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ ghc-formatting.spec ++++++ --- /var/tmp/diff_new_pack.lb2i0v/_old 2021-04-10 15:28:20.762446829 +0200 +++ /var/tmp/diff_new_pack.lb2i0v/_new 2021-04-10 15:28:20.766446834 +0200 @@ -1,7 +1,7 @@ # # spec file for package ghc-formatting # -# Copyright (c) 2020 SUSE LLC +# Copyright (c) 2021 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -19,7 +19,7 @@ %global pkg_name formatting %bcond_with tests Name: ghc-%{pkg_name} -Version: 7.1.1 +Version: 7.1.2 Release: 0 Summary: Combinator-based type-safe formatting (like printf() or FORMAT) License: BSD-3-Clause @@ -43,8 +43,8 @@ Combinator-based type-safe formatting (like printf() or FORMAT), modelled from the HoleyMonoids package. -See the README at -<https://github.com/AJChapman/formatting/blob/master/README.md> for more info. +See the README at <https://github.com/AJChapman/formatting#readme> for more +info. %package devel Summary: Haskell %{pkg_name} library development files ++++++ formatting-7.1.1.tar.gz -> formatting-7.1.2.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/formatting-7.1.1/CHANGELOG.md new/formatting-7.1.2/CHANGELOG.md --- old/formatting-7.1.1/CHANGELOG.md 2001-09-09 03:46:40.000000000 +0200 +++ new/formatting-7.1.2/CHANGELOG.md 2001-09-09 03:46:40.000000000 +0200 @@ -1,3 +1,10 @@ +7.1.2 + +* Removed direct dependency on integer-gmp, instead using very similar code from the `text` package. This changed the implementation of `build` for `Integer`, which results in better performance in some cases, and no performance degradation. See the benchmarking reports in bench/reports for more details. +* formatting now compiles on GHCJS (due to the change above). +* Added some benchmarking, starting based on code from the `string-interpolate` package. +* Added INLINE pragmas to many very short functions. Results in better performance in the benchmarks. + 7.1.1 * Added `charsKeptIf` and `charsRemovedIf`. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/formatting-7.1.1/README.md new/formatting-7.1.2/README.md --- old/formatting-7.1.1/README.md 2001-09-09 03:46:40.000000000 +0200 +++ new/formatting-7.1.2/README.md 2001-09-09 03:46:40.000000000 +0200 @@ -129,6 +129,8 @@ | `a` | `"one two three "` | `"[one, two, three]"` | [`worded`] `list text` | | `a` | `"one\n\ntwo\nthree\n\n` | `"["one", "", "two", "three", ""]"` | [`lined`] `qlist text` | | `a` | `123456` | `"654321"` | [`alteredWith`] `TL.reverse int` | +| `a` | `"Data.Char.isUpper` | `"DCU"` | [`charsKeptIf`] `isUpper string` | +| `a` | `"Data.Char.isUpper` | `"ata.har.ispper"` | [`charsRemovedIf`] `isUpper string` | | `a` | `"look and boot"` | `"leek and beet"` | [`replaced`] `"oo" "ee" text` | | `a` | `"look and boot"` | `"LOOK AND BOOT"` | [`uppercased`] | | `a` | `"Look and Boot"` | `"look and boot"` | [`lowercased`] | @@ -514,117 +516,141 @@ "Nope!" ``` -[`format`]: https://hackage.haskell.org/package/formatting-7.1.0/docs/Formatting.html#v:format -[`sformat`]: https://hackage.haskell.org/package/formatting-7.1.0/docs/Formatting.html#v:sformat -[`bformat`]: https://hackage.haskell.org/package/formatting-7.1.0/docs/Formatting.html#v:bformat -[`formatToString`]: https://hackage.haskell.org/package/formatting-7.1.0/docs/Formatting.html#v:formatToString -[`fprint`]: https://hackage.haskell.org/package/formatting-7.1.0/docs/Formatting.html#v:fprint -[`fprintLn`]: https://hackage.haskell.org/package/formatting-7.1.0/docs/Formatting.html#v:fprintLn -[`hprint`]: https://hackage.haskell.org/package/formatting-7.1.0/docs/Formatting.html#v:hprint -[`hprintLn`]: https://hackage.haskell.org/package/formatting-7.1.0/docs/Formatting.html#v:hprintLn - -[`text`]: https://hackage.haskell.org/package/formatting-7.1.0/docs/Formatting-Formatters.html#v:text -[`stext`]: https://hackage.haskell.org/package/formatting-7.1.0/docs/Formatting-Formatters.html#v:stext -[`string`]: https://hackage.haskell.org/package/formatting-7.1.0/docs/Formatting-Formatters.html#v:string -[`builder`]: https://hackage.haskell.org/package/formatting-7.1.0/docs/Formatting-Formatters.html#v:builder -[`shown`]: https://hackage.haskell.org/package/formatting-7.1.0/docs/Formatting-Formatters.html#v:shown -[`char`]: https://hackage.haskell.org/package/formatting-7.1.0/docs/Formatting-Formatters.html#v:char -[`int`]: https://hackage.haskell.org/package/formatting-7.1.0/docs/Formatting-Formatters.html#v:int -[`float`]: https://hackage.haskell.org/package/formatting-7.1.0/docs/Formatting-Formatters.html#v:float -[`fixed`]: https://hackage.haskell.org/package/formatting-7.1.0/docs/Formatting-Formatters.html#v:fixed -[`sci`]: https://hackage.haskell.org/package/formatting-7.1.0/docs/Formatting-Formatters.html#v:sci -[`scifmt`]: https://hackage.haskell.org/package/formatting-7.1.0/docs/Formatting-Formatters.html#v:scifmt -[`groupInt`]: https://hackage.haskell.org/package/formatting-7.1.0/docs/Formatting-Formatters.html#v:groupInt -[`commas`]: https://hackage.haskell.org/package/formatting-7.1.0/docs/Formatting-Formatters.html#v:commas -[`ords`]: https://hackage.haskell.org/package/formatting-7.1.0/docs/Formatting-Formatters.html#v:ords -[`plural`]: https://hackage.haskell.org/package/formatting-7.1.0/docs/Formatting-Formatters.html#v:plural -[`asInt`]: https://hackage.haskell.org/package/formatting-7.1.0/docs/Formatting-Formatters.html#v:asInt -[`bin`]: https://hackage.haskell.org/package/formatting-7.1.0/docs/Formatting-Formatters.html#v:bin -[`prefixBin`]: https://hackage.haskell.org/package/formatting-7.1.0/docs/Formatting-Formatters.html#v:prefixBin -[`oct`]: https://hackage.haskell.org/package/formatting-7.1.0/docs/Formatting-Formatters.html#v:oct -[`prefixOct`]: https://hackage.haskell.org/package/formatting-7.1.0/docs/Formatting-Formatters.html#v:prefixOct -[`hex`]: https://hackage.haskell.org/package/formatting-7.1.0/docs/Formatting-Formatters.html#v:hex -[`prefixHex`]: https://hackage.haskell.org/package/formatting-7.1.0/docs/Formatting-Formatters.html#v:prefixHex -[`base`]: https://hackage.haskell.org/package/formatting-7.1.0/docs/Formatting-Formatters.html#v:base -[`left`]: https://hackage.haskell.org/package/formatting-7.1.0/docs/Formatting-Formatters.html#v:left -[`right`]: https://hackage.haskell.org/package/formatting-7.1.0/docs/Formatting-Formatters.html#v:right -[`center`]: https://hackage.haskell.org/package/formatting-7.1.0/docs/Formatting-Formatters.html#v:center -[`fitLeft`]: https://hackage.haskell.org/package/formatting-7.1.0/docs/Formatting-Formatters.html#v:fitLeft -[`fitRight`]: https://hackage.haskell.org/package/formatting-7.1.0/docs/Formatting-Formatters.html#v:fitRight -[`build`]: https://hackage.haskell.org/package/formatting-7.1.0/docs/Formatting-Formatters.html#v:build -[`fconst`]: https://hackage.haskell.org/package/formatting-7.1.0/docs/Formatting-Formatters.html#v:fconst -[`bytes`]: https://hackage.haskell.org/package/formatting-7.1.0/docs/Formatting-Formatters.html#v:bytes - -[`t`]: https://hackage.haskell.org/package/formatting-7.1.0/docs/Formatting-ShortFormatters.html#v:t -[`st`]: https://hackage.haskell.org/package/formatting-7.1.0/docs/Formatting-ShortFormatters.html#v:st -[`s`]: https://hackage.haskell.org/package/formatting-7.1.0/docs/Formatting-ShortFormatters.html#v:s -[`sh`]: https://hackage.haskell.org/package/formatting-7.1.0/docs/Formatting-ShortFormatters.html#v:sh -[`c`]: https://hackage.haskell.org/package/formatting-7.1.0/docs/Formatting-ShortFormatters.html#v:c -[`d`]: https://hackage.haskell.org/package/formatting-7.1.0/docs/Formatting-ShortFormatters.html#v:d -[`sf`]: https://hackage.haskell.org/package/formatting-7.1.0/docs/Formatting-ShortFormatters.html#v:sf -[`f`]: https://hackage.haskell.org/package/formatting-7.1.0/docs/Formatting-ShortFormatters.html#v:f -[`b`]: https://hackage.haskell.org/package/formatting-7.1.0/docs/Formatting-ShortFormatters.html#v:b -[`o`]: https://hackage.haskell.org/package/formatting-7.1.0/docs/Formatting-ShortFormatters.html#v:o -[`x`]: https://hackage.haskell.org/package/formatting-7.1.0/docs/Formatting-ShortFormatters.html#v:x -[`l`]: https://hackage.haskell.org/package/formatting-7.1.0/docs/Formatting-ShortFormatters.html#v:l -[`r`]: https://hackage.haskell.org/package/formatting-7.1.0/docs/Formatting-ShortFormatters.html#v:r - -[`maybed`]: https://hackage.haskell.org/package/formatting-7.1.0/docs/Formatting.html#v:maybed -[`optioned`]: https://hackage.haskell.org/package/formatting-7.1.0/docs/Formatting.html#v:optioned -[`eithered`]: https://hackage.haskell.org/package/formatting-7.1.0/docs/Formatting.html#v:eithered -[`lefted`]: https://hackage.haskell.org/package/formatting-7.1.0/docs/Formatting.html#v:lefted -[`righted`]: https://hackage.haskell.org/package/formatting-7.1.0/docs/Formatting.html#v:righted -[`concatenated`]: https://hackage.haskell.org/package/formatting-7.1.0/docs/Formatting.html#v:concatenated -[`joinedWith`]: https://hackage.haskell.org/package/formatting-7.1.0/docs/Formatting-Combinators.html#v:joinedWith -[`intercalated`]: https://hackage.haskell.org/package/formatting-7.1.0/docs/Formatting-Combinators.html#v:intercalated -[`unworded`]: https://hackage.haskell.org/package/formatting-7.1.0/docs/Formatting-Combinators.html#v:unworded -[`unlined`]: https://hackage.haskell.org/package/formatting-7.1.0/docs/Formatting-Combinators.html#v:unlined -[`spaced`]: https://hackage.haskell.org/package/formatting-7.1.0/docs/Formatting-Combinators.html#v:spaced -[`commaSep`]: https://hackage.haskell.org/package/formatting-7.1.0/docs/Formatting-Combinators.html#v:commaSep -[`commaSpaceSep`]: https://hackage.haskell.org/package/formatting-7.1.0/docs/Formatting-Combinators.html#v:commaSpaceSep -[`list`]: https://hackage.haskell.org/package/formatting-7.1.0/docs/Formatting-Combinators.html#v:list -[`qlist`]: https://hackage.haskell.org/package/formatting-7.1.0/docs/Formatting-Combinators.html#v:qlist -[`took`]: https://hackage.haskell.org/package/formatting-7.1.0/docs/Formatting-Combinators.html#v:took -[`dropped`]: https://hackage.haskell.org/package/formatting-7.1.0/docs/Formatting-Combinators.html#v:dropped -[`splat`]: https://hackage.haskell.org/package/formatting-7.1.0/docs/Formatting-Combinators.html#v:splat -[`splatWith`]: https://hackage.haskell.org/package/formatting-7.1.0/docs/Formatting-Combinators.html#v:splatWith -[`splatOn`]: https://hackage.haskell.org/package/formatting-7.1.0/docs/Formatting-Combinators.html#v:splatOn -[`worded`]: https://hackage.haskell.org/package/formatting-7.1.0/docs/Formatting-Combinators.html#v:worded -[`lined`]: https://hackage.haskell.org/package/formatting-7.1.0/docs/Formatting-Combinators.html#v:lined -[`alteredWith`]: https://hackage.haskell.org/package/formatting-7.1.0/docs/Formatting-Combinators.html#v:alteredWith -[`replaced`]: https://hackage.haskell.org/package/formatting-7.1.0/docs/Formatting-Combinators.html#v:replaced -[`uppercased`]: https://hackage.haskell.org/package/formatting-7.1.0/docs/Formatting-Combinators.html#v:uppercased -[`lowercased`]: https://hackage.haskell.org/package/formatting-7.1.0/docs/Formatting-Combinators.html#v:lowercased -[`titlecased`]: https://hackage.haskell.org/package/formatting-7.1.0/docs/Formatting-Combinators.html#v:titlecased -[`ltruncated`]: https://hackage.haskell.org/package/formatting-7.1.0/docs/Formatting-Combinators.html#v:ltruncated -[`ctruncated`]: https://hackage.haskell.org/package/formatting-7.1.0/docs/Formatting-Combinators.html#v:ctruncated -[`rtruncated`]: https://hackage.haskell.org/package/formatting-7.1.0/docs/Formatting-Combinators.html#v:rtruncated -[`lpadded`]: https://hackage.haskell.org/package/formatting-7.1.0/docs/Formatting-Combinators.html#v:lpadded -[`rpadded`]: https://hackage.haskell.org/package/formatting-7.1.0/docs/Formatting-Combinators.html#v:rpadded -[`cpadded`]: https://hackage.haskell.org/package/formatting-7.1.0/docs/Formatting-Combinators.html#v:cpadded -[`lfixed`]: https://hackage.haskell.org/package/formatting-7.1.0/docs/Formatting-Combinators.html#v:lfixed -[`rfixed`]: https://hackage.haskell.org/package/formatting-7.1.0/docs/Formatting-Combinators.html#v:rfixed -[`cfixed`]: https://hackage.haskell.org/package/formatting-7.1.0/docs/Formatting-Combinators.html#v:cfixed -[`prefixed`]: https://hackage.haskell.org/package/formatting-7.1.0/docs/Formatting-Combinators.html#v:prefixed -[`suffixed`]: https://hackage.haskell.org/package/formatting-7.1.0/docs/Formatting-Combinators.html#v:suffixed -[`surrounded`]: https://hackage.haskell.org/package/formatting-7.1.0/docs/Formatting-Combinators.html#v:surrounded -[`enclosed`]: https://hackage.haskell.org/package/formatting-7.1.0/docs/Formatting-Combinators.html#v:enclosed -[`squoted`]: https://hackage.haskell.org/package/formatting-7.1.0/docs/Formatting-Combinators.html#v:squoted -[`dquoted`]: https://hackage.haskell.org/package/formatting-7.1.0/docs/Formatting-Combinators.html#v:dquoted -[`parenthesised`]: https://hackage.haskell.org/package/formatting-7.1.0/docs/Formatting-Combinators.html#v:parenthesised -[`squared`]: https://hackage.haskell.org/package/formatting-7.1.0/docs/Formatting-Combinators.html#v:squared -[`braced`]: https://hackage.haskell.org/package/formatting-7.1.0/docs/Formatting-Combinators.html#v:braced -[`angled`]: https://hackage.haskell.org/package/formatting-7.1.0/docs/Formatting-Combinators.html#v:angled -[`backticked`]: https://hackage.haskell.org/package/formatting-7.1.0/docs/Formatting-Combinators.html#v:backticked -[`indented`]: https://hackage.haskell.org/package/formatting-7.1.0/docs/Formatting-Combinators.html#v:indented -[`indentedLines`]: https://hackage.haskell.org/package/formatting-7.1.0/docs/Formatting-Combinators.html#v:indentedLines -[`reindented`]: https://hackage.haskell.org/package/formatting-7.1.0/docs/Formatting-Combinators.html#v:reindented -[`roundedTo`]: https://hackage.haskell.org/package/formatting-7.1.0/docs/Formatting-Combinators.html#v:roundedTo -[`truncatedTo`]: https://hackage.haskell.org/package/formatting-7.1.0/docs/Formatting-Combinators.html#v:truncatedTo -[`ceilingedTo`]: https://hackage.haskell.org/package/formatting-7.1.0/docs/Formatting-Combinators.html#v:ceilingedTo -[`flooredTo`]: https://hackage.haskell.org/package/formatting-7.1.0/docs/Formatting-Combinators.html#v:flooredTo -[`viewed`]: https://hackage.haskell.org/package/formatting-7.1.0/docs/Formatting-Combinators.html#v:viewed -[`accessed`]: https://hackage.haskell.org/package/formatting-7.1.0/docs/Formatting-Combinators.html#v:accessed -[`binPrefix`]: https://hackage.haskell.org/package/formatting-7.1.0/docs/Formatting-Combinators.html#v:binPrefix -[`octPrefix`]: https://hackage.haskell.org/package/formatting-7.1.0/docs/Formatting-Combinators.html#v:octPrefix -[`hexPrefix`]: https://hackage.haskell.org/package/formatting-7.1.0/docs/Formatting-Combinators.html#v:hexPrefix +## Hacking + +### Building with Nix + +See [README-nix.md](./README-nix.md). + +### Running the Tests + +From within your `nix-shell`, run `cabal test`. + +The tests are in `test/Spec.hs`. + +### Running the Benchmarks + +Start `nix-shell` like this: `nix-shell --arg doBenchmark true`. +From within your `nix-shell`, run `cabal bench`. + +To build the html benchmarking reports, run `cabal bench --benchmark-option=-obench/reports/7.2.0.html > bench/reports/7.2.0.txt`, replacing '7.2.0' with the current version. +This will output the file `bench.html` which you can open in a browser. + +The benchmarks are in `bench/bench.hs`. + +[`format`]: https://hackage.haskell.org/package/formatting-7.1.1/docs/Formatting.html#v:format +[`sformat`]: https://hackage.haskell.org/package/formatting-7.1.1/docs/Formatting.html#v:sformat +[`bformat`]: https://hackage.haskell.org/package/formatting-7.1.1/docs/Formatting.html#v:bformat +[`formatToString`]: https://hackage.haskell.org/package/formatting-7.1.1/docs/Formatting.html#v:formatToString +[`fprint`]: https://hackage.haskell.org/package/formatting-7.1.1/docs/Formatting.html#v:fprint +[`fprintLn`]: https://hackage.haskell.org/package/formatting-7.1.1/docs/Formatting.html#v:fprintLn +[`hprint`]: https://hackage.haskell.org/package/formatting-7.1.1/docs/Formatting.html#v:hprint +[`hprintLn`]: https://hackage.haskell.org/package/formatting-7.1.1/docs/Formatting.html#v:hprintLn + +[`text`]: https://hackage.haskell.org/package/formatting-7.1.1/docs/Formatting-Formatters.html#v:text +[`stext`]: https://hackage.haskell.org/package/formatting-7.1.1/docs/Formatting-Formatters.html#v:stext +[`string`]: https://hackage.haskell.org/package/formatting-7.1.1/docs/Formatting-Formatters.html#v:string +[`builder`]: https://hackage.haskell.org/package/formatting-7.1.1/docs/Formatting-Formatters.html#v:builder +[`shown`]: https://hackage.haskell.org/package/formatting-7.1.1/docs/Formatting-Formatters.html#v:shown +[`char`]: https://hackage.haskell.org/package/formatting-7.1.1/docs/Formatting-Formatters.html#v:char +[`int`]: https://hackage.haskell.org/package/formatting-7.1.1/docs/Formatting-Formatters.html#v:int +[`float`]: https://hackage.haskell.org/package/formatting-7.1.1/docs/Formatting-Formatters.html#v:float +[`fixed`]: https://hackage.haskell.org/package/formatting-7.1.1/docs/Formatting-Formatters.html#v:fixed +[`sci`]: https://hackage.haskell.org/package/formatting-7.1.1/docs/Formatting-Formatters.html#v:sci +[`scifmt`]: https://hackage.haskell.org/package/formatting-7.1.1/docs/Formatting-Formatters.html#v:scifmt +[`groupInt`]: https://hackage.haskell.org/package/formatting-7.1.1/docs/Formatting-Formatters.html#v:groupInt +[`commas`]: https://hackage.haskell.org/package/formatting-7.1.1/docs/Formatting-Formatters.html#v:commas +[`ords`]: https://hackage.haskell.org/package/formatting-7.1.1/docs/Formatting-Formatters.html#v:ords +[`plural`]: https://hackage.haskell.org/package/formatting-7.1.1/docs/Formatting-Formatters.html#v:plural +[`asInt`]: https://hackage.haskell.org/package/formatting-7.1.1/docs/Formatting-Formatters.html#v:asInt +[`bin`]: https://hackage.haskell.org/package/formatting-7.1.1/docs/Formatting-Formatters.html#v:bin +[`prefixBin`]: https://hackage.haskell.org/package/formatting-7.1.1/docs/Formatting-Formatters.html#v:prefixBin +[`oct`]: https://hackage.haskell.org/package/formatting-7.1.1/docs/Formatting-Formatters.html#v:oct +[`prefixOct`]: https://hackage.haskell.org/package/formatting-7.1.1/docs/Formatting-Formatters.html#v:prefixOct +[`hex`]: https://hackage.haskell.org/package/formatting-7.1.1/docs/Formatting-Formatters.html#v:hex +[`prefixHex`]: https://hackage.haskell.org/package/formatting-7.1.1/docs/Formatting-Formatters.html#v:prefixHex +[`base`]: https://hackage.haskell.org/package/formatting-7.1.1/docs/Formatting-Formatters.html#v:base +[`left`]: https://hackage.haskell.org/package/formatting-7.1.1/docs/Formatting-Formatters.html#v:left +[`right`]: https://hackage.haskell.org/package/formatting-7.1.1/docs/Formatting-Formatters.html#v:right +[`center`]: https://hackage.haskell.org/package/formatting-7.1.1/docs/Formatting-Formatters.html#v:center +[`fitLeft`]: https://hackage.haskell.org/package/formatting-7.1.1/docs/Formatting-Formatters.html#v:fitLeft +[`fitRight`]: https://hackage.haskell.org/package/formatting-7.1.1/docs/Formatting-Formatters.html#v:fitRight +[`build`]: https://hackage.haskell.org/package/formatting-7.1.1/docs/Formatting-Formatters.html#v:build +[`fconst`]: https://hackage.haskell.org/package/formatting-7.1.1/docs/Formatting-Formatters.html#v:fconst +[`bytes`]: https://hackage.haskell.org/package/formatting-7.1.1/docs/Formatting-Formatters.html#v:bytes + +[`t`]: https://hackage.haskell.org/package/formatting-7.1.1/docs/Formatting-ShortFormatters.html#v:t +[`st`]: https://hackage.haskell.org/package/formatting-7.1.1/docs/Formatting-ShortFormatters.html#v:st +[`s`]: https://hackage.haskell.org/package/formatting-7.1.1/docs/Formatting-ShortFormatters.html#v:s +[`sh`]: https://hackage.haskell.org/package/formatting-7.1.1/docs/Formatting-ShortFormatters.html#v:sh +[`c`]: https://hackage.haskell.org/package/formatting-7.1.1/docs/Formatting-ShortFormatters.html#v:c +[`d`]: https://hackage.haskell.org/package/formatting-7.1.1/docs/Formatting-ShortFormatters.html#v:d +[`sf`]: https://hackage.haskell.org/package/formatting-7.1.1/docs/Formatting-ShortFormatters.html#v:sf +[`f`]: https://hackage.haskell.org/package/formatting-7.1.1/docs/Formatting-ShortFormatters.html#v:f +[`b`]: https://hackage.haskell.org/package/formatting-7.1.1/docs/Formatting-ShortFormatters.html#v:b +[`o`]: https://hackage.haskell.org/package/formatting-7.1.1/docs/Formatting-ShortFormatters.html#v:o +[`x`]: https://hackage.haskell.org/package/formatting-7.1.1/docs/Formatting-ShortFormatters.html#v:x +[`l`]: https://hackage.haskell.org/package/formatting-7.1.1/docs/Formatting-ShortFormatters.html#v:l +[`r`]: https://hackage.haskell.org/package/formatting-7.1.1/docs/Formatting-ShortFormatters.html#v:r + +[`maybed`]: https://hackage.haskell.org/package/formatting-7.1.1/docs/Formatting.html#v:maybed +[`optioned`]: https://hackage.haskell.org/package/formatting-7.1.1/docs/Formatting.html#v:optioned +[`eithered`]: https://hackage.haskell.org/package/formatting-7.1.1/docs/Formatting.html#v:eithered +[`lefted`]: https://hackage.haskell.org/package/formatting-7.1.1/docs/Formatting.html#v:lefted +[`righted`]: https://hackage.haskell.org/package/formatting-7.1.1/docs/Formatting.html#v:righted +[`concatenated`]: https://hackage.haskell.org/package/formatting-7.1.1/docs/Formatting.html#v:concatenated +[`joinedWith`]: https://hackage.haskell.org/package/formatting-7.1.1/docs/Formatting-Combinators.html#v:joinedWith +[`intercalated`]: https://hackage.haskell.org/package/formatting-7.1.1/docs/Formatting-Combinators.html#v:intercalated +[`unworded`]: https://hackage.haskell.org/package/formatting-7.1.1/docs/Formatting-Combinators.html#v:unworded +[`unlined`]: https://hackage.haskell.org/package/formatting-7.1.1/docs/Formatting-Combinators.html#v:unlined +[`spaced`]: https://hackage.haskell.org/package/formatting-7.1.1/docs/Formatting-Combinators.html#v:spaced +[`commaSep`]: https://hackage.haskell.org/package/formatting-7.1.1/docs/Formatting-Combinators.html#v:commaSep +[`commaSpaceSep`]: https://hackage.haskell.org/package/formatting-7.1.1/docs/Formatting-Combinators.html#v:commaSpaceSep +[`list`]: https://hackage.haskell.org/package/formatting-7.1.1/docs/Formatting-Combinators.html#v:list +[`qlist`]: https://hackage.haskell.org/package/formatting-7.1.1/docs/Formatting-Combinators.html#v:qlist +[`took`]: https://hackage.haskell.org/package/formatting-7.1.1/docs/Formatting-Combinators.html#v:took +[`dropped`]: https://hackage.haskell.org/package/formatting-7.1.1/docs/Formatting-Combinators.html#v:dropped +[`splat`]: https://hackage.haskell.org/package/formatting-7.1.1/docs/Formatting-Combinators.html#v:splat +[`splatWith`]: https://hackage.haskell.org/package/formatting-7.1.1/docs/Formatting-Combinators.html#v:splatWith +[`splatOn`]: https://hackage.haskell.org/package/formatting-7.1.1/docs/Formatting-Combinators.html#v:splatOn +[`worded`]: https://hackage.haskell.org/package/formatting-7.1.1/docs/Formatting-Combinators.html#v:worded +[`lined`]: https://hackage.haskell.org/package/formatting-7.1.1/docs/Formatting-Combinators.html#v:lined +[`alteredWith`]: https://hackage.haskell.org/package/formatting-7.1.1/docs/Formatting-Combinators.html#v:alteredWith +[`charsKeptIf`]: https://hackage.haskell.org/package/formatting-7.1.1/docs/Formatting-Combinators.html#v:charsKeptIf +[`charsRemovedIf`]: https://hackage.haskell.org/package/formatting-7.1.1/docs/Formatting-Combinators.html#vata.har.isppercharsRemovedIf +[`replaced`]: https://hackage.haskell.org/package/formatting-7.1.1/docs/Formatting-Combinators.html#v:replaced +[`uppercased`]: https://hackage.haskell.org/package/formatting-7.1.1/docs/Formatting-Combinators.html#v:uppercased +[`lowercased`]: https://hackage.haskell.org/package/formatting-7.1.1/docs/Formatting-Combinators.html#v:lowercased +[`titlecased`]: https://hackage.haskell.org/package/formatting-7.1.1/docs/Formatting-Combinators.html#v:titlecased +[`ltruncated`]: https://hackage.haskell.org/package/formatting-7.1.1/docs/Formatting-Combinators.html#v:ltruncated +[`ctruncated`]: https://hackage.haskell.org/package/formatting-7.1.1/docs/Formatting-Combinators.html#v:ctruncated +[`rtruncated`]: https://hackage.haskell.org/package/formatting-7.1.1/docs/Formatting-Combinators.html#v:rtruncated +[`lpadded`]: https://hackage.haskell.org/package/formatting-7.1.1/docs/Formatting-Combinators.html#v:lpadded +[`rpadded`]: https://hackage.haskell.org/package/formatting-7.1.1/docs/Formatting-Combinators.html#v:rpadded +[`cpadded`]: https://hackage.haskell.org/package/formatting-7.1.1/docs/Formatting-Combinators.html#v:cpadded +[`lfixed`]: https://hackage.haskell.org/package/formatting-7.1.1/docs/Formatting-Combinators.html#v:lfixed +[`rfixed`]: https://hackage.haskell.org/package/formatting-7.1.1/docs/Formatting-Combinators.html#v:rfixed +[`cfixed`]: https://hackage.haskell.org/package/formatting-7.1.1/docs/Formatting-Combinators.html#v:cfixed +[`prefixed`]: https://hackage.haskell.org/package/formatting-7.1.1/docs/Formatting-Combinators.html#v:prefixed +[`suffixed`]: https://hackage.haskell.org/package/formatting-7.1.1/docs/Formatting-Combinators.html#v:suffixed +[`surrounded`]: https://hackage.haskell.org/package/formatting-7.1.1/docs/Formatting-Combinators.html#v:surrounded +[`enclosed`]: https://hackage.haskell.org/package/formatting-7.1.1/docs/Formatting-Combinators.html#v:enclosed +[`squoted`]: https://hackage.haskell.org/package/formatting-7.1.1/docs/Formatting-Combinators.html#v:squoted +[`dquoted`]: https://hackage.haskell.org/package/formatting-7.1.1/docs/Formatting-Combinators.html#v:dquoted +[`parenthesised`]: https://hackage.haskell.org/package/formatting-7.1.1/docs/Formatting-Combinators.html#v:parenthesised +[`squared`]: https://hackage.haskell.org/package/formatting-7.1.1/docs/Formatting-Combinators.html#v:squared +[`braced`]: https://hackage.haskell.org/package/formatting-7.1.1/docs/Formatting-Combinators.html#v:braced +[`angled`]: https://hackage.haskell.org/package/formatting-7.1.1/docs/Formatting-Combinators.html#v:angled +[`backticked`]: https://hackage.haskell.org/package/formatting-7.1.1/docs/Formatting-Combinators.html#v:backticked +[`indented`]: https://hackage.haskell.org/package/formatting-7.1.1/docs/Formatting-Combinators.html#v:indented +[`indentedLines`]: https://hackage.haskell.org/package/formatting-7.1.1/docs/Formatting-Combinators.html#v:indentedLines +[`reindented`]: https://hackage.haskell.org/package/formatting-7.1.1/docs/Formatting-Combinators.html#v:reindented +[`roundedTo`]: https://hackage.haskell.org/package/formatting-7.1.1/docs/Formatting-Combinators.html#v:roundedTo +[`truncatedTo`]: https://hackage.haskell.org/package/formatting-7.1.1/docs/Formatting-Combinators.html#v:truncatedTo +[`ceilingedTo`]: https://hackage.haskell.org/package/formatting-7.1.1/docs/Formatting-Combinators.html#v:ceilingedTo +[`flooredTo`]: https://hackage.haskell.org/package/formatting-7.1.1/docs/Formatting-Combinators.html#v:flooredTo +[`viewed`]: https://hackage.haskell.org/package/formatting-7.1.1/docs/Formatting-Combinators.html#v:viewed +[`accessed`]: https://hackage.haskell.org/package/formatting-7.1.1/docs/Formatting-Combinators.html#v:accessed +[`binPrefix`]: https://hackage.haskell.org/package/formatting-7.1.1/docs/Formatting-Combinators.html#v:binPrefix +[`octPrefix`]: https://hackage.haskell.org/package/formatting-7.1.1/docs/Formatting-Combinators.html#v:octPrefix +[`hexPrefix`]: https://hackage.haskell.org/package/formatting-7.1.1/docs/Formatting-Combinators.html#v:hexPrefix diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/formatting-7.1.1/bench/bench.hs new/formatting-7.1.2/bench/bench.hs --- old/formatting-7.1.1/bench/bench.hs 1970-01-01 01:00:00.000000000 +0100 +++ new/formatting-7.1.2/bench/bench.hs 2001-09-09 03:46:40.000000000 +0200 @@ -0,0 +1,75 @@ +{-# LANGUAGE OverloadedStrings #-} +{-# LANGUAGE RankNTypes #-} +{-# LANGUAGE TypeApplications #-} + +import Criterion (bench, bgroup, env, nf, whnf) +import Criterion.Main (defaultMain) +import Test.QuickCheck + +import qualified Data.Text as T +import qualified Data.Text.Lazy as LT + +import Formatting ((%)) +import qualified Formatting as F +import qualified Formatting.ShortFormatters as F + +-- From string-interpolate's benchmarks + +stringF :: String -> String +stringF = F.formatToString ("A fine day to die, " % F.s % ".") + +multiStringF :: (Int, String, Bool) -> String +multiStringF (x, y, z) = + F.formatToString (" foo " % F.d % " bar " % F.s % " baz " % F.sh % " quux ") x y z + +textF :: T.Text -> T.Text +textF = F.sformat ("A fine day to die, " % F.st % ".") + +multiTextF :: (Int, T.Text, Bool) -> T.Text +multiTextF (x, y, z) = + F.sformat (" foo " % F.d % " bar " % F.st % " baz " % F.sh % " quux ") x y z + +lazyTextF :: LT.Text -> LT.Text +lazyTextF = F.format ("A find day to die, " % F.t % ".") + +multiLazyTextF :: (Int, LT.Text, Bool) -> LT.Text +multiLazyTextF (x, y, z) = + F.format (" foo " % F.d % " bar " % F.t % " baz " % F.sh % " quux ") x y z + +integerF :: Integer -> LT.Text +integerF = F.format F.int + +buildF :: F.Buildable a => a -> LT.Text +buildF = F.format F.build + +main :: IO () +main = defaultMain + [ bench "Small Strings" $ nf stringF "William" + , bench "Small Text" $ nf textF "William" + , bench "Small Lazy Text" $ nf lazyTextF "William" + , bench "Multiple Interpolations String" $ nf multiStringF (42, "CATALLAXY", True) + , bench "Multiple Interpolations Text" $ nf multiTextF (42, "CATALLAXY", True) + , bench "Multiple Interpolations Lazy Text" $ nf multiLazyTextF (42, "CATALLAXY", True) + , env largeishText $ \ ~t -> + bench "Largeish Text" $ nf textF t + , env largeishLazyText $ \ ~lt -> + bench "Largeish Lazy Text" $ nf lazyTextF lt + , bgroup "Integers" $ + (\n -> bench (show n) $ whnf integerF n) <$> integersToTest + , bgroup "Buildable (Integer)" $ + (\n -> bench (show n) $ whnf buildF n) <$> integersToTest + ] + where + integersToTest :: [Integer] + integersToTest = [0, 1, -1, 10, -10, 99, -99, 100, 123, 12345678, maxIntInteger, -maxIntInteger, maxIntInteger * 2] + + maxIntInteger :: Integer + maxIntInteger = fromIntegral (maxBound @Int) + +largeishText :: IO T.Text +largeishText = + generate $ T.pack . Prelude.take 100000 <$> infiniteListOf arbitrary + +largeishLazyText :: IO LT.Text +largeishLazyText = + generate $ LT.pack . Prelude.take 100000 <$> infiniteListOf arbitrary diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/formatting-7.1.1/formatting.cabal new/formatting-7.1.2/formatting.cabal --- old/formatting-7.1.1/formatting.cabal 2001-09-09 03:46:40.000000000 +0200 +++ new/formatting-7.1.2/formatting.cabal 2001-09-09 03:46:40.000000000 +0200 @@ -1,10 +1,10 @@ cabal-version: 2.4 name: formatting -version: 7.1.1 +version: 7.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. . - See the README at <https://github.com/AJChapman/formatting/blob/master/README.md> for more info. + See the README at <https://github.com/AJChapman/formatting#readme> for more info. homepage: https://github.com/AJChapman/formatting#readme bug-reports: https://github.com/AJChapman/formatting/issues license: BSD-3-Clause @@ -20,19 +20,13 @@ , GHC == 8.6.5 , GHC == 8.8.3 , GHC == 8.10.1 + , GHC == 9.0.1 common deps build-depends: base >= 4.11 && < 5, text >= 0.11.0.8, - time >= 1.5, - old-locale, - scientific >= 0.3.0.0, - clock >= 0.4, ghc-prim, - transformers, - integer-gmp >= 0.2, - double-conversion ^>= 2.0.2.0 -- Warnings list list taken from -- https://medium.com/mercury-bank/enable-all-the-warnings-a0517bc081c3 @@ -54,11 +48,17 @@ if impl(ghc >= 8.10) ghc-options: -Wno-prepositive-qualified-module -Wno-missing-safe-haskell-mode - cpp-options: -DINTEGER_GMP library import: deps - + hs-source-dirs: src + build-depends: + clock >= 0.4, + double-conversion ^>= 2.0.2.0, + old-locale, + scientific >= 0.3.0.0, + time >= 1.5, + transformers, exposed-modules: Formatting Formatting.Formatters @@ -70,23 +70,27 @@ Formatting.Internal Formatting.Internal.Raw Formatting.Buildable - other-modules: Data.Text.Format.Functions Data.Text.Format.Types Data.Text.Format - Data.Text.Format.Int - - hs-source-dirs: src test-suite formatting-test import: deps - build-depends: formatting, hspec + build-depends: formatting, hspec, scientific type: exitcode-stdio-1.0 hs-source-dirs: test main-is: Spec.hs ghc-options: -threaded -rtsopts -with-rtsopts=-N +benchmark bench + import: deps + type: exitcode-stdio-1.0 + hs-source-dirs: bench + main-is: bench.hs + build-depends: formatting, criterion, QuickCheck + ghc-options: -O2 + source-repository head type: git location: http://github.com/AJChapman/formatting diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/formatting-7.1.1/src/Data/Text/Format/Int.hs new/formatting-7.1.2/src/Data/Text/Format/Int.hs --- old/formatting-7.1.1/src/Data/Text/Format/Int.hs 2001-09-09 03:46:40.000000000 +0200 +++ new/formatting-7.1.2/src/Data/Text/Format/Int.hs 1970-01-01 01:00:00.000000000 +0100 @@ -1,155 +0,0 @@ -{-# LANGUAGE BangPatterns, CPP, MagicHash, UnboxedTuples, ScopedTypeVariables #-} - --- Module: Data.Text.Format.Int --- Copyright: (c) 2011 MailRank, Inc. --- License: BSD3 --- Maintainer: Bryan O'Sullivan <[email protected]> --- Stability: experimental --- Portability: portable --- --- Efficiently serialize an integral value to a 'Builder'. - -module Data.Text.Format.Int - ( - decimal - , integer - , hexadecimal - , minus - ) where - -import Data.Int (Int8, Int16, Int32, Int64) -import Data.Text.Format.Functions (i2d) -import qualified Data.Text.Format.Functions as F ((<>)) -import Data.Text.Lazy.Builder -import Data.Word (Word8, Word16, Word32, Word64) -import GHC.Base (quotInt, remInt) -import GHC.Integer.GMP.Internals -import GHC.Types (Int(..)) - -#ifdef INTEGER_GMP -# define PAIR(a,b) (# a,b #) -#else -# define PAIR(a,b) (a,b) -#endif - -decimal :: forall a. (Integral a, Bounded a) => a -> Builder -{-# SPECIALIZE decimal :: Int -> Builder #-} -{-# SPECIALIZE decimal :: Int8 -> Builder #-} -{-# SPECIALIZE decimal :: Int16 -> Builder #-} -{-# SPECIALIZE decimal :: Int32 -> Builder #-} -{-# SPECIALIZE decimal :: Int64 -> Builder #-} -{-# SPECIALIZE decimal :: Word -> Builder #-} -{-# SPECIALIZE decimal :: Word8 -> Builder #-} -{-# SPECIALIZE decimal :: Word16 -> Builder #-} -{-# SPECIALIZE decimal :: Word32 -> Builder #-} -{-# SPECIALIZE decimal :: Word64 -> Builder #-} -{-# RULES "decimal/Integer" decimal = integer 10 :: Integer -> Builder #-} -decimal i - | (minBound :: a) < 0 && i == minBound = - -- special case, since (-i) would not be representable assuming two's - -- compliment: - minus F.<> integer 10 (negate $ fromIntegral i) - | i < 0 = minus F.<> go (-i) - | otherwise = go i - where - go n | n < 10 = digit n - | otherwise = go (n `quot` 10) F.<> digit (n `rem` 10) -{-# NOINLINE[0] decimal #-} - -hexadecimal :: Integral a => a -> Builder -{-# SPECIALIZE hexadecimal :: Int -> Builder #-} -{-# SPECIALIZE hexadecimal :: Int8 -> Builder #-} -{-# SPECIALIZE hexadecimal :: Int16 -> Builder #-} -{-# SPECIALIZE hexadecimal :: Int32 -> Builder #-} -{-# SPECIALIZE hexadecimal :: Int64 -> Builder #-} -{-# SPECIALIZE hexadecimal :: Word -> Builder #-} -{-# SPECIALIZE hexadecimal :: Word8 -> Builder #-} -{-# SPECIALIZE hexadecimal :: Word16 -> Builder #-} -{-# SPECIALIZE hexadecimal :: Word32 -> Builder #-} -{-# SPECIALIZE hexadecimal :: Word64 -> Builder #-} -{-# RULES "hexadecimal/Integer" hexadecimal = integer 16 :: Integer -> Builder #-} -hexadecimal i - | i < 0 = minus F.<> go (-i) - | otherwise = go i - where - go n | n < 16 = hexDigit n - | otherwise = go (n `quot` 16) F.<> hexDigit (n `rem` 16) -{-# NOINLINE[0] hexadecimal #-} - -digit :: Integral a => a -> Builder -digit n = singleton $! i2d (fromIntegral n) -{-# INLINE digit #-} - -hexDigit :: Integral a => a -> Builder -hexDigit n - | n <= 9 = singleton $! i2d (fromIntegral n) - | otherwise = singleton $! toEnum (fromIntegral n + 87) -{-# INLINE hexDigit #-} - -minus :: Builder -minus = singleton '-' - -int :: Int -> Builder -int = decimal -{-# INLINE int #-} - -data T = T !Integer !Int - -integer :: Int -> Integer -> Builder -integer 10 (S# i#) = decimal (I# i#) -integer 16 (S# i#) = hexadecimal (I# i#) -integer base i - | i < 0 = minus F.<> go (-i) - | otherwise = go i - where - go n | n < maxInt = int (fromInteger n) - | otherwise = putH (splitf (maxInt * maxInt) n) - - splitf p n - | p > n = [n] - | otherwise = splith p (splitf (p*p) n) - - splith p (n:ns) = case n `quotRemInteger` p of - PAIR(q,r) | q > 0 -> q : r : splitb p ns - | otherwise -> r : splitb p ns - splith _ _ = error "splith: the impossible happened." - - splitb p (n:ns) = case n `quotRemInteger` p of - PAIR(q,r) -> q : r : splitb p ns - splitb _ _ = [] - - T maxInt10 maxDigits10 = - until ((>mi) . (*10) . fstT) (\(T n d) -> T (n*10) (d+1)) (T 10 1) - where mi = fromIntegral (maxBound :: Int) - T maxInt16 maxDigits16 = - until ((>mi) . (*16) . fstT) (\(T n d) -> T (n*16) (d+1)) (T 16 1) - where mi = fromIntegral (maxBound :: Int) - - fstT (T a _) = a - - maxInt | base == 10 = maxInt10 - | otherwise = maxInt16 - maxDigits | base == 10 = maxDigits10 - | otherwise = maxDigits16 - - putH (n:ns) = case n `quotRemInteger` maxInt of - PAIR(x,y) - | q > 0 -> int q F.<> pblock r F.<> putB ns - | otherwise -> int r F.<> putB ns - where q = fromInteger x - r = fromInteger y - putH _ = error "putH: the impossible happened" - - putB (n:ns) = case n `quotRemInteger` maxInt of - PAIR(x,y) -> pblock q F.<> pblock r F.<> putB ns - where q = fromInteger x - r = fromInteger y - putB _ = mempty - - pblock = loop maxDigits - where - loop !d !n - | d == 1 = digit n - | otherwise = loop (d-1) q F.<> digit r - where q = n `quotInt` base - r = n `remInt` base diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/formatting-7.1.1/src/Data/Text/Format/Types.hs new/formatting-7.1.2/src/Data/Text/Format/Types.hs --- old/formatting-7.1.1/src/Data/Text/Format/Types.hs 2001-09-09 03:46:40.000000000 +0200 +++ new/formatting-7.1.2/src/Data/Text/Format/Types.hs 2001-09-09 03:46:40.000000000 +0200 @@ -1,4 +1,4 @@ -{-# LANGUAGE DeriveDataTypeable, GeneralizedNewtypeDeriving #-} +{-# LANGUAGE GeneralizedNewtypeDeriving #-} -- | -- Module : Data.Text.Format.Types.Internal diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/formatting-7.1.1/src/Data/Text/Format.hs new/formatting-7.1.2/src/Data/Text/Format.hs --- old/formatting-7.1.1/src/Data/Text/Format.hs 2001-09-09 03:46:40.000000000 +0200 +++ new/formatting-7.1.2/src/Data/Text/Format.hs 2001-09-09 03:46:40.000000000 +0200 @@ -1,4 +1,4 @@ -{-# LANGUAGE OverloadedStrings, RelaxedPolyRec #-} +{-# LANGUAGE RelaxedPolyRec #-} -- | -- Module : Data.Text.Format diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/formatting-7.1.1/src/Formatting/Buildable.hs new/formatting-7.1.2/src/Formatting/Buildable.hs --- old/formatting-7.1.1/src/Formatting/Buildable.hs 2001-09-09 03:46:40.000000000 +0200 +++ new/formatting-7.1.2/src/Formatting/Buildable.hs 2001-09-09 03:46:40.000000000 +0200 @@ -21,7 +21,7 @@ import Data.List (intersperse) import Data.Ratio (Ratio, denominator, numerator) import qualified Data.Text.Format.Functions as F ((<>)) -import Data.Text.Format.Int (decimal, hexadecimal, integer) +import Data.Text.Lazy.Builder.Int (decimal, hexadecimal) import Data.Text.Format.Types (Hex(..), Shown(..)) import Data.Text.Lazy.Builder import Data.Time.Calendar (Day, showGregorian) @@ -84,7 +84,7 @@ {-# INLINE build #-} instance Buildable Integer where - build = integer 10 + build = decimal {-# INLINE build #-} instance (HasResolution a) => Buildable (Fixed a) where diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/formatting-7.1.1/src/Formatting/Combinators.hs new/formatting-7.1.2/src/Formatting/Combinators.hs --- old/formatting-7.1.1/src/Formatting/Combinators.hs 2001-09-09 03:46:40.000000000 +0200 +++ new/formatting-7.1.2/src/Formatting/Combinators.hs 2001-09-09 03:46:40.000000000 +0200 @@ -16,7 +16,7 @@ Implementation detail: in order to be able to chain multiple combinators to make a single 'Format' we need them all to use the same intermediate string type, and we have chosen 'Builder'. This does not tie you to using 'Builder's, because the final output string type 'r' is still polymorphic. -|-} +-} module Formatting.Combinators ( -- * Formatting common containers @@ -125,6 +125,7 @@ maybed whenNothing f = later $ \case Nothing -> whenNothing Just x -> bformat f x +{-# INLINE maybed #-} -- | Render the value in a Maybe using the given formatter, or produce an empty string: -- @@ -135,6 +136,7 @@ -- "Hello" optioned :: Format Builder (a -> Builder) -> Format r (Maybe a -> r) optioned = maybed "" +{-# INLINE optioned #-} -- | Render the value in an Either: -- @@ -150,6 +152,7 @@ eithered l r = later $ \case Left x -> bformat l x Right x -> bformat r x +{-# INLINE eithered #-} -- | Render the value in a Left with the given formatter, rendering a Right as an empty string: -- @@ -160,6 +163,7 @@ -- "" lefted :: Format Builder (a -> Builder) -> Format r (Either a x -> r) lefted f = eithered f (fconst "") +{-# INLINE lefted #-} -- | Render the value in a Right with the given formatter, rendering a Left as an empty string: -- @@ -170,6 +174,7 @@ -- "bingo" righted :: Format Builder (a -> Builder) -> Format r (Either x a -> r) righted = eithered (fconst "") +{-# INLINE righted #-} -- | Format each value in a list and concatenate them all: -- @@ -180,6 +185,7 @@ -- "1101110010111011110001001101010111100110111101111" concatenated :: Foldable t => Format Builder (a -> Builder) -> Format r (t a -> r) concatenated f = later $ foldMap (bformat f) +{-# INLINE concatenated #-} -- | Use the given text-joining function to join together the individually rendered items of a list. -- @@ -190,6 +196,7 @@ >>> fmap (bformat f >>> TLB.toLazyText) >>> joiner >>> TLB.fromLazyText +{-# INLINABLE joinedWith #-} -- | Format each value in a list and place the given string between each: -- @@ -197,6 +204,7 @@ -- 1||2||3 intercalated :: Foldable t => Text -> Format Builder (a -> Builder) -> Format r (t a -> r) intercalated s = joinedWith (TL.intercalate s) +{-# INLINE intercalated #-} -- | Format each value in a list with spaces in between: -- @@ -204,6 +212,7 @@ -- "1 2 3" unworded :: Foldable t => Format Builder (a -> Builder) -> Format r (t a -> r) unworded = joinedWith TL.unwords +{-# INLINE unworded #-} -- | Format each value in a list, placing each on its own line: -- @@ -213,6 +222,7 @@ -- c unlined :: Foldable t => Format Builder (a -> Builder) -> Format r (t a -> r) unlined = joinedWith TL.unlines +{-# INLINE unlined #-} -- | Separate the formatted items of the Foldable (e.g. list) with spaces: -- @@ -222,6 +232,7 @@ -- Note that this behaviour is identical to 'unworded', it's just a different way of thinking about it. spaced :: Foldable t => Format Builder (a -> Builder) -> Format r (t a -> r) spaced = intercalated " " +{-# INLINE spaced #-} -- | Separate the formatted items of the Foldable (e.g. list) with commas: -- @@ -232,6 +243,7 @@ -- "1,2,3,4,5" commaSep :: Foldable t => Format Builder (a -> Builder) -> Format r (t a -> r) commaSep = intercalated "," +{-# INLINE commaSep #-} -- | Separate the formatted items of the Foldable (e.g. list) with commas and spaces: -- @@ -239,6 +251,7 @@ -- "1st, 2nd, 3rd" commaSpaceSep :: Foldable t => Format Builder (a -> Builder) -> Format r (t a -> r) commaSpaceSep = intercalated ", " +{-# INLINE commaSpaceSep #-} -- | Add square brackets around the Foldable (e.g. a list), and separate each formatted item with a comma and space. -- @@ -249,6 +262,7 @@ -- "[\"one\", \"two\", \"three\"]" list :: Foldable t => Format Builder (a -> Builder) -> Format r (t a -> r) list = commaSpaceSep >>> squared +{-# INLINE list #-} -- | Like 'list', but also put double quotes around each rendered item: -- @@ -256,6 +270,7 @@ -- ["one", "two", "three"] qlist :: Foldable t => Format Builder (a -> Builder) -> Format r (t a -> r) qlist = dquoted >>> commaSpaceSep >>> squared +{-# INLINE qlist #-} -- | Take only the first n items from the list of items. -- @@ -266,6 +281,7 @@ -- "[1, 10, 11, 100, 101, 110, 111]" took :: Int -> Format r ([a] -> r) -> Format r ([a] -> r) took n = fmap (. take n) +{-# INLINE took #-} -- | Drop the first n items from the list of items. -- @@ -273,6 +289,7 @@ -- "[4, 5, 6]" dropped :: Int -> Format r ([a] -> r) -> Format r ([a] -> r) dropped n = fmap (. drop n) +{-# INLINE dropped #-} -- | Utility for taking a text-splitting function and turning it into a formatting combinator. -- @@ -288,6 +305,7 @@ >>> fmap TLB.fromLazyText >>> bformat (lf builder)) %. f +{-# INLINABLE splatWith #-} -- | Split the formatted item in places the given predicated matches, and use the given list combinator to render the resultant list of strings -- (this function was sent to us from a parallel universe in which splat is the past participle of split, e.g. "whoops, I splat my pants"). @@ -300,6 +318,7 @@ -> Format r a -- ^ The base formatter, whose rendered text will be split -> Format r a splat p = splatWith (TL.split p) +{-# INLINE splat #-} -- | Split the formatted item at instances of the given string, and use the given list combinator to render the resultant list of strings. -- @@ -318,6 +337,7 @@ -> Format r a -- ^ The base formatter, whose rendered text will be split -> Format r a splatOn t = splatWith (TL.splitOn t) +{-# INLINE splatOn #-} -- | Split the formatted item into words and use the given list combinator to render the resultant list of strings. -- @@ -328,6 +348,7 @@ -> Format r a -- ^ The base formatter, whose rendered text will be split -> Format r a worded = splatWith TL.words +{-# INLINE worded #-} -- | Split the formatted item into lines and use the given list combinator to render the resultant list of strings. -- @@ -338,6 +359,7 @@ -> Format r a -- ^ The base formatter, whose rendered text will be split -> Format r a lined = splatWith TL.lines +{-# INLINE lined #-} -- | Alter the formatted string with the given function. -- @@ -346,6 +368,7 @@ alteredWith :: (Text -> Text) -> Format r a -> Format r a alteredWith alterer f = later (TLB.toLazyText >>> alterer >>> TLB.fromLazyText) %. f +{-# INLINABLE alteredWith #-} -- | Filter the formatted string to contain only characters which pass the given predicate: -- @@ -353,6 +376,7 @@ -- "DCU" charsKeptIf :: (Char -> Bool) -> Format r a -> Format r a charsKeptIf p = alteredWith (TL.filter p) +{-# INLINE charsKeptIf #-} -- | Filter the formatted string to not contain characters which pass the given predicate: -- @@ -360,6 +384,7 @@ -- "ata.har.ispper" charsRemovedIf :: (Char -> Bool) -> Format r a -> Format r a charsRemovedIf p = alteredWith (TL.filter (not . p)) +{-# INLINE charsRemovedIf #-} -- | Take a formatter and replace the given needle with the given replacement in its output. -- @@ -367,6 +392,7 @@ -- "<redacted> replied that <redacted>'s name was, in fact, '<redacted>'." replaced :: Text -> Text -> Format r a -> Format r a replaced needle replacement = alteredWith (TL.replace needle replacement) +{-# INLINE replaced #-} -- | Convert any letters in the output of the given formatter to upper-case. -- @@ -374,6 +400,7 @@ -- "I'M NOT SHOUTING, YOU'RE SHOUTING." uppercased :: Format r a -> Format r a uppercased = alteredWith TL.toUpper +{-# INLINE uppercased #-} -- | Convert any letters in the output of the given formatter to lower-case. -- @@ -381,6 +408,7 @@ -- "cd src/; rm -rf *" lowercased :: Format r a -> Format r a lowercased = alteredWith TL.toLower +{-# INLINE lowercased #-} -- | Convert the formatted string to title case, or something like it: -- @@ -388,6 +416,7 @@ -- "The Life Of Brian" titlecased :: Format r a -> Format r a titlecased = alteredWith TL.toTitle +{-# INLINE titlecased #-} -- | Truncate the formatted string at the end so that it is no more than the given number of characters in length, placing an ellipsis at the end such that it does not exceed this length. -- @@ -398,6 +427,7 @@ -- "he..." ltruncated :: Int64 -> Format r a -> Format r a ltruncated n = ctruncated (n - 3) 0 +{-# INLINE ltruncated #-} -- | Truncate the formatted string at the start so that it is no more than the given number of characters in length, placing an ellipsis at the start such that it does not exceed this length. -- @@ -408,6 +438,7 @@ -- "...os" rtruncated :: Int64 -> Format r a -> Format r a rtruncated n = ctruncated 0 (n - 3) +{-# INLINE rtruncated #-} -- | Truncate the formatted string in the center, leaving the given number of characters at the start and end, and placing an ellipsis in between. -- The length will be no longer than `start + end + 3` characters long. @@ -426,6 +457,7 @@ in if TL.length txt <= n then txt else TL.take start txt <> "..." <> TL.takeEnd end txt +{-# INLINABLE ctruncated #-} -- | Pad the formatted string on the left with the given character to give it the given minimum width: -- @@ -436,6 +468,7 @@ -- "123456789" lpadded :: Int64 -> Char -> Format r (a -> r) -> Format r (a -> r) lpadded i c = alteredWith (TL.justifyRight i c) +{-# INLINE lpadded #-} -- | Pad the formatted string on the right with the given character to give it the given minimum width: -- @@ -443,6 +476,7 @@ -- "1 " rpadded :: Int64 -> Char -> Format r (a -> r) -> Format r (a -> r) rpadded i c = alteredWith (TL.justifyLeft i c) +{-# INLINE rpadded #-} -- | Pad the formatted string on the left and right with the given character to center it, giving it the given minimum width: -- @@ -450,6 +484,7 @@ -- " 1 " cpadded :: Int64 -> Char -> Format r (a -> r) -> Format r (a -> r) cpadded i c = alteredWith (TL.center i c) +{-# INLINE cpadded #-} -- | Format the item with a fixed width, padding with the given character on the left to extend, adding an ellipsis on the right to shorten: -- @@ -463,6 +498,7 @@ -- "1234567..." lfixed :: Int64 -> Char -> Format r (a -> r) -> Format r (a -> r) lfixed n c = ltruncated n . rpadded n c +{-# INLINE lfixed #-} -- | Format the item with a fixed width, padding with the given character on the right to extend, adding an ellipsis on the right to shorten: -- @@ -476,6 +512,7 @@ -- "...9012345" rfixed :: Int64 -> Char -> Format r (a -> r) -> Format r (a -> r) rfixed n c = rtruncated n . lpadded n c +{-# INLINE rfixed #-} -- | Format the item with a fixed width, padding with the given character on either side to extend, adding an ellipsis in the center to shorten. -- @@ -491,6 +528,7 @@ -- "1234...345" cfixed :: Int64 -> Int64 -> Char -> Format r (a -> r) -> Format r (a -> r) cfixed l r c = ctruncated l r . cpadded (l + r + 3) c +{-# INLINE cfixed #-} -- | Add the given prefix to the formatted item: -- @@ -503,10 +541,12 @@ -- - 3 prefixed :: Builder -> Format r a -> Format r a prefixed s f = now s % f +{-# INLINE prefixed #-} -- | Add the given suffix to the formatted item. suffixed :: Builder -> Format r a -> Format r a suffixed s f = f % now s +{-# INLINE suffixed #-} -- | Surround the output string with the given string: -- @@ -514,6 +554,7 @@ -- "***glue***" surrounded :: Builder -> Format r a -> Format r a surrounded s f = now s % f % now s +{-# INLINE surrounded #-} -- | Enclose the output string with the given strings: -- @@ -521,6 +562,7 @@ -- "<!--an html comment-->" enclosed :: Builder -> Builder -> Format r a -> Format r a enclosed pre suf f = now pre % f % now suf +{-# INLINE enclosed #-} -- | Add single quotes around the formatted item: -- @@ -528,6 +570,7 @@ -- "The object is: 'Just Nothing'." squoted :: Format r a -> Format r a squoted = surrounded "'" +{-# INLINE squoted #-} -- | Add double quotes around the formatted item: -- @@ -535,6 +578,7 @@ -- He said it was based on "science". dquoted :: Format r a -> Format r a dquoted = surrounded "\"" +{-# INLINE dquoted #-} -- | Add parentheses around the formatted item: -- @@ -545,6 +589,7 @@ -- [(1), (2), (3), (4), (5)] parenthesised :: Format r a -> Format r a parenthesised = enclosed "(" ")" +{-# INLINE parenthesised #-} -- | Add square brackets around the formatted item: -- @@ -552,6 +597,7 @@ -- "[7]" squared :: Format r a -> Format r a squared = enclosed "[" "]" +{-# INLINE squared #-} -- | Add curly brackets around the formatted item: -- @@ -559,6 +605,7 @@ -- "\\begin{section}" braced :: Format r a -> Format r a braced = enclosed "{" "}" +{-# INLINE braced #-} -- | Add angle brackets around the formatted item: -- @@ -569,6 +616,7 @@ -- "[<html>, <head>, <title>, <body>, <div>, <span>]" angled :: Format r a -> Format r a angled = enclosed "<" ">" +{-# INLINE angled #-} -- | Add backticks around the formatted item: -- @@ -576,6 +624,7 @@ -- "Be sure to run `:(){:|:&};:` as root." backticked :: Format r a -> Format r a backticked = surrounded "`" +{-# INLINE backticked #-} -- | Insert the given number of spaces at the start of the rendered text: -- @@ -588,6 +637,7 @@ indented n = prefixed spaces where spaces = TL.replicate (fromIntegral n) (TL.singleton ' ') & TLB.fromLazyText +{-# INLINABLE indented #-} -- | Format a list of items, placing one per line, indented by the given number of spaces. -- @@ -599,6 +649,7 @@ -- 42 indentedLines :: Foldable t => Int -> Format Builder (a -> Builder) -> Format r (t a -> r) indentedLines n = unlined . indented n +{-# INLINE indentedLines #-} -- | Indent each line of the formatted string by the given number of spaces: -- @@ -608,6 +659,7 @@ -- three reindented :: Int -> Format r a -> Format r a reindented n = lined (indentedLines n) +{-# INLINE reindented #-} -- | Take a fractional number and round it before formatting it as the given Format: -- @@ -623,6 +675,7 @@ -- @ roundedTo :: (Integral i, RealFrac d, Functor f) => f (i -> r) -> f (d -> r) roundedTo = fmap (. round) +{-# INLINE roundedTo #-} -- | Take a fractional number and truncate it before formatting it as the given Format: -- @@ -638,6 +691,7 @@ -- @ truncatedTo :: (Integral i, RealFrac d, Functor f) => f (i -> r) -> f (d -> r) truncatedTo = fmap (. truncate) +{-# INLINE truncatedTo #-} -- | Take a fractional number and ceiling it before formatting it as the given Format: -- @@ -653,6 +707,7 @@ -- @ ceilingedTo :: (Integral i, RealFrac d, Functor f) => f (i -> r) -> f (d -> r) ceilingedTo = fmap (. ceiling) +{-# INLINE ceilingedTo #-} -- | Take a fractional number and floor it before formatting it as the given Format: -- @@ -668,6 +723,7 @@ -- @ flooredTo :: (Integral i, RealFrac d, Functor f) => f (i -> r) -> f (d -> r) flooredTo = fmap (. floor) +{-# INLINE flooredTo #-} -- | Use the given lens to view an item, formatting it with the given formatter. -- @@ -697,6 +753,7 @@ -- @ viewed :: ((a -> Const a b) -> s -> Const a t) -> Format r (a -> r) -> Format r (s -> r) viewed l = fmap (. (getConst . l Const)) +{-# INLINE viewed #-} -- | Access an element of the structure and format it with the given formatter. -- @@ -709,6 +766,7 @@ -- "The person's name is 'Alex', and their age is 38" accessed :: (s -> a) -> Format r (a -> r) -> Format r (s -> r) accessed accessor = fmap (. accessor) +{-# INLINE accessed #-} -- | Render an integer using binary notation with a leading 0b, padding with zeroes to the given width: -- @@ -716,6 +774,7 @@ -- "0b0001000000000001" binPrefix :: Integral a => Int64 -> Format r (a -> r) binPrefix n = "0b" % lpadded n '0' bin +{-# INLINE binPrefix #-} -- | Render an integer using octal notation with a leading 0o, padding with zeroes to the given width: -- @@ -723,6 +782,7 @@ -- "0o0000000000010001" octPrefix :: Integral a => Int64 -> Format r (a -> r) octPrefix n = "0o" % lpadded n '0' oct +{-# INLINE octPrefix #-} -- | Render an integer using octal notation with a leading 0x, padding with zeroes to the given width: -- @@ -730,3 +790,4 @@ -- "0x0000000000001001" hexPrefix :: Integral a => Int64 -> Format r (a -> r) hexPrefix n = "0x" % lpadded n '0' hex +{-# INLINE hexPrefix #-} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/formatting-7.1.1/src/Formatting/Formatters.hs new/formatting-7.1.2/src/Formatting/Formatters.hs --- old/formatting-7.1.1/src/Formatting/Formatters.hs 2001-09-09 03:46:40.000000000 +0200 +++ new/formatting-7.1.2/src/Formatting/Formatters.hs 2001-09-09 03:46:40.000000000 +0200 @@ -71,14 +71,17 @@ -- | Output a lazy text. text :: Format r (Text -> r) text = later T.fromLazyText +{-# INLINE text #-} -- | Output a strict text. stext :: Format r (S.Text -> r) stext = later T.fromText +{-# INLINE stext #-} -- | Output a string. string :: Format r (String -> r) string = later (T.fromText . T.pack) +{-# INLINE string #-} -- | Output a showable value (instance of 'Show') by turning it into -- 'Text': @@ -87,49 +90,60 @@ -- "Value number 42 is False." shown :: Show a => Format r (a -> r) shown = later (T.fromText . T.pack . show) +{-# INLINE shown #-} -- | Output a character. char :: Format r (Char -> r) char = later B.build +{-# INLINE char #-} -- | Build a builder. builder :: Format r (Builder -> r) builder = later id +{-# INLINE builder #-} -- | Like `const` but for formatters. fconst :: Builder -> Format r (a -> r) fconst m = later (const m) +{-# INLINE fconst #-} -- | Build anything that implements the "Buildable" class. build :: Buildable a => Format r (a -> r) build = later B.build +{-# INLINE build #-} -- | Render an integral e.g. 123 -> \"123\", 0 -> \"0\". int :: Integral a => Format r (a -> r) int = base 10 +{-# INLINE int #-} -- | Render some floating point with the usual notation, e.g. 123.32 => \"123.32\" float :: Real a => Format r (a -> r) float = later T.shortest +{-# INLINE float #-} -- | Render a floating point number using normal notation, with the -- given number of decimal places. fixed :: Real a => Int -> Format r (a -> r) fixed i = later (T.fixed i) +{-# INLINE fixed #-} -- | Render a floating point number using the smallest number of -- digits that correctly represent it. Note that in the case of whole -- numbers it will still add one decimal place, e.g. "1.0". shortest :: Real a => Format r (a -> r) shortest = later T.shortest +{-# INLINE shortest #-} -- | Render a scientific number. sci :: Format r (Scientific -> r) sci = later scientificBuilder +{-# INLINE sci #-} -- | Render a scientific number with options. scifmt :: FPFormat -> Maybe Int -> Format r (Scientific -> r) scifmt f i = later (formatScientificBuilder f i) +{-# INLINE scifmt #-} -- | Shows the Int value of Enum instances using 'fromEnum'. -- @@ -137,16 +151,19 @@ -- "Got: a (97)" asInt :: Enum a => Format r (a -> r) asInt = later (T.shortest . fromEnum) +{-# INLINE asInt #-} -- | Pad the left hand side of a string until it reaches k characters -- wide, if necessary filling with character c. left :: Buildable a => Int -> Char -> Format r (a -> r) left i c = later (T.left i c) +{-# INLINE left #-} -- | Pad the right hand side of a string until it reaches k characters -- wide, if necessary filling with character c. right :: Buildable a => Int -> Char -> Format r (a -> r) right i c = later (T.right i c) +{-# INLINE right #-} -- | Pad the left & right hand side of a string until it reaches k characters -- wide, if necessary filling with character c. @@ -192,6 +209,7 @@ -- | Add commas to an integral, e.g 12000 -> \ "12,000". commas :: (Buildable n,Integral n) => Format r (n -> r) commas = groupInt 3 ',' +{-# INLINE commas #-} -- | Add a suffix to an integral, e.g. 1st, 2nd, 3rd, 21st. ords :: Integral n => Format r (n -> r) @@ -223,6 +241,7 @@ -- | Render an integral at base n. base :: Integral a => Int -> Format r (a -> r) base numBase = later (B.build . atBase numBase) +{-# INLINE base #-} -- | Render an integer using binary notation. (No leading 0b is -- added.) Defined as @bin = 'base' 2@. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/formatting-7.1.1/src/Formatting/Internal/Raw.hs new/formatting-7.1.2/src/Formatting/Internal/Raw.hs --- old/formatting-7.1.1/src/Formatting/Internal/Raw.hs 2001-09-09 03:46:40.000000000 +0200 +++ new/formatting-7.1.2/src/Formatting/Internal/Raw.hs 2001-09-09 03:46:40.000000000 +0200 @@ -4,11 +4,11 @@ ( module Data.Text.Format, module Data.Text.Format.Functions, - module Data.Text.Format.Int, + module Data.Text.Lazy.Builder.Int, module Data.Text.Format.Types ) where import Data.Text.Format import Data.Text.Format.Functions -import Data.Text.Format.Int +import Data.Text.Lazy.Builder.Int import Data.Text.Format.Types diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/formatting-7.1.1/src/Formatting/ShortFormatters.hs new/formatting-7.1.2/src/Formatting/ShortFormatters.hs --- old/formatting-7.1.1/src/Formatting/ShortFormatters.hs 2001-09-09 03:46:40.000000000 +0200 +++ new/formatting-7.1.2/src/Formatting/ShortFormatters.hs 2001-09-09 03:46:40.000000000 +0200 @@ -39,58 +39,71 @@ -- | Output a lazy text. t :: Format r (Text -> r) t = later T.fromLazyText +{-# INLINE t #-} -- | Render an integral e.g. 123 -> \"123\", 0 -> \"0\". d :: Integral a => Format r (a -> r) d = int +{-# INLINE d #-} -- | Render an integer using binary notation. (No leading 0b is -- added.) b :: Integral a => Format r (a -> r) b = bin +{-# INLINE b #-} -- | Render an integer using octal notation. (No leading 0o is added.) o :: Integral a => Format r (a -> r) o = oct +{-# INLINE o #-} -- | Render an integer using hexadecimal notation. (No leading 0x is -- added.) x :: Integral a => Format r (a -> r) x = later T.hex +{-# INLINE x #-} -- | Output a strict text. st :: Format r (S.Text -> r) st = later T.fromText +{-# INLINE st #-} -- | Output a string. s :: Format r (String -> r) s = later (T.fromText . T.pack) +{-# INLINE s #-} -- | Output a showable value (instance of 'Show') by turning it into -- 'Text'. sh :: Show a => Format r (a -> r) sh = later (T.fromText . T.pack . show) +{-# INLINE sh #-} -- | Output a character. c :: Format r (Char -> r) c = later B.build +{-# INLINE c #-} -- | Render a floating point number using normal notation, with the -- given number of decimal places. f :: Real a => Int -> Format r (a -> r) f i = later (T.fixed i) +{-# INLINE f #-} -- | Render a floating point number using the smallest number of -- digits that correctly represent it. sf :: Real a => Format r (a -> r) sf = later T.shortest +{-# INLINE sf #-} -- | Pad the left hand side of a string until it reaches @k@ characters -- wide, if necessary filling with character @ch@. l :: Buildable a => Int -> Char -> Format r (a -> r) l i ch = later (T.left i ch) +{-# INLINE l #-} -- | Pad the right hand side of a string until it reaches @k@ characters -- wide, if necessary filling with character @ch@. r :: Buildable a => Int -> Char -> Format r (a -> r) r i ch = later (T.right i ch) +{-# INLINE r #-}
