diff --git a/Math/ExpPairs.hs b/Math/ExpPairs.hs
--- a/Math/ExpPairs.hs
+++ b/Math/ExpPairs.hs
@@ -47,8 +47,8 @@
 import Data.List     (minimumBy)
 import Data.Monoid
 import Data.Ratio
-import Text.PrettyPrint.Leijen hiding ((<$>), (<>))
-import qualified Text.PrettyPrint.Leijen as PP
+import Data.Text.Prettyprint.Doc hiding ((<>))
+import qualified Data.Text.Prettyprint.Doc as PP
 import Text.Printf
 
 import Math.ExpPairs.LinearForm
@@ -117,10 +117,10 @@
   deriving (Show)
 
 instance Pretty OptimizeResult where
-  pretty (OptimizeResult r' ip p) = pretty1 r' PP.<$>
-    (parens (pretty (k%m) PP.<> comma PP.<> pretty (l%m)) <+> equals <+> pretty p </> pretty ip)
+  pretty (OptimizeResult r' ip p) = pretty1 r' <> PP.line <>
+    (parens (pretty (k%m) PP.<> comma PP.<> pretty (l%m)) <+> equals <+> pretty p <> softline <> pretty ip)
     where
-      pretty1 r@(Finite rr) = text (printf "%.6f" (fromRational rr :: Double)) <+> equals <+> pretty r
+      pretty1 r@(Finite rr) = pretty (printf "%.6f" (fromRational rr :: Double) :: String) <+> equals <+> pretty r
       pretty1 r = pretty r
 
       (k, l, m) = evalPath p $ initPairToProjValue ip
diff --git a/Math/ExpPairs/Kratzel.hs b/Math/ExpPairs/Kratzel.hs
--- a/Math/ExpPairs/Kratzel.hs
+++ b/Math/ExpPairs/Kratzel.hs
@@ -43,7 +43,7 @@
 import Data.Ratio
 import Data.Ord   (comparing)
 import Data.List  (minimumBy, sort, inits, tails)
-import Text.PrettyPrint.Leijen
+import Data.Text.Prettyprint.Doc
 
 import qualified Data.Map as M
 import qualified Data.Set as S
@@ -65,7 +65,7 @@
   deriving (Eq, Ord, Enum, Bounded, Show)
 
 instance Pretty TauabTheorem where
-  pretty = text . show
+  pretty = pretty . show
 
 divideResult :: Real a => a -> (b, OptimizeResult) -> (b, OptimizeResult)
 divideResult d = second (\o -> o {optimalValue = optimalValue o / Finite (toRational d)})
@@ -281,8 +281,8 @@
   deriving (Eq, Ord, Show)
 
 instance Pretty Theorem where
-  pretty NoTheorem = text ""
-  pretty Ivic = text "Ivic"
+  pretty NoTheorem = pretty ""
+  pretty Ivic = pretty "Ivic"
   pretty (Ab t) = pretty t
   pretty (Abc t) = pretty t
   pretty (Abcd t) = pretty t
diff --git a/Math/ExpPairs/LinearForm.hs b/Math/ExpPairs/LinearForm.hs
--- a/Math/ExpPairs/LinearForm.hs
+++ b/Math/ExpPairs/LinearForm.hs
@@ -25,12 +25,11 @@
 import Control.DeepSeq
 import Data.Foldable  (Foldable (..), toList)
 import Data.Maybe     (mapMaybe)
-#if __GLASGOW_HASKELL__ < 710
 import Data.Monoid    (Monoid, mempty, mappend)
-#endif
 import Data.Ratio     (numerator, denominator)
+import Data.Semigroup (Semigroup, (<>))
 import GHC.Generics   (Generic (..))
-import Text.PrettyPrint.Leijen
+import Data.Text.Prettyprint.Doc
 
 import Math.ExpPairs.RatioInf
 
@@ -44,12 +43,12 @@
   rnf = rnf . toList
 
 instance (Num t, Eq t, Pretty t) => Pretty (LinearForm t) where
-  pretty (LinearForm 0 0 0) = char '0'
+  pretty (LinearForm 0 0 0) = pretty "0"
   pretty (LinearForm a b c) = cat $ punctuate plus $ mapMaybe f [(a, 'k'), (b, 'l'), (c, 'm')] where
-    plus = space <> char '+' <> space
+    plus = space <> pretty "+" <> space
     f (0, _) = Nothing
-    f (1, t) = Just (char t)
-    f (r, t) = Just (pretty r <+> char '*' <+> char t)
+    f (1, t) = Just (pretty t)
+    f (r, t) = Just (pretty r <+> pretty "*" <+> pretty t)
 
 instance Num t => Num (LinearForm t) where
   (LinearForm a b c) + (LinearForm d e f) = LinearForm (a+d) (b+e) (c+f)
@@ -59,9 +58,12 @@
   signum = error "Signum of LinearForm is undefined"
   fromInteger n = LinearForm 0 0 (fromInteger n)
 
+instance Num t => Semigroup (LinearForm t) where
+  (<>) = (+)
+
 instance Num t => Monoid (LinearForm t) where
   mempty  = 0
-  mappend = (+)
+  mappend = (<>)
 
 -- | Multiply a linear form by a given coefficient.
 scaleLF :: (Num t, Eq t) => t -> LinearForm t -> LinearForm t
@@ -84,7 +86,7 @@
 infix 5 :/:
 
 instance (Num t, Eq t, Pretty t) => Pretty (RationalForm t) where
-  pretty (l1 :/: l2) = parens (pretty l1) </> parens (pretty l2)
+  pretty (l1 :/: l2) = parens (pretty l1) <> softline <> parens (pretty l2)
 
 instance NFData t => NFData (RationalForm t) where
   rnf = rnf . toList
@@ -122,15 +124,15 @@
   deriving (Eq, Ord, Show, Enum, Bounded, Generic)
 
 instance Pretty IneqType where
-  pretty Strict    = text ">"
-  pretty NonStrict = text ">="
+  pretty Strict    = pretty ">"
+  pretty NonStrict = pretty ">="
 
 -- |A linear constraint of two variables.
 data Constraint t = Constraint !(LinearForm t) !IneqType
   deriving (Eq, Show, Functor, Foldable, Generic)
 
 instance (Num t, Eq t, Pretty t) => Pretty (Constraint t) where
-  pretty (Constraint lf ineq) = pretty lf <+> pretty ineq <+> int 0
+  pretty (Constraint lf ineq) = pretty lf <+> pretty ineq <+> pretty "0"
 
 instance NFData t => NFData (Constraint t) where
   rnf (Constraint l i) = i `seq` rnf l
diff --git a/Math/ExpPairs/Matrix3.hs b/Math/ExpPairs/Matrix3.hs
--- a/Math/ExpPairs/Matrix3.hs
+++ b/Math/ExpPairs/Matrix3.hs
@@ -33,7 +33,7 @@
 import Data.Foldable  (Foldable (..), toList)
 import Data.List      (transpose)
 import GHC.Generics   (Generic (..))
-import Text.PrettyPrint.Leijen
+import Data.Text.Prettyprint.Doc
 
 -- |Matrix of order 3. Instances of 'Num' and 'Fractional'
 -- are given in terms of the multiplicative group of matrices,
diff --git a/Math/ExpPairs/Pair.hs b/Math/ExpPairs/Pair.hs
--- a/Math/ExpPairs/Pair.hs
+++ b/Math/ExpPairs/Pair.hs
@@ -30,7 +30,7 @@
 import Data.Maybe
 import Data.Ratio
 import GHC.Generics (Generic (..))
-import Text.PrettyPrint.Leijen
+import Data.Text.Prettyprint.Doc
 
 -- |Vertices of the triangle of initial exponent pairs.
 data Triangle
@@ -49,7 +49,7 @@
   deriving (Show, Bounded, Enum, Eq, Ord, Generic)
 
 instance Pretty Triangle where
-  pretty = text . show
+  pretty = pretty . show
 
 -- |Type to hold an initial exponent pair.
 data InitPair' t
@@ -69,17 +69,17 @@
 -- 'Corput16', 'HuxW87b1' and 'Hux05'
 type InitPair = InitPair' Rational
 
-instance Pretty Rational where
-  pretty = rational
+instance (Integral a, Show a) => Pretty (Ratio a) where
+  pretty = pretty . show
 
 instance (Pretty t, Num t, Eq t) => Pretty (InitPair' t) where
-  pretty Corput01 = parens (rational 0     <> comma <+> rational 1)
-  pretty Corput12 = parens (rational (1%2) <> comma <+> rational (1%2))
+  pretty Corput01 = parens (pretty (0%1) <> comma <+> pretty (1%1))
+  pretty Corput12 = parens (pretty (1%2) <> comma <+> pretty (1%2))
   pretty (Mix r1 r2) = cat $ punctuate plus $ mapMaybe f [(r1, Corput16), (r2, HuxW87b1), (1 - r1 - r2, Hux05)] where
-    plus = space <> char '+' <> space
+    plus = space <> pretty "+" <> space
     f (0, _) = Nothing
     f (1, t) = Just (pretty t)
-    f (r, t) = Just (pretty r <+> char '*' <+> pretty t)
+    f (r, t) = Just (pretty r <+> pretty "*" <+> pretty t)
 
 sect :: Integer
 sect = 30
diff --git a/Math/ExpPairs/PrettyProcess.hs b/Math/ExpPairs/PrettyProcess.hs
--- a/Math/ExpPairs/PrettyProcess.hs
+++ b/Math/ExpPairs/PrettyProcess.hs
@@ -14,14 +14,16 @@
 -}
 {-# LANGUAGE LambdaCase      #-}
 {-# OPTIONS_GHC -fno-warn-type-defaults #-}
+{-# OPTIONS_GHC -fno-warn-unused-imports #-}
 module Math.ExpPairs.PrettyProcess
   ( prettify,
     uglify,
     PrettyProcess) where
 
 import Data.List                (minimumBy, inits, tails)
+import Data.Monoid              (mempty)
 import Data.Ord                 (comparing)
-import Text.PrettyPrint.Leijen
+import Data.Text.Prettyprint.Doc
 
 import qualified Data.Map as M
 import qualified Data.Set as S
@@ -39,11 +41,11 @@
 
 instance Pretty PrettyProcess where
   pretty = \case
-    Simply xs    -> hsep (map (text . show) xs)
-    Repeat _  0  -> empty
+    Simply xs    -> hsep (map (pretty . show) xs)
+    Repeat _  0  -> mempty
     Repeat xs 1  -> pretty xs
-    Repeat (Simply [A]) n -> text (show A) <> char '^' <> int n
-    Repeat xs n  -> parens (pretty xs) <> char '^' <> int n
+    Repeat (Simply [A]) n -> pretty (show A) <> pretty "^" <> pretty n
+    Repeat xs n  -> parens (pretty xs) <> pretty "^" <> pretty n
     Sequence a b -> pretty a <+> pretty b
 
 -- | Width of the bracket.
diff --git a/Math/ExpPairs/Process.hs b/Math/ExpPairs/Process.hs
--- a/Math/ExpPairs/Process.hs
+++ b/Math/ExpPairs/Process.hs
@@ -23,8 +23,9 @@
   ) where
 
 import GHC.Generics             (Generic)
-import Data.Monoid
-import Text.PrettyPrint.Leijen hiding ((<>))
+import Data.Monoid              (Monoid, mempty, mappend)
+import Data.Semigroup           (Semigroup, (<>))
+import Data.Text.Prettyprint.Doc hiding ((<>))
 
 import Math.ExpPairs.ProcessMatrix
 import Math.ExpPairs.PrettyProcess
@@ -34,9 +35,12 @@
 data Path = Path !ProcessMatrix ![Process]
   deriving (Eq, Show, Generic)
 
+instance Semigroup Path where
+  Path m1 p1 <> Path m2 p2 = Path (m1 <> m2) (p1 <> p2)
+
 instance Monoid Path where
   mempty  = Path mempty mempty
-  mappend (Path m1 p1) (Path m2 p2) = Path (m1 <> m2) (p1 <> p2)
+  mappend = (<>)
 
 instance Pretty Path where
   pretty (Path _ l) = pretty (prettify l)
diff --git a/Math/ExpPairs/ProcessMatrix.hs b/Math/ExpPairs/ProcessMatrix.hs
--- a/Math/ExpPairs/ProcessMatrix.hs
+++ b/Math/ExpPairs/ProcessMatrix.hs
@@ -23,11 +23,10 @@
   , evalMatrix
   ) where
 
-#if __GLASGOW_HASKELL__ < 710
 import Data.Monoid           (Monoid, mempty, mappend)
-#endif
+import Data.Semigroup        (Semigroup, (<>))
 import GHC.Generics          (Generic (..))
-import Text.PrettyPrint.Leijen
+import Data.Text.Prettyprint.Doc
 
 import Math.ExpPairs.Matrix3
 
@@ -40,15 +39,18 @@
   deriving (Eq, Show, Read, Ord, Enum, Generic)
 
 instance Pretty Process where
-  pretty = text . show
+  pretty = pretty . show
 
 -- | Sequence of processes, represented as a matrix 3x3.
 newtype ProcessMatrix = ProcessMatrix (Matrix3 Integer)
   deriving (Eq, Num, Show, Pretty)
 
+instance Semigroup ProcessMatrix where
+  ProcessMatrix a <> ProcessMatrix b = ProcessMatrix $ normalize $ a * b
+
 instance Monoid ProcessMatrix where
   mempty = 1
-  mappend (ProcessMatrix a) (ProcessMatrix b) = ProcessMatrix $ normalize $ a * b
+  mappend = (<>)
 
 process2matrix :: Process -> ProcessMatrix
 process2matrix  A = ProcessMatrix $ Matrix3 1 0 0 1 1 1  2 0 2
diff --git a/Math/ExpPairs/RatioInf.hs b/Math/ExpPairs/RatioInf.hs
--- a/Math/ExpPairs/RatioInf.hs
+++ b/Math/ExpPairs/RatioInf.hs
@@ -18,7 +18,7 @@
   ) where
 
 import Data.Ratio (Ratio, numerator, denominator)
-import Text.PrettyPrint.Leijen
+import Data.Text.Prettyprint.Doc
 
 -- |Extends a rational type with positive and negative
 -- infinities.
@@ -36,11 +36,11 @@
 type RationalInf = RatioInf Integer
 
 instance (Integral t, Pretty t) => Pretty (RatioInf t) where
-  pretty InfMinus   = text "-Inf"
+  pretty InfMinus   = pretty "-Inf"
   pretty (Finite x)
     | denominator x == 1 = pretty (numerator x)
-    | otherwise          = pretty (numerator x) <+> char '/' <+> pretty (denominator x)
-  pretty InfPlus    = text "+Inf"
+    | otherwise          = pretty (numerator x) <+> pretty "/" <+> pretty (denominator x)
+  pretty InfPlus    = pretty "+Inf"
 
 instance Integral t => Num (RatioInf t) where
   InfMinus + InfPlus = error "Cannot add up negative and positive infinities"
diff --git a/exp-pairs.cabal b/exp-pairs.cabal
--- a/exp-pairs.cabal
+++ b/exp-pairs.cabal
@@ -1,5 +1,5 @@
 name:                exp-pairs
-version:             0.1.5.2
+version:             0.1.6.0
 synopsis:            Linear programming over exponent pairs
 description:         Package implements an algorithm to minimize rational objective function over the set of exponent pairs
 homepage:            https://github.com/Bodigrim/exp-pairs
@@ -30,9 +30,11 @@
                        Math.ExpPairs.RatioInf
   build-depends:       base >=4 && <5,
                        ghc-prim,
-                       wl-pprint >=1.2,
+                       prettyprinter,
                        deepseq >=1.3,
                        containers
+  if impl(ghc < 8.0)
+    build-depends:     semigroups >= 0.8
   default-language:    Haskell2010
   ghc-options:         -Wall -fno-warn-type-defaults
 
