mustache 2.3.1 → 2.3.2
raw patch · 6 files changed
+80/−28 lines, 6 filesdep −eitherdep ~aesondep ~template-haskell
Dependencies removed: either
Dependency ranges changed: aeson, template-haskell
Files
- CHANGELOG.md +4/−0
- app/Main.hs +3/−2
- mustache.cabal +24/−18
- src/Text/Mustache.hs +1/−1
- src/Text/Mustache/Internal/Types.hs +47/−6
- src/Text/Mustache/Types.hs +1/−1
CHANGELOG.md view
@@ -1,5 +1,9 @@ # Mustache library changelog +## v2.3.2++- Added support for GHC 9.0.1+ ## v2.3.0 - Changed `EitherT` to `ExceptT` (deprecation)
app/Main.hs view
@@ -4,11 +4,12 @@ import Data.Aeson (Value, eitherDecode)+import Data.Bifunctor (first) import qualified Data.ByteString as B (readFile) import qualified Data.ByteString.Lazy as BS (readFile) import Data.Foldable (for_) import qualified Data.Text.IO as TIO (putStrLn)-import Data.Yaml (decodeEither)+import Data.Yaml (decodeEither') import System.Console.CmdArgs.Implicit (Data, Typeable, argPos, args, cmdArgs, def, help, summary,@@ -44,7 +45,7 @@ readYAML :: FilePath -> IO (Either String Value)-readYAML = fmap decodeEither . B.readFile+readYAML = fmap (first show . decodeEither') . B.readFile main :: IO ()
mustache.cabal view
@@ -1,13 +1,11 @@ cabal-version: 1.12 --- This file has been generated from package.yaml by hpack version 0.31.2.+-- This file has been generated from package.yaml by hpack version 0.34.4. -- -- see: https://github.com/sol/hpack------ hash: 8ffde004ee64f5b057ed66f76bbc72cbb71cdc81dcebe9e822563fdb11a8b338 name: mustache-version: 2.3.1+version: 2.3.2 synopsis: A mustache template parser library. description: Allows parsing and rendering template files with mustache markup. See the mustache <http://mustache.github.io/mustache.5.html language reference>.@@ -23,8 +21,9 @@ copyright: (c) 2015 - 2019 Justus Adam license: BSD3 license-file: LICENSE-tested-with: GHC>=7.8 && <=7.10.2 build-type: Simple+tested-with:+ GHC>=7.8 && <=7.10.2 extra-source-files: README.md CHANGELOG.md@@ -37,10 +36,28 @@ location: git://github.com/JustusAdam/mustache.git library+ exposed-modules:+ Text.Mustache+ Text.Mustache.Types+ Text.Mustache.Parser+ Text.Mustache.Compile+ Text.Mustache.Render+ other-modules:+ Text.Mustache.Internal+ Text.Mustache.Internal.Types+ Paths_mustache hs-source-dirs: src- default-extensions: LambdaCase TupleSections- other-extensions: NamedFieldPuns OverloadedStrings LambdaCase TupleSections TemplateHaskell QuasiQuotes+ default-extensions:+ LambdaCase+ TupleSections+ other-extensions:+ NamedFieldPuns+ OverloadedStrings+ LambdaCase+ TupleSections+ TemplateHaskell+ QuasiQuotes ghc-options: -Wall build-depends: aeson@@ -48,7 +65,6 @@ , bytestring , containers , directory- , either , filepath , mtl >=2.2.1 , parsec@@ -58,16 +74,6 @@ , th-lift , unordered-containers , vector- exposed-modules:- Text.Mustache- Text.Mustache.Types- Text.Mustache.Parser- Text.Mustache.Compile- Text.Mustache.Render- other-modules:- Text.Mustache.Internal- Text.Mustache.Internal.Types- Paths_mustache default-language: Haskell2010 executable haskell-mustache
src/Text/Mustache.hs view
@@ -176,7 +176,7 @@ , substituteNode, substituteAST, catchSubstitute -- * Data Conversion- , ToMustache, toMustache, object, (~>), (~=)+ , ToMustache, toMustache, integralToMustache, object, (~>), (~=) -- ** Utilities for lambdas
src/Text/Mustache/Internal/Types.hs view
@@ -12,6 +12,7 @@ import Control.Arrow import Control.Monad.RWS hiding (lift) import qualified Data.Aeson as Aeson+import Data.Int (Int8, Int16, Int32, Int64) import Data.Foldable (toList) import qualified Data.HashMap.Strict as HM import qualified Data.HashSet as HS@@ -22,7 +23,10 @@ import Data.Text import qualified Data.Text.Lazy as LT import qualified Data.Vector as V-import Language.Haskell.TH.Lift (Lift (lift), deriveLift)+import Data.Word (Word8, Word16, Word32, Word64)+import Language.Haskell.TH.Lift (deriveLift)+import Language.Haskell.TH.Syntax+import Numeric.Natural (Natural) -- | Type of errors we may encounter during substitution.@@ -143,6 +147,8 @@ listToMustache' :: ToMustache ω => [ω] -> Value listToMustache' = Array . V.fromList . fmap toMustache +integralToMustache :: Integral ω => ω -> Value+integralToMustache = toMustache . toInteger -- | Conversion class class ToMustache ω where@@ -159,9 +165,39 @@ instance ToMustache Integer where toMustache = Number . fromInteger +instance ToMustache Natural where+ toMustache = integralToMustache+ instance ToMustache Int where- toMustache = toMustache . toInteger+ toMustache = integralToMustache +instance ToMustache Word where+ toMustache = integralToMustache++instance ToMustache Int8 where+ toMustache = integralToMustache++instance ToMustache Int16 where+ toMustache = integralToMustache++instance ToMustache Int32 where+ toMustache = integralToMustache++instance ToMustache Int64 where+ toMustache = integralToMustache++instance ToMustache Word8 where+ toMustache = integralToMustache++instance ToMustache Word16 where+ toMustache = integralToMustache++instance ToMustache Word32 where+ toMustache = integralToMustache++instance ToMustache Word64 where+ toMustache = integralToMustache+ instance ToMustache Char where toMustache = toMustache . (:[]) listToMustache = String . pack@@ -345,16 +381,21 @@ , partials :: TemplateCache } deriving (Show) ++deriveLift ''DataIdentifier+deriveLift ''Node+deriveLift ''Template+ instance Lift TemplateCache where+#if MIN_VERSION_template_haskell(2,16,0)+ liftTyped m = [|| HM.fromList $$(liftTyped $ HM.toList m) ||]+#else lift m = [| HM.fromList $(lift $ HM.toList m) |]+#endif --Data.Text 1.2.4.0 introduces its own Lift Text instance #if !MIN_VERSION_text(1,2,4) instance Lift Text where lift = lift . unpack #endif--deriveLift ''DataIdentifier-deriveLift ''Node-deriveLift ''Template
src/Text/Mustache/Types.hs view
@@ -22,7 +22,7 @@ -- ** Converting , object , (~>), (↝), (~=), (⥱)- , ToMustache, toMustache, mFromJSON+ , ToMustache, toMustache, mFromJSON, integralToMustache -- ** Representation , Array, Object, Pair , SubM, askContext, askPartials