mustache 0.4.0.1 → 0.5.0.0
raw patch · 4 files changed
+24/−9 lines, 4 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
- Text.Mustache.Types: instance Text.Mustache.Types.ToMustache GHC.Base.String
- Text.Mustache.Types: instance Text.Mustache.Types.ToMustache ω => Text.Mustache.Types.ToMustache [ω]
+ Text.Mustache.Types: instance Text.Mustache.Types.ToMustache GHC.Types.Char
+ Text.Mustache.Types: instance Text.Mustache.Types.ToMustache a => Text.Mustache.Types.ToMustache [a]
- Text.Mustache: class ToMustache ω
+ Text.Mustache: class ToMustache ω where listToMustache = Array ∘ fromList ∘ fmap toMustache
- Text.Mustache.Types: class ToMustache ω
+ Text.Mustache.Types: class ToMustache ω where listToMustache = Array ∘ fromList ∘ fmap toMustache
Files
- CHANGELOG.md +5/−0
- mustache.cabal +2/−2
- src/lib/Text/Mustache/Types.hs +8/−6
- test/unit/Spec.hs +9/−1
CHANGELOG.md view
@@ -1,5 +1,10 @@ # Mustache library changelog +## v0.5.0.0rc-6++- Removed any dependency on ghc 7.10-type OverlappingInstances+- Resolved String/List overlapping instances+ ## v0.4.0.1rc-5 - Added a necessary OVERLAPPABLE pragma
mustache.cabal view
@@ -1,5 +1,5 @@ name: mustache-version: 0.4.0.1+version: 0.5.0.0 synopsis: A mustache template parser library. description: Allows parsing and rendering template files with mustache markup. See the@@ -30,7 +30,7 @@ type: git branch: master location: git://github.com/JustusAdam/mustache.git- tag: v0.4.0.1rc-5+ tag: v0.5.0.0rc-6
src/lib/Text/Mustache/Types.hs view
@@ -96,20 +96,22 @@ show (Bool b) = show b show Null = "null" - -- | Conversion class -- -- Note that some instances of this class overlap delierately to provide -- maximum flexibility instances while preserving maximum efficiency. class ToMustache ω where toMustache ∷ ω → Value+ listToMustache ∷ [ω] → Value+ listToMustache = Array ∘ V.fromList ∘ fmap toMustache +instance ToMustache Char where+ toMustache = toMustache . (:[])+ listToMustache = String . pack+ instance ToMustache Value where toMustache = id -instance ToMustache String where- toMustache = toMustache ∘ pack- instance ToMustache Bool where toMustache = Bool @@ -125,8 +127,8 @@ instance ToMustache Scientific where toMustache = Number -instance {-# OVERLAPPABLE #-} ToMustache ω ⇒ ToMustache [ω] where- toMustache = Array ∘ V.fromList ∘ fmap toMustache+instance ToMustache a => ToMustache [a] where+ toMustache = listToMustache instance ToMustache ω ⇒ ToMustache (V.Vector ω) where toMustache = toMustache ∘ fmap toMustache
test/unit/Spec.hs view
@@ -182,10 +182,18 @@ , "inner" ~> ("error" :: T.Text) ] )- `shouldBe` "success"+ `shouldBe` "success" +converterSpec :: Spec+converterSpec =+ describe "toMustache" $+ it "converts a String" $+ toMustache ("My String" :: String) `shouldSatisfy` \case (String "My String") -> True; _ -> False++ main :: IO () main = hspec $ do parserSpec substituteSpec+ converterSpec