ginger 0.10.2.0 → 0.10.4.0
raw patch · 3 files changed
+28/−5 lines, 3 filesdep ~aesonPVP ok
version bump matches the API change (PVP)
Dependency ranges changed: aeson
API changes (from Hackage documentation)
+ Text.Ginger.GVal: instance Text.Ginger.GVal.ToGVal m (Data.Aeson.KeyMap.KeyMap Data.Aeson.Types.Internal.Value)
Files
- ginger.cabal +4/−4
- src/Text/Ginger/GVal.hs +23/−0
- src/Text/PrintfA.hs +1/−1
ginger.cabal view
@@ -2,7 +2,7 @@ -- documentation, see http://haskell.org/cabal/users-guide/ name: ginger-version: 0.10.2.0+version: 0.10.4.0 synopsis: An implementation of the Jinja2 template language in Haskell description: Ginger is Jinja, minus the most blatant pythonisms. Wants to be feature complete, but isn't quite there yet.@@ -40,7 +40,7 @@ -- other-modules: -- other-extensions: build-depends: base >=4.8 && <5- , aeson >=1.4.2.0 && <1.6+ , aeson >=1.4.2.0 && <2.1 , aeson-pretty >=0.8.7 && <0.9 , bytestring >=0.10.8.2 && <0.11 , containers >=0.6.4 && <0.7@@ -72,7 +72,7 @@ default-language: Haskell2010 build-depends: base >= 4.8 && <5 , ginger- , aeson >=1.4.2.0 && <1.6+ , aeson >=1.4.2.0 && <2.1 , bytestring >=0.10.8.2 && <0.11 , data-default >= 0.5 , optparse-applicative >=0.14.3.0 && <0.17@@ -92,7 +92,7 @@ default-language: Haskell2010 build-depends: base >=4.8 && <5 , ginger- , aeson >=1.4.2.0 && <1.6+ , aeson >=1.4.2.0 && <2.1 , bytestring >=0.10.8.2 && <0.11 , data-default >=0.5 , mtl >=2.2.2 && <2.3
src/Text/Ginger/GVal.hs view
@@ -1,3 +1,4 @@+{-#LANGUAGE CPP #-} {-#LANGUAGE OverloadedStrings #-} {-#LANGUAGE MultiParamTypeClasses #-} {-#LANGUAGE FlexibleInstances #-}@@ -59,6 +60,10 @@ import Data.Fixed (Fixed (..), Pico) import Control.Applicative import qualified Data.Aeson as JSON+#if MIN_VERSION_aeson(2,0,0)+import qualified Data.Aeson.Key as AK+import qualified Data.Aeson.KeyMap as AKM+#endif import qualified Data.HashMap.Strict as HashMap import Data.HashMap.Strict (HashMap) import qualified Data.Map.Strict as Map@@ -658,6 +663,24 @@ rawJSONToGVal JSON.Null = def rawJSONToGVal (JSON.Array a) = toGVal $ Vector.toList a rawJSONToGVal (JSON.Object o) = toGVal o++#if MIN_VERSION_aeson(2,0,0)+-- | 'AKM.KeyMap' of 'JSON.Value' becomes a dictionary-like 'GVal'+instance ToGVal m (AKM.KeyMap JSON.Value) where+ toGVal xs = helper (AKM.map toGVal xs)+ where+ helper :: AKM.KeyMap (GVal m) -> GVal m+ helper xs =+ def+ { asHtml = mconcat . List.map (asHtml . snd) . AKM.toList $ xs+ , asText = mconcat . List.map (asText . snd) . AKM.toList $ xs+ , asBytes = mconcat . List.map (asBytes . snd) . AKM.toList $ xs+ , asBoolean = not . AKM.null $ xs+ , isNull = False+ , asLookup = Just $ (`AKM.lookup` xs) . AK.fromText+ , asDictItems = Just . List.map (\(k,v) -> (AK.toText k, v)) . AKM.toList $ xs+ }+#endif -- | Turn a 'Function' into a 'GVal' fromFunction :: Function m -> GVal m
src/Text/PrintfA.hs view
@@ -9,4 +9,4 @@ data PrintfTypeT = T { unT :: forall r. PrintfType r => r } printfa :: PrintfType t => String -> [ PrintfArgT ] -> t-printfa format = unT . foldl (\(T r) (P a) -> T $ r a ) (T $ printf format)+printfa format = (\(T t) -> t) . foldl (\(T r) (P a) -> T $ r a ) (T $ printf format)