diff --git a/ChangeLog.md b/ChangeLog.md
--- a/ChangeLog.md
+++ b/ChangeLog.md
@@ -1,3 +1,17 @@
+# Changelog for xml-hamlet
+
+## 0.5.0.2
+
+* Compat with TH 2.18 [#172](https://github.com/snoyberg/xml/pull/172)
+
+## 0.5.0.1
+
+* Compat with GHC 8.8.1 [#147](https://github.com/snoyberg/xml/issues/147)
+
+## 0.5.0
+
+* Upgrade to conduit 1.3
+
 ## 0.4.1.1
 
 * Remove an upper bound
diff --git a/Text/Hamlet/XML.hs b/Text/Hamlet/XML.hs
--- a/Text/Hamlet/XML.hs
+++ b/Text/Hamlet/XML.hs
@@ -29,6 +29,13 @@
 import Control.Arrow (first, (***))
 import Data.List (intercalate)
 
+conP :: Name -> [Pat] -> Pat
+#if MIN_VERSION_template_haskell(2,18,0)
+conP name = ConP name []
+#else
+conP = ConP
+#endif
+
 -- | Convert some value to a list of attribute pairs.
 class ToAttributes a where
     toAttributes :: a -> Map.Map X.Name Text
@@ -77,7 +84,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
diff --git a/Text/Hamlet/XMLParse.hs b/Text/Hamlet/XMLParse.hs
--- a/Text/Hamlet/XMLParse.hs
+++ b/Text/Hamlet/XMLParse.hs
@@ -22,14 +22,19 @@
 data Result v = Error String | Ok v
     deriving (Show, Eq, Read, Data, Typeable)
 instance Monad Result where
-    return = Ok
+#if !MIN_VERSION_base(4,8,0)
+    return = pure
+#endif
     Error s >>= _ = Error s
     Ok v >>= f = f v
+#if MIN_VERSION_base(4,13,0)
+instance MonadFail Result where
+#endif
     fail = Error
 instance Functor Result where
     fmap = liftM
 instance Applicative Result where
-    pure = return
+    pure = Ok
     (<*>) = ap
 
 data Content = ContentRaw String
diff --git a/test/main.hs b/test/main.hs
--- a/test/main.hs
+++ b/test/main.hs
@@ -124,7 +124,7 @@
           justTrue = Just True
       in [xml|
 $case nothing
-    $of Just val
+    $of Just _val
     $of Nothing
         <one>
 $case justTrue
@@ -138,7 +138,7 @@
         $if val
             <three>
 $case Nothing
-    $of Just val
+    $of Just _val
     $of _
         <four>
 |] @?=
diff --git a/xml-hamlet.cabal b/xml-hamlet.cabal
--- a/xml-hamlet.cabal
+++ b/xml-hamlet.cabal
@@ -1,5 +1,6 @@
+Cabal-version:       >=1.10
 Name:                xml-hamlet
-Version:             0.4.1.1
+Version:             0.5.0.3
 Synopsis:            Hamlet-style quasiquoter for XML content
 Homepage:            http://www.yesodweb.com/
 License:             BSD3
@@ -11,14 +12,13 @@
 Description:         Hamlet-style quasiquoter for XML content
 Extra-source-files:  test/main.hs ChangeLog.md README.md
 
-Cabal-version:       >=1.8
-
 Library
+  default-language:    Haskell2010
   Exposed-modules:     Text.Hamlet.XML
   Other-modules:       Text.Hamlet.XMLParse
   
-  Build-depends:       base                       >= 4        && < 5
-                     , shakespeare                >= 1.0      && < 2.2
+  Build-depends:       base                       >= 4.12     && < 5
+                     , shakespeare                >= 1.0      && < 2.3
                      , xml-conduit                >= 1.0
                      , text                       >= 0.10
                      , template-haskell
@@ -28,6 +28,7 @@
   Ghc-options:         -Wall
 
 test-suite test
+  default-language:    Haskell2010
   main-is:             main.hs
   hs-source-dirs:      test
   type:                exitcode-stdio-1.0
