diff --git a/Text/Hamlet.hs b/Text/Hamlet.hs index c8e4e786..2e1074b0 100644 --- a/Text/Hamlet.hs +++ b/Text/Hamlet.hs @@ -1,3 +1,4 @@ +{-# LANGUAGE CPP #-} {-# LANGUAGE TemplateHaskell #-} {-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE FlexibleInstances #-} @@ -231,7 +232,11 @@ docToExp env hr scope (DocCond conds final) = do go (d, docs) = do let d' = derefToExp ((specialOrIdent, VarE 'or):scope) d docs' <- docsToExp env hr scope docs - return $ TupE [d', docs'] + return $ TupE +#if MIN_VERSION_template_haskell(2,16,0) + $ map Just +#endif + [d', docs'] docToExp env hr scope (DocCase deref cases) = do let exp_ = derefToExp scope deref matches <- mapM toMatch cases @@ -538,7 +543,11 @@ hamletFileReloadWithSettings hrr settings fp = do vtToExp (d, vt) = do d' <- lift d c' <- toExp vt - return $ TupE [d', c' `AppE` derefToExp [] d] + return $ TupE +#if MIN_VERSION_template_haskell(2,16,0) + $ map Just +#endif + [d', c' `AppE` derefToExp [] d] where toExp = c where diff --git a/Text/Internal/Css.hs b/Text/Internal/Css.hs index a76e4a57..66ed0b63 100644 --- a/Text/Internal/Css.hs +++ b/Text/Internal/Css.hs @@ -1,6 +1,7 @@ {-# OPTIONS_HADDOCK hide #-} -- | This module is only being exposed to work around a GHC bug, its API is not stable +{-# LANGUAGE CPP #-} {-# LANGUAGE TemplateHaskell #-} {-# LANGUAGE GADTs #-} {-# LANGUAGE GeneralizedNewtypeDeriving #-} @@ -281,7 +282,11 @@ vtToExp :: (Deref, VarType) -> Q Exp vtToExp (d, vt) = do d' <- lift d c' <- c vt - return $ TupE [d', c' `AppE` derefToExp [] d] + return $ TupE +#if MIN_VERSION_template_haskell(2,16,0) + $ map Just +#endif + [d', c' `AppE` derefToExp [] d] where c :: VarType -> Q Exp c VTPlain = [|CDPlain . toCss|] diff --git a/Text/Shakespeare.hs b/Text/Shakespeare.hs index 56ff2894..f0528f9a 100644 --- a/Text/Shakespeare.hs +++ b/Text/Shakespeare.hs @@ -429,7 +429,11 @@ shakespeareFileReload settings fp = do vtToExp (d, vt) = do d' <- lift d c' <- c vt - return $ TupE [d', c' `AppE` derefToExp [] d] + return $ TupE +#if MIN_VERSION_template_haskell(2,16,0) + $ map Just +#endif + [d', c' `AppE` derefToExp [] d] where c :: VarType -> Q Exp c VTPlain = [|EPlain . $(return $ diff --git a/Text/Shakespeare/Base.hs b/Text/Shakespeare/Base.hs index 3379ed34..1390252f 100644 --- a/Text/Shakespeare/Base.hs +++ b/Text/Shakespeare/Base.hs @@ -198,7 +198,11 @@ derefToExp _ (DerefIntegral i) = LitE $ IntegerL i derefToExp _ (DerefRational r) = LitE $ RationalL r derefToExp _ (DerefString s) = LitE $ StringL s derefToExp s (DerefList ds) = ListE $ map (derefToExp s) ds -derefToExp s (DerefTuple ds) = TupE $ map (derefToExp s) ds +derefToExp s (DerefTuple ds) = TupE $ +#if MIN_VERSION_template_haskell(2,16,0) + map Just $ +#endif + map (derefToExp s) ds -- FIXME shouldn't we use something besides a list here? flattenDeref :: Deref -> Maybe [String]