diff --git a/ChangeLog.md b/ChangeLog.md
--- a/ChangeLog.md
+++ b/ChangeLog.md
@@ -1,5 +1,9 @@
 # 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)
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/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.5.0.1
+Version:             0.5.0.2
 Synopsis:            Hamlet-style quasiquoter for XML content
 Homepage:            http://www.yesodweb.com/
 License:             BSD3
@@ -11,13 +12,12 @@
 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
+  Build-depends:       base                       >= 4.12     && < 5
                      , shakespeare                >= 1.0      && < 2.2
                      , xml-conduit                >= 1.0
                      , text                       >= 0.10
@@ -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
