microstache 1.0.1.2 → 1.0.2
raw patch · 3 files changed
+27/−12 lines, 3 filesdep ~aesondep ~basedep ~semigroups
Dependency ranges changed: aeson, base, semigroups, text
Files
- CHANGELOG.md +4/−0
- microstache.cabal +10/−9
- src/Text/Microstache/Render.hs +13/−3
CHANGELOG.md view
@@ -1,3 +1,7 @@+## microstache 1.0.2++- Support `aeson-2.0.0.0`+ ## microstache 1.0.1.2 - Drop `bytestring` dependency (there weren't direct one)
microstache.cabal view
@@ -1,5 +1,5 @@ name: microstache-version: 1.0.1.2+version: 1.0.2 cabal-version: >=1.10 license: BSD3 license-file: LICENSE@@ -7,8 +7,8 @@ Mark Karpov <markkarpov@openmailbox.org>, Oleg Grenrus <oleg.grenrus@iki.fi> maintainer: Oleg Grenrus<oleg.grenrus@iki.fi>-homepage: https://github.com/phadej/microstache-bug-reports: https://github.com/phadej/microstache/issues+homepage: https://github.com/haskellari/microstache+bug-reports: https://github.com/haskellari/microstache/issues category: Text synopsis: Mustache templates for Haskell build-type: Simple@@ -37,22 +37,23 @@ || ==8.2.2 || ==8.4.4 || ==8.6.5- || ==8.8.3- || ==8.10.1+ || ==8.8.4+ || ==8.10.4+ || ==9.0.1 source-repository head type: git- location: https://github.com/phadej/microstache.git+ location: https://github.com/haskellari/microstache.git library build-depends:- aeson >=0.11 && <1.6- , base >=4.5 && <4.15+ aeson >=0.11 && <1.6 || >=2.0.0.0 && <2.1+ , base >=4.5 && <4.16 , containers >=0.4.2.1 && <0.7 , deepseq >=1.3.0.0 && <1.5 , directory >=1.1.0.2 && <1.4 , filepath >=1.3.0.0 && <1.5- , parsec >=3.1.11 && <6.0+ , parsec >=3.1.11 && <3.2 , text >=1.2 && <1.3 , transformers >=0.3.0.0 && <0.6 , unordered-containers >=0.2.5 && <0.3
src/Text/Microstache/Render.hs view
@@ -30,7 +30,6 @@ import Data.Word (Word) import Text.Microstache.Type -import qualified Data.HashMap.Strict as HM import qualified Data.List.NonEmpty as NE import qualified Data.Map as Map import qualified Data.Text as T@@ -39,6 +38,13 @@ import qualified Data.Text.Lazy.Encoding as LTE import qualified Data.Vector as V +#if MIN_VERSION_aeson(2,0,0)+import qualified Data.Aeson.KeyMap as KM+import qualified Data.Aeson.Key as Key+#else+import qualified Data.HashMap.Strict as KM+#endif+ #if MIN_VERSION_transformers(0,4,0) import Control.Monad.Trans.State.Strict (State, execState, modify') #else@@ -235,7 +241,11 @@ -> Maybe Value -- ^ Looked-up value simpleLookup _ (Key []) obj = return obj simpleLookup c (Key (k:ks)) (Object m) =- case HM.lookup k m of+#if MIN_VERSION_aeson(2,0,0)+ case KM.lookup (Key.fromText k) m of+#else+ case KM.lookup k m of+#endif Nothing -> if c then Just Null else Nothing Just v -> simpleLookup True (Key ks) v simpleLookup _ _ _ = Nothing@@ -280,7 +290,7 @@ isBlank :: Value -> Bool isBlank Null = True isBlank (Bool False) = True-isBlank (Object m) = HM.null m+isBlank (Object m) = KM.null m isBlank (Array a) = V.null a isBlank (String s) = T.null s isBlank _ = False