diff --git a/heterocephalus.cabal b/heterocephalus.cabal
--- a/heterocephalus.cabal
+++ b/heterocephalus.cabal
@@ -1,5 +1,5 @@
 name:                heterocephalus
-version:             1.0.5.1
+version:             1.0.5.2
 synopsis:            A type-safe template engine for working with popular front end development tools
 description:
     Recent front end development tools and languages are growing fast and have
@@ -47,6 +47,10 @@
                      , transformers
   ghc-options:         -Wall
   default-language:    Haskell2010
+  if impl(ghc >= 8.0)
+    ghc-options: -Wcompat -Wnoncanonical-monad-instances -Wnoncanonical-monadfail-instances
+  else
+    build-depends: fail == 4.9.*, semigroups == 0.17.*
 
 test-suite heterocephalus-test
   type:                exitcode-stdio-1.0
diff --git a/src/Text/Heterocephalus.hs b/src/Text/Heterocephalus.hs
--- a/src/Text/Heterocephalus.hs
+++ b/src/Text/Heterocephalus.hs
@@ -64,6 +64,7 @@
 import qualified Data.DList as DList
 import qualified Data.Foldable as F
 import Data.List (intercalate)
+import qualified Data.Semigroup as Sem
 import Data.String (IsString(..))
 import Data.Text (Text, pack)
 import qualified Data.Text.Lazy as TL
@@ -433,9 +434,14 @@
 runScopeM (PureScopeM _) =
   (mempty, mempty)
 
+instance Sem.Semigroup (ScopeM ()) where
+  a <> b  = a >> b
+
 instance Monoid (ScopeM ()) where
   mempty = pure ()
-  mappend a b = a >> b
+#if !(MIN_VERSION_base(4,11,0))
+  mappend = (Sem.<>)
+#endif
 
 instance Functor ScopeM where
   fmap f (SetDefault ident qexp next) =
