shakespeare 2.0.8 → 2.0.8.1
raw patch · 5 files changed
+53/−12 lines, 5 files
Files
- ChangeLog.md +4/−0
- Text/Hamlet.hs +5/−0
- Text/MkSizeType.hs +28/−8
- Text/Shakespeare/I18N.hs +15/−3
- shakespeare.cabal +1/−1
ChangeLog.md view
@@ -1,3 +1,7 @@+### 2.0.8.1++* Make it work with ghc-8.0 [#181](https://github.com/yesodweb/shakespeare/pull/181)+ ### 2.0.8 * Improve docs in Text.Hamlet [#180](https://github.com/yesodweb/shakespeare/pull/180)
Text/Hamlet.hs view
@@ -181,8 +181,13 @@ -- use 'lookupValueName' instead of just using 'mkName' so we reify the -- data constructor and not the type constructor if their names match. Just conName <- lookupValueName $ conToStr conStr+#if MIN_VERSION_template_haskell(2,11,0)+ DataConI _ _ typeName <- reify conName+ TyConI (DataD _ _ _ _ cons _) <- reify typeName+#else DataConI _ _ typeName _ <- reify conName TyConI (DataD _ _ _ cons _) <- reify typeName+#endif [fields] <- return [fields | RecC name fields <- cons, name == conName] return [fieldName | (fieldName, _, _) <- fields]
Text/MkSizeType.hs view
@@ -1,21 +1,33 @@+{-# LANGUAGE CPP #-}+ -- | Internal functions to generate CSS size wrapper types. module Text.MkSizeType (mkSizeType) where +#if MIN_VERSION_template_haskell(2,11,0)+import Language.Haskell.TH (conT)+#endif import Language.Haskell.TH.Syntax import Data.Text.Lazy.Builder (fromLazyText) import qualified Data.Text.Lazy as TL mkSizeType :: String -> String -> Q [Dec]-mkSizeType name' unit = return [ dataDec name- , showInstanceDec name unit- , numInstanceDec name- , fractionalInstanceDec name- , toCssInstanceDec name ]+mkSizeType name' unit = do+ ddn <- dataDec name+ return [ ddn+ , showInstanceDec name unit+ , numInstanceDec name+ , fractionalInstanceDec name+ , toCssInstanceDec name ] where name = mkName $ name' -dataDec :: Name -> Dec-dataDec name = DataD [] name [] [constructor] derives- where constructor = NormalC name [(NotStrict, ConT $ mkName "Rational")]+dataDec :: Name -> Q Dec+dataDec name =+#if MIN_VERSION_template_haskell(2,11,0)+ DataD [] name [] Nothing [constructor] <$> mapM conT derives+#else+ return $ DataD [] name [] [constructor] derives+#endif+ where constructor = NormalC name [(notStrict, ConT $ mkName "Rational")] derives = map mkName ["Eq", "Ord"] showInstanceDec :: Name -> String -> Dec@@ -72,3 +84,11 @@ body = NormalB $ AppE (ConE name) (AppE (VarE fun) (VarE x)) fun = mkName fun' x = mkName "x"++#if MIN_VERSION_template_haskell(2,11,0)+notStrict :: Bang+notStrict = Bang NoSourceUnpackedness NoSourceStrictness+#else+notStrict :: Strict+notStrict = NotStrict+#endif
Text/Shakespeare/I18N.hs view
@@ -170,8 +170,12 @@ c2 <- mapM (sToClause prefix dt) sdef c3 <- defClause return $- ( if genType - then ((DataD [] mname [] (map (toCon dt) sdef) []) :)+ ( if genType+ then ((DataD [] mname []+#if MIN_VERSION_template_haskell(2,11,0)+ Nothing+#endif+ (map (toCon dt) sdef) []) :) else id) [ InstanceD []@@ -252,7 +256,7 @@ toCon dt (SDef c vs _) = RecC (mkName $ "Msg" ++ c) $ map go vs where- go (n, t) = (varName dt n, NotStrict, ConT $ mkName t)+ go (n, t) = (varName dt n, notStrict, ConT $ mkName t) varName :: String -> String -> Name varName a y =@@ -402,3 +406,11 @@ instance master ~ master' => RenderMessage master (SomeMessage master') where renderMessage a b (SomeMessage msg) = renderMessage a b msg++#if MIN_VERSION_template_haskell(2,11,0)+notStrict :: Bang+notStrict = Bang NoSourceUnpackedness NoSourceStrictness+#else+notStrict :: Strict+notStrict = NotStrict+#endif
shakespeare.cabal view
@@ -1,5 +1,5 @@ name: shakespeare-version: 2.0.8+version: 2.0.8.1 license: MIT license-file: LICENSE author: Michael Snoyman <michael@snoyman.com>