packages feed

vformat 0.11.0.0 → 0.12.0.0

raw patch · 4 files changed

+18/−13 lines, 4 filesdep −time

Dependencies removed: time

Files

ChangeLog.md view
@@ -10,3 +10,7 @@ - Make generic instantiate FormatArg configurable - Expose standard formatters - Fix some issue and doc++## V0.12.0+- Add `defaultSpecs`+- Remove `FormatTime` instance
src/Text/Format.hs view
@@ -43,6 +43,7 @@   , formatWord   , formatInteger   , formatRealFloat+  , defaultSpecs     -- * Errors   , ArgError(..)   , errorArgKey
src/Text/Format/Class.hs view
@@ -19,10 +19,10 @@   , formatWord   , formatInteger   , formatRealFloat+  , defaultSpecs   ) where  -import           Control.Applicative import           Control.Monad.Catch import           Data.Char import           Data.Either@@ -30,7 +30,6 @@ import           Data.List           ((!!)) import           Data.Map            hiding (map) import           Data.Maybe-import           Data.Time.Format import           Data.Word import           GHC.Generics import           Numeric@@ -127,6 +126,9 @@   putStrLn $ format1 \"Book: {name}, Author: {author}, Price: {price:.2f}\" $     Book \"Math\" \"nobody\" 99.99 @++Note: Since v0.12.0, 'FormatTime' instance has been remove,+use [vformat-time](http://hackage.haskell.org/package/vformat-time) instead. -} class FormatArg a where   formatArg :: a -> Formatter@@ -193,13 +195,6 @@ instance FormatArg Word64 where   formatArg = formatWord --- | Default specs is \"%Y-%m-%dT%H:%M:%S\", see 'formatTime'.-instance {-# OVERLAPPABLE #-} FormatTime t => FormatArg t where-  formatArg x k fmt =-    let specs = fmtSpecs fmt <|> "%Y-%m-%dT%H:%M:%S"-        x'    = formatTime defaultTimeLocale specs x-    in formatArg x' k $ fmt{fmtSpecs=""}- instance {-# OVERLAPPABLE #-} FormatArg a => FormatArg [a] where   {-# SPECIALIZE instance FormatArg [Char] #-}   formatArg = formatArgList@@ -463,3 +458,10 @@     showx "G" p x   = map toUpper <$> showx "g" p x     showx "%" p x   = (++ "%") <$> (showx "f" p (x * 100))     showx _ _ _     = throwM ArgFmtError+++{-| Use a default specs for the given formatter -}+defaultSpecs :: String -> (a -> Formatter) -> a -> Formatter+defaultSpecs specs f x k fmt+  | fmtSpecs fmt == "" = f x k $ fmt {fmtSpecs = specs}+  | otherwise = f x k fmt
vformat.cabal view
@@ -4,10 +4,10 @@ -- -- see: https://github.com/sol/hpack ----- hash: 2036e677feacc5509914e6f6268eeb9a780e00ef9f609f19d4b52d21728b7fc6+-- hash: 432cce1b2c70136bddd87b0256f57f890212a55aaa4f38b8b1ddb4fb4eb1d3dc  name:           vformat-version:        0.11.0.0+version:        0.12.0.0 synopsis:       A Python str.format() like formatter description:    Please see the http://hackage.haskell.org/package/vformat category:       Text, Format@@ -42,7 +42,6 @@       base >=4.7 && <5     , containers >=0.5.9 && <1.0     , exceptions >=0.8 && <1.0-    , time >=1.4 && <2.0   default-language: Haskell2010  test-suite vformat-test@@ -59,6 +58,5 @@     , containers >=0.5.9 && <1.0     , exceptions >=0.8 && <1.0     , hspec >=2.1 && <3.0-    , time >=1.4 && <2.0     , vformat   default-language: Haskell2010