diff --git a/doctest/DoctestDriver.hs b/doctest/DoctestDriver.hs
new file mode 100644
--- /dev/null
+++ b/doctest/DoctestDriver.hs
@@ -0,0 +1,12 @@
+{-# LANGUAGE CPP #-}
+
+#if MIN_VERSION_GLASGOW_HASKELL(8,4,4,0)
+{-# OPTIONS_GHC -F -pgmF doctest-discover #-}
+#else
+module Main where
+
+import qualified System.IO as IO
+
+main :: IO ()
+main = IO.putStrLn "WARNING: doctest will not run on GHC versions earlier than 8.4.4"
+#endif
diff --git a/hw-excess.cabal b/hw-excess.cabal
--- a/hw-excess.cabal
+++ b/hw-excess.cabal
@@ -1,7 +1,7 @@
 cabal-version: 2.2
 
 name:                   hw-excess
-version:                0.2.2.1
+version:                0.2.2.2
 synopsis:               Excess
 description:            Please see README.md
 category:               Data, Succinct Data Structures, Data Structures
@@ -20,24 +20,29 @@
   type: git
   location: https://github.com/haskell-works/hw-excess
 
-common base                 { build-depends: base               >= 4.8      &&  < 5     }
+common base                     { build-depends: base                     >= 4.8        &&  < 5     }
 
-common bytestring           { build-depends: bytestring         >= 0.10     && < 0.11   }
-common criterion            { build-depends: criterion          >= 1.4      && < 1.6    }
-common hedgehog             { build-depends: hedgehog           >= 0.6      && < 1.1    }
-common hspec                { build-depends: hspec              >= 2.3      && < 3      }
-common hw-bits              { build-depends: hw-bits            >= 0.4.0.0  && < 0.8    }
-common hw-hspec-hedgehog    { build-depends: hw-hspec-hedgehog  >= 0.1.0.4  && < 0.2    }
-common hw-prim              { build-depends: hw-prim            >= 0.6.2.24 && < 0.7    }
-common hw-rankselect-base   { build-depends: hw-rankselect-base >= 0.2.0.0  && < 0.4    }
-common QuickCheck           { build-depends: QuickCheck         >= 2.10     && < 2.14   }
-common safe                 { build-depends: safe               >= 0.2      && < 0.4    }
-common vector               { build-depends: vector             >= 0.12     && < 0.13   }
+common bytestring               { build-depends: bytestring               >= 0.10       && < 0.11   }
+common criterion                { build-depends: criterion                >= 1.4        && < 1.6    }
+common doctest                  { build-depends: doctest                  >= 0.16.2     && < 0.17   }
+common doctest-discover         { build-depends: doctest-discover         >= 0.2        && < 0.3    }
+common hedgehog                 { build-depends: hedgehog                 >= 0.6        && < 1.1    }
+common hspec                    { build-depends: hspec                    >= 2.3        && < 3      }
+common hw-bits                  { build-depends: hw-bits                  >= 0.4.0.0    && < 0.8    }
+common hw-hspec-hedgehog        { build-depends: hw-hspec-hedgehog        >= 0.1.0.4    && < 0.2    }
+common hw-prim                  { build-depends: hw-prim                  >= 0.6.2.24   && < 0.7    }
+common hw-rankselect-base       { build-depends: hw-rankselect-base       >= 0.2.0.0    && < 0.4    }
+common QuickCheck               { build-depends: QuickCheck               >= 2.10       && < 2.14   }
+common safe                     { build-depends: safe                     >= 0.2        && < 0.4    }
+common vector                   { build-depends: vector                   >= 0.12       && < 0.13   }
 
 common config
   default-language:     Haskell2010
   ghc-options:          -Wall -O2 -msse4.2
 
+common hw-excess
+  build-depends:        hw-excess
+
 library
   import:               base, config
                       , hw-bits
@@ -81,7 +86,6 @@
   ghc-options:          -threaded -rtsopts -with-rtsopts=-N
   build-tool-depends:   hspec-discover:hspec-discover
   build-depends:        hw-excess
-  autogen-modules:      Paths_hw_excess
   other-modules:        HaskellWorks.Data.Excess.Internal.BranchlessSpec
                         HaskellWorks.Data.Excess.MinExcess0Spec
                         HaskellWorks.Data.Excess.MinExcess1Spec
@@ -91,7 +95,6 @@
                         HaskellWorks.Data.Excess.PartialMinExcess1Spec
                         HaskellWorks.Data.Excess.PartialMinMaxExcess0Spec
                         HaskellWorks.Data.Excess.PartialMinMaxExcess1Spec
-                        Paths_hw_excess
 
 benchmark bench
   import:               base, config
@@ -103,4 +106,15 @@
   main-is:              Main.hs
   hs-source-dirs:       bench
   build-depends:        hw-excess
-  other-modules:        Paths_hw_excess
+
+test-suite doctest
+  import:               base, config
+                      , doctest
+                      , doctest-discover
+                      , hw-excess
+  default-language:     Haskell2010
+  type:                 exitcode-stdio-1.0
+  ghc-options:          -threaded
+  main-is:              DoctestDriver.hs
+  HS-Source-Dirs:       doctest
+  build-tool-depends:   doctest-discover:doctest-discover
diff --git a/src/HaskellWorks/Data/Excess/Internal/Partial/Table.hs b/src/HaskellWorks/Data/Excess/Internal/Partial/Table.hs
--- a/src/HaskellWorks/Data/Excess/Internal/Partial/Table.hs
+++ b/src/HaskellWorks/Data/Excess/Internal/Partial/Table.hs
@@ -19,39 +19,39 @@
 import qualified HaskellWorks.Data.Excess.Internal.Triplet8 as T8
 
 tableWord8Excess0Lo :: DVS.Vector Int8
-tableWord8Excess0Lo = DVS.constructN (256 * 9) go
-  where go :: DVS.Vector Int8 -> Int8
-        go u =  let ui = DVS.length u in T8.triplet8Lo (genWord8Excess0 (ui `div` 256) (fromIntegral ui))
+tableWord8Excess0Lo = DVS.generate (256 * 9) go
+  where go :: Int -> Int8
+        go i = T8.triplet8Lo (genWord8Excess0 (i `div` 256) (fromIntegral i))
 {-# NOINLINE tableWord8Excess0Lo #-}
 
 tableWord8Excess0Ex :: DVS.Vector Int8
-tableWord8Excess0Ex = DVS.constructN (256 * 9) go
-  where go :: DVS.Vector Int8 -> Int8
-        go u =  let ui = DVS.length u in T8.triplet8Ex (genWord8Excess0 (ui `div` 256) (fromIntegral ui))
+tableWord8Excess0Ex = DVS.generate (256 * 9) go
+  where go :: Int -> Int8
+        go i = T8.triplet8Ex (genWord8Excess0 (i `div` 256) (fromIntegral i))
 {-# NOINLINE tableWord8Excess0Ex #-}
 
 tableWord8Excess0Hi :: DVS.Vector Int8
-tableWord8Excess0Hi = DVS.constructN (256 * 9) go
-  where go :: DVS.Vector Int8 -> Int8
-        go u =  let ui = DVS.length u in T8.triplet8Hi (genWord8Excess0 (ui `div` 256) (fromIntegral ui))
+tableWord8Excess0Hi = DVS.generate (256 * 9) go
+  where go :: Int -> Int8
+        go i = T8.triplet8Hi (genWord8Excess0 (i `div` 256) (fromIntegral i))
 {-# NOINLINE tableWord8Excess0Hi #-}
 
 tableWord8Excess1Lo :: DVS.Vector Int8
-tableWord8Excess1Lo = DVS.constructN (256 * 9) go
-  where go :: DVS.Vector Int8 -> Int8
-        go u =  let ui = DVS.length u in T8.triplet8Lo (genWord8Excess1 (ui `div` 256) (fromIntegral ui))
+tableWord8Excess1Lo = DVS.generate (256 * 9) go
+  where go :: Int -> Int8
+        go i = T8.triplet8Lo (genWord8Excess1 (i `div` 256) (fromIntegral i))
 {-# NOINLINE tableWord8Excess1Lo #-}
 
 tableWord8Excess1Ex :: DVS.Vector Int8
-tableWord8Excess1Ex = DVS.constructN (256 * 9) go
-  where go :: DVS.Vector Int8 -> Int8
-        go u =  let ui = DVS.length u in T8.triplet8Ex (genWord8Excess1 (ui `div` 256) (fromIntegral ui))
+tableWord8Excess1Ex = DVS.generate (256 * 9) go
+  where go :: Int -> Int8
+        go i = T8.triplet8Ex (genWord8Excess1 (i `div` 256) (fromIntegral i))
 {-# NOINLINE tableWord8Excess1Ex #-}
 
 tableWord8Excess1Hi :: DVS.Vector Int8
-tableWord8Excess1Hi = DVS.constructN (256 * 9) go
-  where go :: DVS.Vector Int8 -> Int8
-        go u =  let ui = DVS.length u in T8.triplet8Hi (genWord8Excess1 (ui `div` 256) (fromIntegral ui))
+tableWord8Excess1Hi = DVS.generate (256 * 9) go
+  where go :: Int -> Int8
+        go i = T8.triplet8Hi (genWord8Excess1 (i `div` 256) (fromIntegral i))
 {-# NOINLINE tableWord8Excess1Hi #-}
 
 genWord8Excess0 :: Int -> Word8 -> Triplet8
diff --git a/test/HaskellWorks/Data/Excess/Internal/BranchlessSpec.hs b/test/HaskellWorks/Data/Excess/Internal/BranchlessSpec.hs
--- a/test/HaskellWorks/Data/Excess/Internal/BranchlessSpec.hs
+++ b/test/HaskellWorks/Data/Excess/Internal/BranchlessSpec.hs
@@ -8,8 +8,8 @@
 import qualified Hedgehog.Gen                                 as G
 import qualified Hedgehog.Range                               as R
 
-{-# ANN module ("HLint: Ignore Redundant do" :: String) #-}
-{-# ANN module ("HLint: Ignore Reduce duplication"  :: String) #-}
+{-# ANN module ("HLint: ignore Redundant do" :: String) #-}
+{-# ANN module ("HLint: ignore Reduce duplication"  :: String) #-}
 
 spec :: Spec
 spec = describe "HaskellWorks.Data.Excess.Internal.Branchless" $ do
diff --git a/test/HaskellWorks/Data/Excess/MinExcess0Spec.hs b/test/HaskellWorks/Data/Excess/MinExcess0Spec.hs
--- a/test/HaskellWorks/Data/Excess/MinExcess0Spec.hs
+++ b/test/HaskellWorks/Data/Excess/MinExcess0Spec.hs
@@ -17,8 +17,8 @@
 import qualified Hedgehog.Gen                                    as G
 import qualified Hedgehog.Range                                  as R
 
-{-# ANN module ("HLint: Ignore Redundant do" :: String) #-}
-{-# ANN module ("HLint: Ignore Reduce duplication"  :: String) #-}
+{-# ANN module ("HLint: ignore Redundant do" :: String) #-}
+{-# ANN module ("HLint: ignore Reduce duplication"  :: String) #-}
 
 spec :: Spec
 spec = describe "HaskellWorks.Data.Excess.MinExcess0Spec" $ do
diff --git a/test/HaskellWorks/Data/Excess/MinExcess1Spec.hs b/test/HaskellWorks/Data/Excess/MinExcess1Spec.hs
--- a/test/HaskellWorks/Data/Excess/MinExcess1Spec.hs
+++ b/test/HaskellWorks/Data/Excess/MinExcess1Spec.hs
@@ -17,8 +17,8 @@
 import qualified Hedgehog.Gen                                    as G
 import qualified Hedgehog.Range                                  as R
 
-{-# ANN module ("HLint: Ignore Redundant do" :: String) #-}
-{-# ANN module ("HLint: Ignore Reduce duplication"  :: String) #-}
+{-# ANN module ("HLint: ignore Redundant do" :: String) #-}
+{-# ANN module ("HLint: ignore Reduce duplication"  :: String) #-}
 
 spec :: Spec
 spec = describe "HaskellWorks.Data.Excess.MinExcess1Spec" $ do
diff --git a/test/HaskellWorks/Data/Excess/MinMaxExcess0Spec.hs b/test/HaskellWorks/Data/Excess/MinMaxExcess0Spec.hs
--- a/test/HaskellWorks/Data/Excess/MinMaxExcess0Spec.hs
+++ b/test/HaskellWorks/Data/Excess/MinMaxExcess0Spec.hs
@@ -17,8 +17,8 @@
 import qualified Hedgehog.Gen                                    as G
 import qualified Hedgehog.Range                                  as R
 
-{-# ANN module ("HLint: Ignore Redundant do" :: String) #-}
-{-# ANN module ("HLint: Ignore Reduce duplication"  :: String) #-}
+{-# ANN module ("HLint: ignore Redundant do" :: String) #-}
+{-# ANN module ("HLint: ignore Reduce duplication"  :: String) #-}
 
 spec :: Spec
 spec = describe "HaskellWorks.Data.Excess.MinMaxExcess0Spec" $ do
diff --git a/test/HaskellWorks/Data/Excess/MinMaxExcess1Spec.hs b/test/HaskellWorks/Data/Excess/MinMaxExcess1Spec.hs
--- a/test/HaskellWorks/Data/Excess/MinMaxExcess1Spec.hs
+++ b/test/HaskellWorks/Data/Excess/MinMaxExcess1Spec.hs
@@ -17,8 +17,8 @@
 import qualified Hedgehog.Gen                                    as G
 import qualified Hedgehog.Range                                  as R
 
-{-# ANN module ("HLint: Ignore Redundant do" :: String) #-}
-{-# ANN module ("HLint: Ignore Reduce duplication"  :: String) #-}
+{-# ANN module ("HLint: ignore Redundant do" :: String) #-}
+{-# ANN module ("HLint: ignore Reduce duplication"  :: String) #-}
 
 spec :: Spec
 spec = describe "HaskellWorks.Data.Excess.MinMaxExcess1Spec" $ do
diff --git a/test/HaskellWorks/Data/Excess/PartialMinExcess0Spec.hs b/test/HaskellWorks/Data/Excess/PartialMinExcess0Spec.hs
--- a/test/HaskellWorks/Data/Excess/PartialMinExcess0Spec.hs
+++ b/test/HaskellWorks/Data/Excess/PartialMinExcess0Spec.hs
@@ -12,8 +12,8 @@
 import qualified Hedgehog.Gen   as G
 import qualified Hedgehog.Range as R
 
-{-# ANN module ("HLint: Ignore Redundant do" :: String) #-}
-{-# ANN module ("HLint: Ignore Reduce duplication"  :: String) #-}
+{-# ANN module ("HLint: ignore Redundant do" :: String) #-}
+{-# ANN module ("HLint: ignore Reduce duplication"  :: String) #-}
 
 spec :: Spec
 spec = describe "HaskellWorks.Data.Excess.PartialMinExcess0Spec" $ do
diff --git a/test/HaskellWorks/Data/Excess/PartialMinExcess1Spec.hs b/test/HaskellWorks/Data/Excess/PartialMinExcess1Spec.hs
--- a/test/HaskellWorks/Data/Excess/PartialMinExcess1Spec.hs
+++ b/test/HaskellWorks/Data/Excess/PartialMinExcess1Spec.hs
@@ -12,8 +12,8 @@
 import qualified Hedgehog.Gen   as G
 import qualified Hedgehog.Range as R
 
-{-# ANN module ("HLint: Ignore Redundant do" :: String) #-}
-{-# ANN module ("HLint: Ignore Reduce duplication"  :: String) #-}
+{-# ANN module ("HLint: ignore Redundant do" :: String) #-}
+{-# ANN module ("HLint: ignore Reduce duplication"  :: String) #-}
 
 spec :: Spec
 spec = describe "HaskellWorks.Data.Excess.PartialMinExcess1Spec" $ do
diff --git a/test/HaskellWorks/Data/Excess/PartialMinMaxExcess0Spec.hs b/test/HaskellWorks/Data/Excess/PartialMinMaxExcess0Spec.hs
--- a/test/HaskellWorks/Data/Excess/PartialMinMaxExcess0Spec.hs
+++ b/test/HaskellWorks/Data/Excess/PartialMinMaxExcess0Spec.hs
@@ -12,8 +12,8 @@
 import qualified Hedgehog.Gen   as G
 import qualified Hedgehog.Range as R
 
-{-# ANN module ("HLint: Ignore Redundant do" :: String) #-}
-{-# ANN module ("HLint: Ignore Reduce duplication"  :: String) #-}
+{-# ANN module ("HLint: ignore Redundant do" :: String) #-}
+{-# ANN module ("HLint: ignore Reduce duplication"  :: String) #-}
 
 spec :: Spec
 spec = describe "HaskellWorks.Data.Excess.PartialMinMaxExcess0Spec" $ do
diff --git a/test/HaskellWorks/Data/Excess/PartialMinMaxExcess1Spec.hs b/test/HaskellWorks/Data/Excess/PartialMinMaxExcess1Spec.hs
--- a/test/HaskellWorks/Data/Excess/PartialMinMaxExcess1Spec.hs
+++ b/test/HaskellWorks/Data/Excess/PartialMinMaxExcess1Spec.hs
@@ -12,8 +12,8 @@
 import qualified Hedgehog.Gen   as G
 import qualified Hedgehog.Range as R
 
-{-# ANN module ("HLint: Ignore Redundant do" :: String) #-}
-{-# ANN module ("HLint: Ignore Reduce duplication"  :: String) #-}
+{-# ANN module ("HLint: ignore Redundant do" :: String) #-}
+{-# ANN module ("HLint: ignore Reduce duplication"  :: String) #-}
 
 spec :: Spec
 spec = describe "HaskellWorks.Data.Excess.PartialMinMaxExcess1Spec" $ do
