PyF 0.8.1.0 → 0.8.1.1
raw patch · 4 files changed
+23/−12 lines, 4 filesdep ~basedep ~megaparsecdep ~template-haskellPVP ok
version bump matches the API change (PVP)
Dependency ranges changed: base, megaparsec, template-haskell
API changes (from Hackage documentation)
Files
- ChangeLog.md +4/−0
- PyF.cabal +2/−2
- Readme.md +17/−9
- src/PyF/Formatters.hs +0/−1
ChangeLog.md view
@@ -1,5 +1,9 @@ # Revision history for PyF +## 0.8.1.1 -- 2019-10-13++- Compatibility with GHC 8.8+ ## 0.8.1.0 -- 2019-09-03 - Precision can now be any arbitrary haskell expression, such as `[fmt|hello pi = {pi:.{1 + 3}}|]`.
PyF.cabal view
@@ -1,6 +1,6 @@ cabal-version: 2.4 name: PyF-version: 0.8.1.0+version: 0.8.1.1 synopsis: Quasiquotations for a python like interpolated string formater description: Quasiquotations for a python like interpolated string formater. license: BSD-3-Clause@@ -21,7 +21,7 @@ PyF.Formatters build-depends: base >= 4.9 && < 5.0- , template-haskell >= 2.11 && < 2.15+ , template-haskell >= 2.14 && < 2.16 -- Parsec and some transitive deps , megaparsec >= 7.0 && < 8.0
Readme.md view
@@ -14,8 +14,8 @@ >>> name = "Dave" >>> age = 54 ->>> [fmt|Person's name is {name}, age is {age:x}|]-"Person's name is Dave, age is 36"+>>> [fmt|Person's name is {name}, age is {age}|]+"Person's name is Dave, age is 54" ``` The formatting mini language can represent:@@ -47,11 +47,11 @@ "||Guillaume||" ``` -Padding inside `=` the sign:+Padding inside `=` the sign ```haskell->>> [fmt|{-pi:=10.3}|]-"- 3.142"+>>> [fmt|{-3:=6}|]+"- 3" ``` ## Float rounding@@ -61,15 +61,17 @@ "3.14" ``` -## Binary / Octal / Hex representation (with or without prefix)+## Binary / Octal / Hex representation (with or without prefix using `#`) ```haskell >>> v = 31 >>> [fmt|Binary: {v:#b}|] "Binary: 0b11111"->>> [fmt|Octal (no prefix): {age:o}|]+>>> [fmt|Octal: {v:#o}|]+"Octal: 0o37"+>>> [fmt|Octal (no prefix): {v:o}|] "Octal (no prefix): 37"->>> [fmt|Hexa (caps and prefix): {age:#X}|]+>>> [fmt|Hexa (caps and prefix): {v:#X}|] "Hexa (caps and prefix): 0x1F" ``` @@ -91,8 +93,12 @@ ```haskell >>> [fmt|{pi:+.3}|] "+3.142"+>>> [fmt|{-pi:+.3} (Negative number)|]+"-3.142 (Negative number)" >>> [fmt|{pi: .3}|] " 3.142"+>>> [fmt|{-pi: .3} (Negative number)|]+"-3.142 (Negative number)" ``` ## 0@@ -100,6 +106,8 @@ Preceding the width with a `0` enables sign-aware zero-padding, this is equivalent to inside `=` padding with a fill char of `0`. ```haskell+>>> [f{10:010}|]+0000000010 >>> [f{-10:010}|] -000000010 ```@@ -110,7 +118,7 @@ ```haskell >>> [fmt|2pi = {2* pi:.2}|]-6.28+2pi = 6.28 >>> [fmt|tail "hello" = {tail "hello":->6}|] "tail \"hello\" = --ello" ```
src/PyF/Formatters.hs view
@@ -43,7 +43,6 @@ ) where -import Data.Monoid ((<>)) import Data.List (intercalate) import Data.Char (toUpper, chr) import qualified Numeric