th-printf 0.5.0 → 0.5.1
raw patch · 3 files changed
+16/−17 lines, 3 filesdep ~base
Dependency ranges changed: base
Files
- src/NumericUtils.hs +8/−8
- src/Text/Printf/TH.hs +1/−1
- th-printf.cabal +7/−8
src/NumericUtils.hs view
@@ -7,6 +7,8 @@ ) where import Data.Char+import Data.Foldable+import Data.Ord import GHC.Base import GHC.Float (FFFormat(..), roundTo) import Numeric (floatToDigits)@@ -37,8 +39,8 @@ if x < 0 then "-Infinity" else "Infinity"- | x < 0 || isNegativeZero x = '-' : doFmt fmt (floatToDigits (toInteger base) (-x))- | otherwise = doFmt fmt (floatToDigits (toInteger base) x)+ | x < 0 || isNegativeZero x = '-' : doFmt fmt (floatToDigits base (-x))+ | otherwise = doFmt fmt (floatToDigits base x) where eChar | upper = 'E'@@ -48,11 +50,9 @@ let ds = map intToDigit is in case format of FFGeneric ->- let alt1 = doFmt FFExponent (is, e)- alt2 = doFmt FFFixed (is, e)- in if length alt2 > length alt1- then alt1- else alt2+ minimumBy+ (comparing length)+ [doFmt FFExponent (is, e), doFmt FFFixed (is, e)] FFExponent -> case decs of Nothing ->@@ -139,7 +139,7 @@ else b) Nothing -> \x -> ('1', x) doFmt ([0], 0) = "0" ++ [pChar] ++ "+0"- doFmt ((1:bits), exp) =+ doFmt ((_:bits), exp) = first : (if null digs && not alt then ""
src/Text/Printf/TH.hs view
@@ -57,7 +57,7 @@ -- -- %? :: 'Show' a => a ----- %u :: 'GHC.Natural.Natural'+-- %u :: 'Numeric.Natural.Natural' -- -- %d, %i :: 'Integral' i => i -- %o :: 'Integral' i => i
th-printf.cabal view
@@ -1,5 +1,5 @@ name: th-printf-version: 0.5.0+version: 0.5.1 synopsis: Compile-time printf description: Quasiquoters for printf: string, bytestring, text. license: MIT@@ -9,7 +9,7 @@ category: Text homepage: https://github.com/pikajude/th-printf build-type: Simple-cabal-version: >=1.10+cabal-version: >= 1.10 source-repository head type: git@@ -23,9 +23,7 @@ Text.Printf.TH.Printer.String Text.Printf.TH.Types hs-source-dirs: src- default-language: Haskell2010- default-extensions: NoMonomorphismRestriction- build-depends: base >= 4.8 && < 4.11+ build-depends: base >= 4.8 && < 5 , ansi-wl-pprint , attoparsec , charset@@ -35,6 +33,8 @@ , transformers , trifecta , utf8-string+ default-language: Haskell2010+ default-extensions: NoMonomorphismRestriction ghc-options: -Wall -fno-warn-missing-signatures -fno-warn-name-shadowing -fno-warn-unused-do-bind @@ -43,7 +43,6 @@ main-is: format.hs other-modules: Codegen hs-source-dirs: tests- default-language: Haskell2010 build-depends: base , HUnit , QuickCheck@@ -52,13 +51,13 @@ , template-haskell , text , th-printf+ default-language: Haskell2010 ghc-options: -Wall -fno-warn-type-defaults benchmark perf type: exitcode-stdio-1.0 main-is: benchmark.hs hs-source-dirs: benchmark- default-language: Haskell2010 build-depends: base, criterion, text, th-printf+ default-language: Haskell2010 ghc-options: -O2 -Wall -fno-warn-type-defaults-