ert 0.0.1.1 → 0.0.2.0
raw patch · 2 files changed
+21/−10 lines, 2 filesdep ~aesondep ~attoparsecdep ~bytestringPVP: major bump suggested
API removals or changes: PVP suggests a major version bump
Dependency ranges changed: aeson, attoparsec, bytestring, text, yaml
API changes (from Hackage documentation)
- Data.EasyTpl: Number :: !Number -> Value
+ Data.EasyTpl: Number :: !Scientific -> Value
Files
- ert.cabal +10/−10
- library/Data/EasyTpl/Render.hs +11/−0
ert.cabal view
@@ -2,7 +2,7 @@ -- see http://haskell.org/cabal/users-guide/ name: ert-version: 0.0.1.1+version: 0.0.2.0 synopsis: Easy Runtime Templates description: EJS-like template engine for Haskell. license: GPL-3@@ -45,13 +45,13 @@ default-extensions: OverloadedStrings CPP -- other-extensions: - build-depends: base >=4.6 && <4.7- , bytestring >= 0.10.0.2 && < 0.11- , text >= 0.11.3.1 && < 0.12+ build-depends: base >= 4.6 && < 4.7+ , bytestring >= 0.10.0.2+ , text >= 0.11.3.1 , vector >= 0.10.0.1 && < 0.11 , unordered-containers >= 0.2.3.0 && < 0.3- , aeson >= 0.6.2.1 && < 0.7- , attoparsec >= 0.10.4.0 && < 0.11+ , aeson >= 0.8.0.1 && < 0.9+ , attoparsec >= 0.11.3.4 && < 0.13 , attoparsec-expr >= 0.1.1.1 && < 0.2 if flag(regex) build-depends: regex-compat >= 0.95.1 && < 0.96@@ -74,12 +74,12 @@ CPP build-depends: base , ert- , bytestring >= 0.10.0.2 && < 0.11- , aeson >= 0.6.2.1 && < 0.7- , attoparsec >= 0.10.4.0 && < 0.11+ , bytestring >= 0.10.0.2+ , aeson >= 0.8.0.1 && < 0.9+ , attoparsec >= 0.10.4.0 && < 0.13 if flag(yaml)- build-depends: yaml >= 0.8.9.1 && < 0.9+ build-depends: yaml >= 0.8.9.2 && < 0.9 cpp-options: -DWITH_YAML if flag(dev)
library/Data/EasyTpl/Render.hs view
@@ -218,7 +218,11 @@ -- | Cast value to boolean. toBoolean :: Value -> Value toBoolean bool@(Bool _) = bool+#if MIN_VERSION_attoparsec(0,12,0)+toBoolean (Number val) = Bool $ val /= 0+#else toBoolean (Number val) = Bool $ val /= I 0+#endif toBoolean (String text) = Bool $ not $ T.null text toBoolean Null = Bool False toBoolean (Object hash) = Bool $ not $ H.null hash@@ -229,10 +233,17 @@ toNumber :: Value -> Value toNumber val@(Number _) = val toNumber (Bool bool) = Number $ if bool then 1 else 0+#if MIN_VERSION_attoparsec(0,12,0)+toNumber (String text) = getNumber' $ AT.parse AT.scientific text+ where+ getNumber' (AT.Done _ val) = Number val+ getNumber' _ = Null+#else toNumber (String text) = getNumber' $ AT.parse AT.number text where getNumber' (AT.Done _ val) = Number val getNumber' _ = Null+#endif toNumber _ = Null -- | Cast any value to string.