diff --git a/doctemplates.cabal b/doctemplates.cabal
--- a/doctemplates.cabal
+++ b/doctemplates.cabal
@@ -1,5 +1,5 @@
 name:                doctemplates
-version:             0.2.2
+version:             0.2.2.1
 synopsis:            Pandoc-style document templates
 description:         A simple text templating system used by pandoc.
 homepage:            https://github.com/jgm/doctemplates#readme
@@ -28,6 +28,8 @@
                        parsec,
                        unordered-containers,
                        scientific
+  if !impl(ghc >= 8.0)
+    build-depends:     semigroups == 0.18.*
   default-language:    Haskell2010
   ghc-options:         -Wall -fno-warn-unused-do-bind
 
diff --git a/src/Text/DocTemplates.hs b/src/Text/DocTemplates.hs
--- a/src/Text/DocTemplates.hs
+++ b/src/Text/DocTemplates.hs
@@ -1,4 +1,4 @@
-{-# LANGUAGE TypeSynonymInstances, FlexibleInstances, CPP,
+{-# LANGUAGE TypeSynonymInstances, FlexibleInstances,
     OverloadedStrings, GeneralizedNewtypeDeriving, ScopedTypeVariables #-}
 {- |
    Module      : Text.Pandoc.Templates
@@ -97,18 +97,12 @@
 import Data.ByteString.Lazy (ByteString, fromChunks)
 import Data.Vector ((!?))
 import Data.Scientific (floatingOrInteger)
-#if MIN_VERSION_base(4,9,0)
 import Data.Semigroup (Semigroup)
-#endif
 
 -- | A 'Template' is essentially a function that takes
 -- a JSON 'Value' and produces 'Text'.
 newtype Template = Template { unTemplate :: Value -> Text }
-#if MIN_VERSION_base(4,9,0)
                  deriving (Semigroup, Monoid)
-#else
-                 deriving Monoid
-#endif
 
 type Variable = [Text]
 
