diff --git a/Setup.lhs b/Setup.lhs
--- a/Setup.lhs
+++ b/Setup.lhs
@@ -1,44 +1,35 @@
-#!/usr/bin/env runhaskell
 \begin{code}
+{-# LANGUAGE CPP #-}
 {-# OPTIONS_GHC -Wall #-}
 module Main (main) where
 
-import Data.List ( nub )
-import Data.Version ( showVersion )
-import Distribution.Package ( PackageName(PackageName), PackageId, InstalledPackageId, packageVersion, packageName )
-import Distribution.PackageDescription ( PackageDescription(), TestSuite(..) )
-import Distribution.Simple ( defaultMainWithHooks, UserHooks(..), simpleUserHooks )
-import Distribution.Simple.Utils ( rewriteFile, createDirectoryIfMissingVerbose )
-import Distribution.Simple.BuildPaths ( autogenModulesDir )
-import Distribution.Simple.Setup ( BuildFlags(buildVerbosity), fromFlag )
-import Distribution.Simple.LocalBuildInfo ( withLibLBI, withTestLBI, LocalBuildInfo(), ComponentLocalBuildInfo(componentPackageDeps) )
-import Distribution.Verbosity ( Verbosity )
-import System.FilePath ( (</>) )
+#ifndef MIN_VERSION_cabal_doctest
+#define MIN_VERSION_cabal_doctest(x,y,z) 0
+#endif
 
+#if MIN_VERSION_cabal_doctest(1,0,0)
+
+import Distribution.Extra.Doctest ( defaultMainWithDoctests )
 main :: IO ()
-main = defaultMainWithHooks simpleUserHooks
-  { buildHook = \pkg lbi hooks flags -> do
-     generateBuildModule (fromFlag (buildVerbosity flags)) pkg lbi
-     buildHook simpleUserHooks pkg lbi hooks flags
-  }
+main = defaultMainWithDoctests "doctests"
 
-generateBuildModule :: Verbosity -> PackageDescription -> LocalBuildInfo -> IO ()
-generateBuildModule verbosity pkg lbi = do
-  let dir = autogenModulesDir lbi
-  createDirectoryIfMissingVerbose verbosity True dir
-  withLibLBI pkg lbi $ \_ libcfg -> do
-    withTestLBI pkg lbi $ \suite suitecfg -> do
-      rewriteFile (dir </> "Build_" ++ testName suite ++ ".hs") $ unlines
-        [ "module Build_" ++ testName suite ++ " where"
-        , "deps :: [String]"
-        , "deps = " ++ (show $ formatdeps (testDeps libcfg suitecfg))
-        ]
-  where
-    formatdeps = map (formatone . snd)
-    formatone p = case packageName p of
-      PackageName n -> n ++ "-" ++ showVersion (packageVersion p)
+#else
 
-testDeps :: ComponentLocalBuildInfo -> ComponentLocalBuildInfo -> [(InstalledPackageId, PackageId)]
-testDeps xs ys = nub $ componentPackageDeps xs ++ componentPackageDeps ys
+#ifdef MIN_VERSION_Cabal
+-- If the macro is defined, we have new cabal-install,
+-- but for some reason we don't have cabal-doctest in package-db
+--
+-- Probably we are running cabal sdist, when otherwise using new-build
+-- workflow
+import Warning ()
+#endif
 
+import Distribution.Simple
+
+main :: IO ()
+main = defaultMain
+
+#endif
+
 \end{code}
+
diff --git a/Warning.hs b/Warning.hs
new file mode 100644
--- /dev/null
+++ b/Warning.hs
@@ -0,0 +1,5 @@
+module Warning
+  {-# WARNING ["You are configuring this package without cabal-doctest installed.",
+               "The doctests test-suite will not work as a result.",
+               "To fix this, install cabal-doctest before configuring."] #-}
+  () where
diff --git a/changelog.md b/changelog.md
--- a/changelog.md
+++ b/changelog.md
@@ -1,3 +1,15 @@
+0.3.2.1
+
+* Fixed Setup.hs to work with Cabal2
+
+0.3.2
+
+* Added `Generic` and `Generic1` instances for `Before`, `After`, `Between`, and `Between'`
+
+0.3.1
+
+* Added `Ord1` instances for `Before`, `After`, `Between`, and `Between'`
+
 0.3.0
 
 * Add `Foldable1` and `Traversable1` instances for `Pesarated1`.
diff --git a/separated.cabal b/separated.cabal
--- a/separated.cabal
+++ b/separated.cabal
@@ -1,5 +1,5 @@
 name:               separated
-version:            0.3.0
+version:            0.3.2.1
 license:            BSD3
 license-file:       LICENCE
 author:             Queensland Functional Programming Lab <oᴉ˙ldɟb@llǝʞsɐɥ>
@@ -15,15 +15,19 @@
 bug-reports:        https://github.com/qfpl/separated/issues
 cabal-version:      >= 1.10
 build-type:         Custom
-EXtra-source-files: changelog.md
-tested-with:        GHC == 7.10.3, GHC == 8.0.2, GHC == 8.2.1
+extra-source-files: changelog.md
+                    Warning.hs
+tested-with:        GHC == 7.10.3, GHC == 8.0.2, GHC == 8.2.2, GHC == 8.4.1
 
 source-repository   head
   type:             git
   location:         git@github.com:qfpl/separated.git
 
-flag                small_base
-  description:      Choose the new, split-up base package.
+custom-setup
+  setup-depends:
+    base          >= 4 && < 5,
+    Cabal         >= 1.10 && < 2.1,
+    cabal-doctest >= 1 && < 1.1
 
 library
   default-language:
@@ -66,7 +70,7 @@
 
   build-depends:
                     base               >= 4.7   && < 5
-                    , doctest          >= 0.9.7
+                    , doctest          >= 0.11 && < 0.14
                     , filepath         >= 1.3
                     , directory        >= 1.1
                     , QuickCheck       >= 2.0
diff --git a/src/Data/Separated.hs b/src/Data/Separated.hs
--- a/src/Data/Separated.hs
+++ b/src/Data/Separated.hs
@@ -60,7 +60,7 @@
 import Data.Semigroup.Traversable (Traversable1, traverse1)
 import Data.String(String)
 import Data.Traversable(Traversable, traverse)
-import Data.Tuple(fst, snd, uncurry)
+import Data.Tuple(snd, uncurry)
 import Prelude(Show(show), const, flip)
 
 -- $setup
diff --git a/src/Data/Separated/Between.hs b/src/Data/Separated/Between.hs
--- a/src/Data/Separated/Between.hs
+++ b/src/Data/Separated/Between.hs
@@ -1,5 +1,6 @@
 {-# language DeriveFunctor #-}
 {-# language DeriveFoldable #-}
+{-# language DeriveGeneric #-}
 {-# language DeriveTraversable #-}
 {-# language TemplateHaskell #-}
 module Data.Separated.Between
@@ -24,13 +25,15 @@
 import Data.Foldable
 import Data.Monoid
 import Data.Ord
+import GHC.Generics
 
 -- | An @a@ with an @s@ on the left and a @t@ on the right
 data Between s t a = Between s a t
-  deriving (Eq, Foldable, Functor, Ord, Traversable, Show)
+  deriving (Eq, Foldable, Functor, Ord, Traversable, Show, Generic, Generic1)
 
 deriveEq1 ''Between
 deriveShow1 ''Between
+deriveOrd1 ''Between
 
 -- | @'Between' s t a@ is isomorphic to @(s, a, t)@
 between :: Iso (s, a, s') (t, b, t') (Between s s' a) (Between t t' b) 
@@ -41,10 +44,11 @@
 
 -- | An @a@ with an @s@ on each side
 data Between' s a = Between' s a s
-  deriving (Eq, Foldable, Functor, Traversable, Show)
+  deriving (Eq, Foldable, Functor, Ord, Traversable, Show, Generic, Generic1)
 
 deriveEq1 ''Between'
 deriveShow1 ''Between'
+deriveOrd1 ''Between'
 
 instance Bifunctor Between' where
   bimap f g (Between' s a s') = Between' (f s) (g a) (f s')
diff --git a/src/Data/Separated/Internal.hs b/src/Data/Separated/Internal.hs
--- a/src/Data/Separated/Internal.hs
+++ b/src/Data/Separated/Internal.hs
@@ -1,5 +1,6 @@
 {-# language DeriveFunctor #-}
 {-# language DeriveFoldable #-}
+{-# language DeriveGeneric #-}
 {-# language DeriveTraversable #-}
 {-# language TemplateHaskell #-}
 
@@ -16,13 +17,15 @@
 import Data.Functor
 import Data.Monoid
 import Data.Ord
+import GHC.Generics (Generic, Generic1)
 
 -- | An @s@ that comes before an @a@
 data Before s a = Before s a
-  deriving (Eq, Foldable, Functor, Ord, Traversable, Show)
+  deriving (Eq, Foldable, Functor, Ord, Traversable, Show, Generic, Generic1)
 
 deriveEq1 ''Before
 deriveShow1 ''Before
+deriveOrd1 ''Before
 
 instance Bifunctor Before where
   bimap f g (Before s a) = Before (f s) (g a)
@@ -56,10 +59,11 @@
 
 -- | An @s@ that comes after an @a@
 data After s a = After a s
-  deriving (Eq, Foldable, Functor, Ord, Traversable, Show)
+  deriving (Eq, Foldable, Functor, Ord, Traversable, Show, Generic, Generic1)
 
 deriveEq1 ''After
 deriveShow1 ''After
+deriveOrd1 ''After
 
 instance Bifunctor After where
   bimap f g (After a s) = After (g a) (f s)
diff --git a/test/doctests.hs b/test/doctests.hs
--- a/test/doctests.hs
+++ b/test/doctests.hs
@@ -1,32 +1,13 @@
 module Main where
 
-import Build_doctests (deps)
-import Control.Applicative
-import Control.Monad
-import Data.List
-import System.Directory
-import System.FilePath
+import Build_doctests (flags, pkgs, module_sources)
+import Data.Foldable (traverse_)
 import Test.DocTest
 
-main ::
-  IO ()
-main =
-  getSources >>= \sources -> doctest $
-      "-isrc"
-    : "-idist/build/autogen"
-    : "-optP-include"
-    : "-optPdist/build/autogen/cabal_macros.h"
-    : "-hide-all-packages"
-    : map ("-package="++) deps ++ sources
-
-getSources :: IO [FilePath]
-getSources = filter (isSuffixOf ".hs") <$> go "src"
+main :: IO ()
+main = do
+    traverse_ putStrLn args
+    doctest args
   where
-    go dir = do
-      (dirs, files) <- getFilesAndDirectories dir
-      (files ++) . concat <$> mapM go dirs
+    args = flags ++ pkgs ++ module_sources
 
-getFilesAndDirectories :: FilePath -> IO ([FilePath], [FilePath])
-getFilesAndDirectories dir = do
-  c <- map (dir </>) . filter (`notElem` ["..", "."]) <$> getDirectoryContents dir
-  (,) <$> filterM doesDirectoryExist c <*> filterM doesFileExist c
