diff --git a/Setup.hs b/Setup.hs
deleted file mode 100644
--- a/Setup.hs
+++ /dev/null
@@ -1,2 +0,0 @@
-import Distribution.Simple
-main = defaultMain
diff --git a/Text/PrettyPrint/Compact/Core.hs b/Text/PrettyPrint/Compact/Core.hs
--- a/Text/PrettyPrint/Compact/Core.hs
+++ b/Text/PrettyPrint/Compact/Core.hs
@@ -50,14 +50,17 @@
   deriving (Eq,Ord,Show,Functor,Foldable,Traversable)
 
 instance Monoid a => Semigroup (L a) where
-  L (viewr -> xs :> x) <> L (viewl -> y :< ys) = L (xs <> singleton (x <> y) <> fmap (indent <>) ys)
-      where n = asLength x
-            indent = mkAS (P.replicate n ' ')
+  L (viewr -> xs :> x) <> L (viewl -> y :< ys) =
+    L (xs <> singleton (x <> y) <> indent ys) where
+
+    n      = asLength x
+    pad    = mkAS (P.replicate n ' ')
+    indent = if n == 0 then id else fmap (pad <>)
+
   L _ <> L _ = error "<> @L: invariant violated, Seq is empty"
 
 instance Monoid a => Monoid (L a) where
    mempty = L (singleton (mkAS ""))
-   mappend = (<>)
 
 instance Layout L where
    text = L . singleton . mkAS
@@ -156,6 +159,7 @@
 -- list sorted by lexicographic order for the first component
 -- function argument is the page width
 newtype ODoc a = MkDoc {fromDoc :: Int -> [(Pair M L a)]}
+  deriving Functor
 
 instance Monoid a => Semigroup (ODoc a) where
   MkDoc xs <> MkDoc ys = MkDoc $ \w -> bestsOn frst [ discardInvalid w [x <> y | y <- ys w] | x <- xs w]
@@ -217,12 +221,12 @@
   in bestsOn frst [horizontal,vertical]
 
 data Pair f g a = (:-:) {frst :: f a, scnd :: g a}
+  deriving (Functor,Foldable,Traversable)
 
 instance (Semigroup (f a), Semigroup (g a)) => Semigroup (Pair f g a) where
   (x :-: y) <> (x' :-: y') = (x <> x') :-: (y <> y')
 instance (Monoid (f a), Monoid (g a)) => Monoid (Pair f g a) where
   mempty = mempty :-: mempty
-  mappend (x :-: y)(x' :-: y') = (x `mappend` x') :-: (y `mappend` y')
 
 instance (Layout a, Layout b) => Layout (Pair a b) where
   text s = text s :-: text s
diff --git a/pretty-compact.cabal b/pretty-compact.cabal
--- a/pretty-compact.cabal
+++ b/pretty-compact.cabal
@@ -1,5 +1,6 @@
+Cabal-Version: 3.4
 name: pretty-compact
-version: 3.0
+version: 3.1
 synopsis: Pretty-printing library
 description:
   This package contains a pretty-printing library, a set of API's
@@ -10,19 +11,11 @@
   This library produces more compact outputs than both
   Wadler-Leijen or Hughes-PJ algorithms, at the expense of computational ressources.
   The core API is based on Hughes-PJ, but some combinators of the Leijen API are implemented as well.
-license: GPL
+license: LGPL-3.0-only
 license-file: LICENSE
 category: Text
 maintainer: Jean-Philippe Bernardy <jeanphilippe.bernardy@gmail.com>
 build-type: Simple
-Cabal-Version: >= 1.8
-tested-with:
-  GHC == 7.4.2,
-  GHC == 7.6.3,
-  GHC == 7.8.4,
-  GHC == 7.10.3,
-  GHC == 8.0.2,
-  GHC == 8.2.1
 
 source-repository head
                   type: git
@@ -34,12 +27,15 @@
     Text.PrettyPrint.Compact
     Text.PrettyPrint.Compact.Core
   build-depends:
-    base >= 3 && < 5,
-    base-compat >= 0.9.3 && <0.10,
-    containers
+    base >= 4.6 && < 5,
+    base-compat >= 0.9.3 && <0.12,
+    containers >= 0 && <666
 
   if !impl(ghc >= 8.0)
-    build-depends: semigroups
+    build-depends: semigroups >= 0 && <666
+
+  other-extensions:
+    LambdaCase
 
 benchmark pretty-comparison
   type: exitcode-stdio-1.0
