shakespeare 2.0.25 → 2.0.25.1
raw patch · 6 files changed
+48/−12 lines, 6 filesdep ~aesondep ~base
Dependency ranges changed: aeson, base
Files
- ChangeLog.md +4/−0
- Text/Hamlet.hs +8/−1
- Text/Julius.hs +11/−1
- Text/MkSizeType.hs +11/−4
- Text/Shakespeare/I18N.hs +11/−3
- shakespeare.cabal +3/−3
ChangeLog.md view
@@ -1,5 +1,9 @@ # ChangeLog for shakespeare +### 2.0.25.1++* Support for GHC 9.2 and aeson 2 [#260](https://github.com/yesodweb/shakespeare/pull/260)+ ### 2.0.25 * Support for GHC 9.0 [#254](https://github.com/yesodweb/shakespeare/pull/254)
Text/Hamlet.hs view
@@ -139,7 +139,7 @@ return (ListP patterns, concat scopes) bindingPattern (BindConstr con is) = do (patterns, scopes) <- fmap unzip $ mapM bindingPattern is- return (ConP (mkConName con) patterns, concat scopes)+ return (conP (mkConName con) patterns, concat scopes) bindingPattern (BindRecord con fields wild) = do let f (Ident field,b) = do (p,s) <- bindingPattern b@@ -156,6 +156,13 @@ conToStr :: DataConstr -> String conToStr (DCUnqualified (Ident x)) = x conToStr (DCQualified (Module xs) (Ident x)) = intercalate "." $ xs ++ [x]++conP :: Name -> [Pat] -> Pat+#if MIN_VERSION_template_haskell(2,18,0)+conP name = ConP name []+#else+conP = ConP+#endif -- Wildcards bind all of the unbound fields to variables whose name -- matches the field name.
Text/Julius.hs view
@@ -1,3 +1,4 @@+{-# LANGUAGE CPP #-} {-# LANGUAGE TemplateHaskell #-} {-# LANGUAGE GeneralizedNewtypeDeriving #-} {-# LANGUAGE FlexibleInstances #-}@@ -53,6 +54,9 @@ import qualified Data.Text.Lazy as TL import Text.Shakespeare import Data.Aeson (Value, toJSON)+#if MIN_VERSION_aeson(2,0,0)+import qualified Data.Aeson.KeyMap as KeyMap+#endif import Data.Aeson.Types (Value(..)) import Numeric (showHex) import qualified Data.HashMap.Strict as H@@ -117,11 +121,17 @@ V.foldr f (singleton ']') (V.unsafeTail v) where f a z = singleton ',' <> go a <> z go (Object m) = {-# SCC "go/Object" #-}- case H.toList m of+ case fromObject m of (x:xs) -> singleton '{' <> one x <> foldr f (singleton '}') xs _ -> "{}" where f a z = singleton ',' <> one a <> z one (k,v) = string k <> singleton ':' <> go v++#if MIN_VERSION_aeson(2,0,0)+ fromObject = H.toList . KeyMap.toHashMapText+#else+ fromObject = H.toList+#endif string :: T.Text -> Builder string s = {-# SCC "string" #-} singleton '"' <> quote s <> singleton '"'
Text/MkSizeType.hs view
@@ -38,7 +38,7 @@ x = mkName "x" unit = LitE $ StringL unit' showDec = FunD (mkName "show") [Clause [showPat] showBody []]- showPat = ConP name [VarP x]+ showPat = conP name [VarP x] showBody = NormalB $ AppE (AppE showSize $ VarE x) unit numInstanceDec :: Name -> Dec@@ -65,8 +65,8 @@ binaryFunDec :: Name -> String -> Dec binaryFunDec name fun' = FunD fun [Clause [pat1, pat2] body []]- where pat1 = ConP name [VarP v1]- pat2 = ConP name [VarP v2]+ where pat1 = conP name [VarP v1]+ pat2 = conP name [VarP v2] body = NormalB $ AppE (ConE name) result result = AppE (AppE (VarE fun) (VarE v1)) (VarE v2) fun = mkName fun'@@ -75,7 +75,7 @@ unariFunDec1 :: Name -> String -> Dec unariFunDec1 name fun' = FunD fun [Clause [pat] body []]- where pat = ConP name [VarP v]+ where pat = conP name [VarP v] body = NormalB $ AppE (ConE name) (AppE (VarE fun) (VarE v)) fun = mkName fun' v = mkName "v"@@ -92,3 +92,10 @@ instanceD :: Cxt -> Type -> [Dec] -> Dec instanceD = InstanceD Nothing++conP :: Name -> [Pat] -> Pat+#if MIN_VERSION_template_haskell(2,18,0)+conP name = ConP name []+#else+conP = ConP+#endif
Text/Shakespeare/I18N.hs view
@@ -1,3 +1,4 @@+{-# LANGUAGE CPP #-} {-# LANGUAGE TemplateHaskell #-} {-# LANGUAGE TypeFamilies #-} {-# LANGUAGE MultiParamTypeClasses #-}@@ -186,7 +187,7 @@ (pat, bod) <- mkBody dt (prefix ++ constr def) (map fst $ vars def) (content def) guard <- fmap NormalG [|$(return $ VarE a) == pack $(lift $ unpack lang)|] return $ Clause- [WildP, ConP (mkName ":") [VarP a, WildP], pat]+ [WildP, conP (mkName ":") [VarP a, WildP], pat] (GuardedB [(guard, bod)]) [] @@ -230,7 +231,7 @@ sToClause prefix dt sdef = do (pat, bod) <- mkBody dt (prefix ++ sconstr sdef) (map fst $ svars sdef) (scontent sdef) return $ Clause- [WildP, ConP (mkName "[]") [], pat]+ [WildP, conP (mkName "[]") [], pat] (NormalB bod) [] @@ -241,9 +242,16 @@ d <- newName "msg" rm <- [|renderMessage|] return $ Clause- [VarP a, ConP (mkName ":") [WildP, VarP c], VarP d]+ [VarP a, conP (mkName ":") [WildP, VarP c], VarP d] (NormalB $ rm `AppE` VarE a `AppE` VarE c `AppE` VarE d) []++conP :: Name -> [Pat] -> Pat+#if MIN_VERSION_template_haskell(2,18,0)+conP name = ConP name []+#else+conP = ConP+#endif toCon :: String -> SDef -> Con toCon dt (SDef c vs _) =
shakespeare.cabal view
@@ -1,5 +1,5 @@ name: shakespeare-version: 2.0.25+version: 2.0.25.1 license: MIT license-file: LICENSE author: Michael Snoyman <michael@snoyman.com>@@ -35,7 +35,7 @@ library default-language: Haskell2010- build-depends: base >= 4.9 && < 5+ build-depends: base >= 4.12 && < 5 , time >= 1 , containers , template-haskell >= 2.7@@ -45,7 +45,7 @@ , ghc-prim , bytestring , directory >= 1.2- , aeson+ , aeson < 3 , blaze-markup , blaze-html , exceptions