diff --git a/Text/XHtml/Internals.hs b/Text/XHtml/Internals.hs index 7d5ac22af6942634a542d2f53b71458a2fe25907..7de94d52fcaa2baa1ffdf9fd688cb2ff787585a5 100644 --- a/Text/XHtml/Internals.hs +++ b/Text/XHtml/Internals.hs @@ -1,4 +1,3 @@ -{-# LANGUAGE CPP #-} {-# OPTIONS_HADDOCK hide #-} ----------------------------------------------------------------------------- @@ -17,9 +16,7 @@ module Text.XHtml.Internals where import Data.Char -#if __GLASGOW_HASKELL__ <= 708 -import Data.Monoid -#endif +import qualified Data.Semigroup as Sem infixr 2 +++ -- combining Html infixr 7 << -- nesting Html @@ -66,9 +63,13 @@ instance Show HtmlAttr where showString "=" . shows val -instance Monoid Html where +-- | @since 3000.2.2 +instance Sem.Semigroup Html where + (<>) = (+++) + +instance Sem.Monoid Html where mempty = noHtml - mappend = (+++) + mappend = (Sem.<>) -- | HTML is the class of things that can be validly put -- inside an HTML tag. So this can be one or more 'Html' elements, diff --git a/xhtml.cabal b/xhtml.cabal index 6b7676ea1f580f2debcc94ba1cb16c3aa381bc81..104bc641421204153db5d0166ea874d72cf3f2d7 100644 --- a/xhtml.cabal +++ b/xhtml.cabal @@ -1,5 +1,5 @@ Name: xhtml -Version: 3000.2.1 +Version: 3000.2.2 Copyright: Bjorn Bringert 2004-2006, Andy Gill and the Oregon Graduate Institute of Science and Technology, 1999-2001 Maintainer: Chris Dornan <chris@chrisdornan.com> @@ -23,11 +23,22 @@ Source-repository head library Default-Language: Haskell2010 - Other-Extensions: CPP if impl(ghc >= 7.2) Default-Extensions: Safe - Build-depends: base >= 4 && < 5 + Build-depends: base >= 4 && < 5 + if impl(ghc >= 8.0) + -- Enable warnings about potential future incompatibilities + ghc-options: -Wcompat -Wnoncanonical-monadfail-instances -Wnoncanonical-monad-instances + else + -- This provides compatibility with versions prior to GHC 8.0 / base-4.9, when `Data.Semigroup` + -- still lived in `semigroups`. + + -- Note: semigroups-0.8 is a reasonably early version depending only on base & containers, + -- and `xhtml` only needs to define the class instance + -- so we can easily support a wide range of major + -- versions of `semigroups` + Build-depends: semigroups >= 0.8 && < 0.19 Exposed-modules: Text.XHtml,