diff --git a/.ghci b/.ghci
deleted file mode 100644
--- a/.ghci
+++ /dev/null
@@ -1,2 +0,0 @@
-:set -isrc -idist/build/autogen -optP-include -optPdist/build/autogen/cabal_macros.h -optP-Iincludes
-:set -v0
diff --git a/.gitignore b/.gitignore
--- a/.gitignore
+++ b/.gitignore
@@ -1,4 +1,5 @@
 dist
+dist-newstyle
 docs
 wiki
 TAGS
@@ -11,3 +12,21 @@
 *.hi
 *~
 *#
+.stack-work/
+cabal-dev
+*.chi
+*.chs.h
+*.dyn_o
+*.dyn_hi
+.hpc
+.hsenv
+.cabal-sandbox/
+cabal.sandbox.config
+*.prof
+*.aux
+*.hp
+*.eventlog
+cabal.project.local
+cabal.project.local~
+.HTF/
+.ghc.environment.*
diff --git a/.hlint.yaml b/.hlint.yaml
new file mode 100644
--- /dev/null
+++ b/.hlint.yaml
@@ -0,0 +1,3 @@
+- arguments: [--cpp-define=HLINT, --cpp-ansi]
+
+- ignore: {name: Use uncurry}
diff --git a/.travis.yml b/.travis.yml
deleted file mode 100644
--- a/.travis.yml
+++ /dev/null
@@ -1,29 +0,0 @@
-language: haskell
-before_install:
-  # Uncomment whenever hackage is down.
-  # - mkdir -p ~/.cabal && cp travis/config ~/.cabal/config && cabal update
-  # - cabal update
-  - travis/cabal-apt-install $mode
-
-install:
-  - export PATH=~/.cabal/bin:$PATH
-  - cabal configure -flib-Werror $mode
-  - cabal install packdeps packunused
-  - cabal build --ghc-option=-ddump-minimal-imports
-
-script:
-  - $script
-  - packdeps bytes.cabal
-  - packunused --ignore-package=transformers-compat
-  - hlint src --cpp-define HLINT
-
-notifications:
-  irc:
-    channels:
-      - "irc.freenode.org#haskell-lens"
-    skip_join: true
-    template:
-      - "\x0313bytes\x03/\x0306%{branch}\x03 \x0314%{commit}\x03 %{build_url} %{message}"
-
-env:
-  - mode="--enable-tests" script="cabal test --show-details=always"
diff --git a/CHANGELOG.markdown b/CHANGELOG.markdown
--- a/CHANGELOG.markdown
+++ b/CHANGELOG.markdown
@@ -1,3 +1,71 @@
+0.17.5 [2026.01.10]
+-------------------
+* Allow building with `time-1.15.*` (GHC 9.14).
+* Remove unused `void` dependency.
+
+0.17.4 [2024.12.04]
+-------------------
+* Require building with GHC 8.0 or later.
+
+0.17.3 [2023.08.06]
+-------------------
+* Remove `mtl` dependency in favor `transformers`, as `bytes` was only using
+  `mtl` for its `transformers` re-exports.
+
+0.17.2 [2022.05.07]
+-------------------
+* Allow building with `mtl-2.3.*` and `transformers-0.6.*`.
+
+0.17.1 [2021.02.17]
+-------------------
+* The build-type has been changed from `Custom` to `Simple`.
+  To achieve this, the `doctests` test suite has been removed in favor of using
+  [`cabal-docspec`](https://github.com/phadej/cabal-extras/tree/master/cabal-docspec)
+  to run the doctests.
+* Provide the `Serial Natural` instance unconditionally.
+* Allow building with `bytestring-0.11.*`.
+
+0.17 [2020.02.03]
+-----------------
+* Give `MonadGet m` a superclass of
+  `forall a b. Coercible a b => Coercible (m a) (m b)` when built against
+  GHC 8.6 or later. This allows `Serial` instances to be derived using
+  `GeneralizedNewtypeDeriving` or `DerivingVia` when using in tandem with
+  `StandaloneDeriving`.
+
+0.16 [2019.08.27]
+-----------------
+* Support GHC-8.8.
+* `MonadGet` now requires `MonadFail` as a superclass.
+
+0.15.5 [2018.07.03]
+-------------------
+* Add `Serial(1)` instances for `NonEmpty`.
+
+0.15.4 [2018.04.05]
+-------------------
+* Use a significantly simpler `Setup.hs` script.
+
+0.15.3
+------
+* Support GHC 8.2
+* Revamp `Setup.hs` to use `cabal-doctest`. This makes it build
+  with `Cabal-2.0`, and makes the `doctest`s work with `cabal new-build` and
+  sandboxes.
+
+0.15.2
+------
+* Support ghc 8
+* Support `time` 1.6
+* Support `binary` 0.8
+* Support `transformers` 0.5
+
+0.15.1
+------
+* Drop `Trustworthy` claim in `Data.Bytes.Put` as we now can sometimes infer `Safe`.
+* Bump `cereal` bound for 0.5.0.0
+* Add instance `Serial Natural`
+
 0.15.0.1
 --------
 * Updated github URLs in the .cabal file.
diff --git a/README.markdown b/README.markdown
--- a/README.markdown
+++ b/README.markdown
@@ -1,7 +1,7 @@
 bytes
 =====
 
-[![Build Status](https://secure.travis-ci.org/ekmett/bytes.png)](http://travis-ci.org/ekmett/bytes)
+[![Hackage](https://img.shields.io/hackage/v/bytes.svg)](https://hackage.haskell.org/package/bytes) [![Build Status](https://github.com/ekmett/bytes/workflows/Haskell-CI/badge.svg)](https://github.com/ekmett/bytes/actions?query=workflow%3AHaskell-CI)
 
 This package provides a simple compatibility shim that lets you work with both `binary` and `cereal` with one chunk of serialization code.
 
diff --git a/Setup.lhs b/Setup.lhs
--- a/Setup.lhs
+++ b/Setup.lhs
@@ -1,55 +1,7 @@
 #!/usr/bin/runhaskell
-\begin{code}
-{-# OPTIONS_GHC -Wall #-}
-module Main (main) where
-
-import Data.List ( nub )
-import Data.Version ( showVersion )
-import Distribution.Package ( PackageName(PackageName), Package, PackageId, InstalledPackageId, packageVersion, packageName )
-import Distribution.PackageDescription ( PackageDescription(), TestSuite(..) )
-import Distribution.Simple ( defaultMainWithHooks, UserHooks(..), simpleUserHooks )
-import Distribution.Simple.Utils ( rewriteFile, createDirectoryIfMissingVerbose, copyFiles )
-import Distribution.Simple.BuildPaths ( autogenModulesDir )
-import Distribution.Simple.Setup ( BuildFlags(buildVerbosity), Flag(..), fromFlag, HaddockFlags(haddockDistPref))
-import Distribution.Simple.LocalBuildInfo ( withLibLBI, withTestLBI, LocalBuildInfo(), ComponentLocalBuildInfo(componentPackageDeps) )
-import Distribution.Text ( display )
-import Distribution.Verbosity ( Verbosity, normal )
-import System.FilePath ( (</>) )
-
-main :: IO ()
-main = defaultMainWithHooks simpleUserHooks
-  { buildHook = \pkg lbi hooks flags -> do
-     generateBuildModule (fromFlag (buildVerbosity flags)) pkg lbi
-     buildHook simpleUserHooks pkg lbi hooks flags
-  , postHaddock = \args flags pkg lbi -> do
-     copyFiles normal (haddockOutputDir flags pkg) []
-     postHaddock simpleUserHooks args flags pkg lbi
-  }
-
-haddockOutputDir :: Package p => HaddockFlags -> p -> FilePath
-haddockOutputDir flags pkg = destDir where
-  baseDir = case haddockDistPref flags of
-    NoFlag -> "."
-    Flag x -> x
-  destDir = baseDir </> "doc" </> "html" </> display (packageName pkg)
-
-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)
+> module Main (main) where
 
-testDeps :: ComponentLocalBuildInfo -> ComponentLocalBuildInfo -> [(InstalledPackageId, PackageId)]
-testDeps xs ys = nub $ componentPackageDeps xs ++ componentPackageDeps ys
+> import Distribution.Simple
 
-\end{code}
+> main :: IO ()
+> main = defaultMain
diff --git a/bytes.cabal b/bytes.cabal
--- a/bytes.cabal
+++ b/bytes.cabal
@@ -1,8 +1,8 @@
 name:          bytes
 category:      Data, Serialization
-version:       0.15.0.1
+version:       0.17.5
 license:       BSD3
-cabal-version: >= 1.8
+cabal-version: >= 1.10
 license-file:  LICENSE
 author:        Edward A. Kmett
 maintainer:    Edward A. Kmett <ekmett@gmail.com>
@@ -10,49 +10,51 @@
 homepage:      https://github.com/ekmett/bytes
 bug-reports:   https://github.com/ekmett/bytes/issues
 copyright:     Copyright (C) 2013-2015 Edward A. Kmett
-build-type:    Custom
-tested-with:   GHC == 7.4.1, GHC == 7.6.1
+build-type:    Simple
+tested-with:   GHC == 8.0.2
+             , GHC == 8.2.2
+             , GHC == 8.4.4
+             , GHC == 8.6.5
+             , GHC == 8.8.4
+             , GHC == 8.10.7
+             , GHC == 9.0.2
+             , GHC == 9.2.8
+             , GHC == 9.4.8
+             , GHC == 9.6.7
+             , GHC == 9.8.4
+             , GHC == 9.10.3
+             , GHC == 9.12.2
+             , GHC == 9.14.1
 synopsis:      Sharing code for serialization between binary and cereal
-description:   Sharing code for serialization between binary and cereal
+description:   Sharing code for serialization between binary and cereal.
 
 extra-source-files:
-  .travis.yml
-  .ghci
   .gitignore
+  .hlint.yaml
   .vim.custom
-  travis/cabal-apt-install
-  travis/config
   AUTHORS.markdown
   README.markdown
   CHANGELOG.markdown
 
 source-repository head
   type: git
-  location: git://github.com/ekmett/bytes.git
-
--- You can disable the doctests test suite with -f-test-doctests
-flag test-doctests
-  description: Enable (or disable via f-test-doctests) the doctest suite when
-               using the enable-tests option for cabal.
-  default: True
-  manual: True
+  location: https://github.com/ekmett/bytes.git
 
 library
   build-depends:
-    base                      >= 4.3      && < 5,
-    binary                    >= 0.5.1    && < 0.8,
-    bytestring                >= 0.9      && < 0.11,
-    cereal                    >= 0.3.5    && < 0.5,
+    base                      >= 4.9      && < 5,
+    binary                    >= 0.5.1    && < 0.9,
+    binary-orphans            >= 1.0.1    && < 1.1,
+    bytestring                >= 0.9      && < 0.13,
+    cereal                    >= 0.5.2    && < 0.6,
     containers                >= 0.3      && < 1,
-    mtl                       >= 2.0      && < 2.3,
-    text                      >= 0.2      && < 1.3,
-    time                      >= 1.2      && < 1.6,
-    transformers              >= 0.2      && < 0.5,
-    transformers-compat       >= 0.3      && < 1,
-    void                      >= 0.6      && < 1
-
-  if impl(ghc >= 7.4 && < 7.6)
-    build-depends: ghc-prim
+    hashable                  >= 1.0.1.1  && < 1.6,
+    text                      >= 0.2      && < 2.2,
+    time                      >= 1.2      && < 1.16,
+    transformers              >= 0.2      && < 0.7,
+    transformers-compat       >= 0.6.5    && < 1,
+    unordered-containers      >= 0.2      && < 0.3,
+    scientific                >= 0.0      && < 1
 
   exposed-modules:
     Data.Bytes.Get
@@ -61,22 +63,9 @@
     Data.Bytes.Signed
     Data.Bytes.VarInt
 
-  ghc-options: -Wall -fwarn-tabs -O2
+  ghc-options: -Wall -Wtabs -O2
+  if impl(ghc >= 8.6)
+    ghc-options: -Wno-star-is-type
   c-sources: cbits/i2d.c
   hs-source-dirs: src
-
-test-suite doctests
-  type:           exitcode-stdio-1.0
-  main-is:        doctests.hs
-  ghc-options:    -Wall -threaded
-  hs-source-dirs: tests
-
-  if !flag(test-doctests)
-    buildable: False
-  else
-    build-depends:
-      base,
-      bytes,
-      directory      >= 1.0,
-      doctest        >= 0.9.1,
-      filepath       >= 1.2
+  default-language: Haskell2010
diff --git a/src/Data/Bytes/Get.hs b/src/Data/Bytes/Get.hs
--- a/src/Data/Bytes/Get.hs
+++ b/src/Data/Bytes/Get.hs
@@ -1,9 +1,14 @@
 {-# LANGUAGE CPP #-}
 {-# LANGUAGE TypeFamilies #-}
+{-# LANGUAGE TypeOperators #-}
 {-# LANGUAGE FlexibleContexts #-}
 {-# LANGUAGE DefaultSignatures #-}
 {-# LANGUAGE Trustworthy #-}
-{-# OPTIONS_GHC -fno-warn-warnings-deprecations #-}
+#if __GLASGOW_HASKELL__ >= 806
+{-# LANGUAGE QuantifiedConstraints #-}
+#endif
+
+{-# OPTIONS_GHC -Wno-warnings-deprecations #-}
 --------------------------------------------------------------------
 -- |
 -- Copyright :  (c) Edward Kmett 2013-2015
@@ -25,17 +30,16 @@
   , runGetS
   ) where
 
-#if __GLASGOW_HASKELL__ < 710
-import Control.Applicative
-#endif
-import Control.Monad.Reader
+import Control.Monad (liftM, unless)
+import Control.Monad.Trans.Class (MonadTrans(..))
 import Control.Monad.Trans.Except as Except
-import Control.Monad.RWS.Lazy as Lazy
-import Control.Monad.RWS.Strict as Strict
-import Control.Monad.State.Lazy as Lazy
-import Control.Monad.State.Strict as Strict
-import Control.Monad.Writer.Lazy as Lazy
-import Control.Monad.Writer.Strict as Strict
+import Control.Monad.Trans.Reader (ReaderT(..))
+import Control.Monad.Trans.RWS.Lazy as Lazy
+import Control.Monad.Trans.RWS.Strict as Strict
+import Control.Monad.Trans.State.Lazy as Lazy
+import Control.Monad.Trans.State.Strict as Strict
+import Control.Monad.Trans.Writer.Lazy as Lazy
+import Control.Monad.Trans.Writer.Strict as Strict
 import qualified Data.Binary.Get as B
 import qualified Data.ByteString.Lazy as Lazy
 import qualified Data.ByteString as Strict
@@ -43,7 +47,21 @@
 import qualified Data.Serialize.Get as S
 import Data.Word
 
-class (Integral (Remaining m), Monad m, Applicative m) => MonadGet m where
+import Control.Monad.Trans.Instances ()
+import Data.Binary.Orphans ()
+import qualified Control.Monad.Fail as Fail
+#if __GLASGOW_HASKELL__ >= 806
+import Data.Coerce (Coercible)
+#endif
+
+class (
+#if __GLASGOW_HASKELL__ >= 806
+     -- This superclass exists for the benefit of Serial, which uses MonadGet
+     -- in one of its methods. Giving MonadGet this superclass allows Serial to
+     -- be derived using GeneralizedNewtypeDeriving/DerivingVia.
+     forall a b. Coercible a b => Coercible (m a) (m b),
+#endif
+     Integral (Remaining m), Fail.MonadFail m, Applicative m) => MonadGet m where
   -- | An 'Integral' number type used for unchecked skips and counting.
   type Remaining m :: *
 
@@ -89,7 +107,8 @@
   -- Note that this forces the rest of the input.
   remaining :: m (Remaining m)
 #ifndef HLINT
-  default remaining :: (MonadTrans t, MonadGet n, m ~ t n) => m (Remaining n)
+  default remaining :: (MonadTrans t, MonadGet n, m ~ t n, Remaining m ~ Remaining n)
+                    => m (Remaining m)
   remaining = lift remaining
 #endif
 
@@ -181,7 +200,7 @@
   getWord64le = lift getWord64le
 #endif
 
-  -- | /O(1)./ Read a 'Word64' in native host order and host endianess.
+  -- | /O(1)./ Read a 'Word64' in native host order and host endianness.
   getWord64host :: m Word64
 #ifndef HLINT
   default getWord64host :: (MonadTrans t, MonadGet n, m ~ t n) => m Word64
@@ -210,7 +229,7 @@
   {-# INLINE lookAheadE #-}
   ensure n = do
     bs <- lookAhead $ getByteString n
-    unless (Strict.length bs >= n) $ fail "ensure: Required more bytes"
+    unless (Strict.length bs >= n) $ Fail.fail "ensure: Required more bytes"
     return bs
   {-# INLINE ensure #-}
   getBytes = B.getByteString
diff --git a/src/Data/Bytes/Put.hs b/src/Data/Bytes/Put.hs
--- a/src/Data/Bytes/Put.hs
+++ b/src/Data/Bytes/Put.hs
@@ -5,7 +5,6 @@
 {-# LANGUAGE TypeOperators #-}
 {-# LANGUAGE FlexibleContexts #-}
 {-# LANGUAGE UndecidableInstances #-}
-{-# LANGUAGE Trustworthy #-}
 --------------------------------------------------------------------
 -- |
 -- Copyright :  (c) Edward Kmett 2013-2015
@@ -27,17 +26,15 @@
   , runPutS
   ) where
 
-#if __GLASGOW_HASKELL__ < 710
-import Control.Applicative
-#endif
-import Control.Monad.Reader
+import Control.Monad.Trans.Class (MonadTrans(..))
 import Control.Monad.Trans.Except as Except
-import Control.Monad.RWS.Lazy as Lazy
-import Control.Monad.RWS.Strict as Strict
-import Control.Monad.State.Lazy as Lazy
-import Control.Monad.State.Strict as Strict
-import Control.Monad.Writer.Lazy as Lazy
-import Control.Monad.Writer.Strict as Strict
+import Control.Monad.Trans.Reader (ReaderT(..))
+import Control.Monad.Trans.RWS.Lazy as Lazy
+import Control.Monad.Trans.RWS.Strict as Strict
+import Control.Monad.Trans.State.Lazy as Lazy
+import Control.Monad.Trans.State.Strict as Strict
+import Control.Monad.Trans.Writer.Lazy as Lazy
+import Control.Monad.Trans.Writer.Strict as Strict
 import qualified Data.Binary.Put as B
 import Data.ByteString as Strict
 import Data.ByteString.Lazy as Lazy
diff --git a/src/Data/Bytes/Serial.hs b/src/Data/Bytes/Serial.hs
--- a/src/Data/Bytes/Serial.hs
+++ b/src/Data/Bytes/Serial.hs
@@ -7,8 +7,13 @@
 {-# LANGUAGE FlexibleContexts #-}
 {-# LANGUAGE ScopedTypeVariables #-}
 {-# LANGUAGE UndecidableInstances #-}
-#if defined(__GLASGOW_HASKELL__) && __GLASGOW_HASKELL__ >= 704
+#if defined(__GLASGOW_HASKELL__)
+# if __GLASGOW_HASKELL__ >= 704
 {-# LANGUAGE Trustworthy #-}
+# endif
+# if __GLASGOW_HASKELL__ >= 708
+{-# LANGUAGE EmptyCase #-}
+# endif
 #endif
 #ifndef MIN_VERSION_base
 #define MIN_VERSION_base(x,y,z) 1
@@ -50,6 +55,7 @@
 
 import Control.Applicative
 import Control.Monad
+import qualified Control.Monad.Fail as MonadFail
 import qualified Data.Foldable as F
 import Data.Bytes.Get
 import Data.Bytes.Put
@@ -61,18 +67,20 @@
 import Data.Int
 import Data.Bits
 import Data.Monoid as Monoid
-#if MIN_VERSION_base(4, 6, 0)
-import Data.Ord (Down(..))
-#endif
 import Data.Functor.Identity as Functor
 import Data.Functor.Constant as Functor
 import Data.Functor.Product  as Functor
 import Data.Functor.Reverse  as Functor
+import Data.Hashable (Hashable)
+import qualified Data.HashMap.Lazy as HMap
+import qualified Data.HashSet      as HSet
+import qualified Data.List.NonEmpty as NEL
 import Data.Time
 import Data.Time.Clock.TAI
 import qualified Data.IntMap as IMap
 import qualified Data.IntSet as ISet
 import qualified Data.Map as Map
+import qualified Data.Scientific as Sci
 import qualified Data.Sequence as Seq
 import qualified Data.Set as Set
 import Data.Text as SText
@@ -87,14 +95,28 @@
 import Foreign.ForeignPtr
 import Foreign.Ptr
 import Foreign.Storable
+import GHC.Exts (Down(..))
 import GHC.Generics
 import System.IO.Unsafe
+import Numeric.Natural
 
 foreign import ccall floatToWord32 :: Float -> Word32
 foreign import ccall word32ToFloat :: Word32 -> Float
 foreign import ccall doubleToWord64 :: Double -> Word64
 foreign import ccall word64ToDouble :: Word64 -> Double
 
+-- $setup
+-- >>> import Data.Bytes.Get
+-- >>> import Data.Bytes.Put
+-- >>> import Data.Bytes.VarInt
+-- >>> import Data.Fixed
+-- >>> import Data.Ratio (Ratio, (%))
+-- >>> import Data.Time
+-- >>> import Data.Time.Clock
+-- >>> import Data.Time.Clock.TAI
+-- >>> import Data.Word
+-- >>> import Numeric.Natural
+
 ------------------------------------------------------------------------------
 -- Endianness-Dependant Serialization
 ------------------------------------------------------------------------------
@@ -266,8 +288,14 @@
 restore :: forall m a. (MonadGet m, Storable a) => m a
 restore = do
   let required = sizeOf (undefined :: a)
-  PS fp o n <- getByteString required
-  unless (n >= required) $ fail "restore: Required more bytes"
+#if MIN_VERSION_bytestring(0,11,0)
+  let o = 0
+  BS fp n
+#else
+  PS fp o n
+#endif
+    <- getByteString required
+  unless (n >= required) $ MonadFail.fail "restore: Required more bytes"
   return $ unsafePerformIO $ withForeignPtr fp $ \p -> peekByteOff p o
 
 instance Serial Double where
@@ -324,9 +352,13 @@
   serialize = putWord8 . fromIntegral
   deserialize = liftM fromIntegral getWord8
 
+instance Serial Sci.Scientific where
+  serialize s = serialize (Sci.coefficient s, Sci.base10Exponent s)
+  deserialize = uncurry Sci.scientific <$> deserialize
+
 instance Serial Void where
   serialize = absurd
-  deserialize = fail "I looked into the void."
+  deserialize = MonadFail.fail "I looked into the void."
 
 instance Serial ISet.IntSet where
   serialize = serialize . ISet.toAscList
@@ -336,6 +368,10 @@
   serialize = serializeWith serialize
   deserialize = deserializeWith deserialize
 
+instance Serial a => Serial (NEL.NonEmpty a) where
+  serialize = serializeWith serialize
+  deserialize = deserializeWith deserialize
+
 instance (Serial a, Ord a) => Serial (Set.Set a) where
   serialize = serialize . Set.toAscList
   deserialize = Set.fromList `liftM` deserialize
@@ -348,6 +384,14 @@
   serialize = serializeWith serialize
   deserialize = deserializeWith deserialize
 
+instance (Serial k, Serial v, Hashable k, Eq k) => Serial (HMap.HashMap k v) where
+  serialize = serializeWith serialize
+  deserialize = deserializeWith deserialize
+
+instance (Serial v, Hashable v, Eq v) => Serial (HSet.HashSet v) where
+  serialize = serialize . HSet.toList
+  deserialize = HSet.fromList `liftM` deserialize
+
 putVarInt :: (MonadPut m, Integral a, Bits a) => a -> m ()
 putVarInt n
   | n < 0x80 = putWord8 $ fromIntegral n
@@ -364,11 +408,6 @@
   | otherwise = return $ fromIntegral n
 {-# INLINE getVarInt #-}
 
--- |
--- $setup
--- >>> import Data.Word
--- >>> import Data.Fixed
--- >>> import Data.Bytes.Serial
 
 -- | Integer/Word types serialized to base-128 variable-width ints.
 --
@@ -392,6 +431,13 @@
   deserialize = unVarInt `liftM` deserialize
 
 -- |
+-- >>> runGetL deserialize (runPutL (serialize (10^10::Natural))) :: Natural
+-- 10000000000
+instance Serial Natural where
+  serialize = serialize . VarInt . toInteger
+  deserialize = fromInteger . unVarInt <$> deserialize
+
+-- |
 -- >>> (runGetL deserialize $ runPutL $ serialize (1.82::Fixed E2))::Fixed E2
 -- 1.82
 instance HasResolution a => Serial (Fixed a) where
@@ -480,11 +526,9 @@
   serialize = serialize . (fromIntegral::Int -> Int8) . fromEnum
   deserialize = (toEnum . (fromIntegral::Int8 -> Int)) `liftM` deserialize
 
-#if MIN_VERSION_base(4, 6, 0)
 instance Serial a => Serial (Down a) where
     serialize (Down a) = serialize a
     deserialize = Down `liftM` deserialize
-#endif
 
 instance Serial Version where
     serialize (Version vb ts) = serialize (fmap VarInt vb, ts)
@@ -564,8 +608,8 @@
   gdeserialize = return U1
 
 instance GSerial V1 where
-  gserialize _ = fail "I looked into the void."
-  gdeserialize = fail "I looked into the void."
+  gserialize x = case x of {}
+  gdeserialize = MonadFail.fail "I looked into the void."
 
 instance (GSerial f, GSerial g) => GSerial (f :*: g) where
   gserialize (f :*: g) = do
@@ -579,7 +623,7 @@
   gdeserialize = getWord8 >>= \a -> case a of
     0 -> liftM L1 gdeserialize
     1 -> liftM R1 gdeserialize
-    _ -> fail "Missing case"
+    _ -> MonadFail.fail "Missing case"
 
 instance GSerial f => GSerial (M1 i c f) where
   gserialize (M1 x) = gserialize x
@@ -680,6 +724,10 @@
   serializeWith pv = serializeWith pv . F.toList
   deserializeWith gv = Seq.fromList `liftM` deserializeWith gv
 
+instance Serial1 NEL.NonEmpty where
+  serializeWith pv = serializeWith pv . F.toList
+  deserializeWith gv = NEL.fromList `liftM` deserializeWith gv
+
 {-
 instance Serial1 Set.Set where
   serializeWith pv = serializeWith pv . Set.toAscList
@@ -700,6 +748,12 @@
   deserializeWith gv = Map.fromList
                `liftM` deserializeWith (deserializeWith2 deserialize gv)
 
+instance (Hashable k, Eq k, Serial k) => Serial1 (HMap.HashMap k) where
+  serializeWith pv = serializeWith (serializeWith2 serialize pv)
+                   . HMap.toList
+  deserializeWith gv = HMap.fromList
+               `liftM` deserializeWith (deserializeWith2 deserialize gv)
+
 serialize1 :: (MonadPut m, Serial1 f, Serial a) => f a -> m ()
 serialize1 = serializeWith serialize
 {-# INLINE serialize1 #-}
@@ -732,8 +786,8 @@
   gdeserializeWith _  = return U1
 
 instance GSerial1 V1 where
-  gserializeWith _   = fail "I looked into the void."
-  gdeserializeWith _ = fail "I looked into the void."
+  gserializeWith _ x = case x of {}
+  gdeserializeWith _ = MonadFail.fail "I looked into the void."
 
 instance (GSerial1 f, GSerial1 g) => GSerial1 (f :*: g) where
   gserializeWith f (a :*: b) = gserializeWith f a >> gserializeWith f b
@@ -745,7 +799,7 @@
   gdeserializeWith m = getWord8 >>= \a -> case a of
     0 -> liftM L1 (gdeserializeWith m)
     1 -> liftM R1 (gdeserializeWith m)
-    _ -> fail "Missing case"
+    _ -> MonadFail.fail "Missing case"
 
 instance (Serial1 f, GSerial1 g) => GSerial1 (f :.: g) where
   gserializeWith f (Comp1 m) = serializeWith (gserializeWith f) m
@@ -781,7 +835,7 @@
   deserializeWith2 m n = getWord8 >>= \a -> case a of
     0 -> liftM Left m
     1 -> liftM Right n
-    _ -> fail "Missing case"
+    _ -> MonadFail.fail "Missing case"
 
 instance Serial2 (,) where
   serializeWith2 f g (a, b) = f a >> g b
diff --git a/tests/doctests.hsc b/tests/doctests.hsc
deleted file mode 100644
--- a/tests/doctests.hsc
+++ /dev/null
@@ -1,75 +0,0 @@
-{-# LANGUAGE CPP #-}
-{-# LANGUAGE ForeignFunctionInterface #-}
------------------------------------------------------------------------------
--- |
--- Module      :  Main (doctests)
--- Copyright   :  (C) 2012-13 Edward Kmett
--- License     :  BSD-style (see the file LICENSE)
--- Maintainer  :  Edward Kmett <ekmett@gmail.com>
--- Stability   :  provisional
--- Portability :  portable
---
--- This module provides doctests for a project based on the actual versions
--- of the packages it was built with. It requires a corresponding Setup.lhs
--- to be added to the project
------------------------------------------------------------------------------
-module Main where
-
-import Build_doctests (deps)
-import Control.Applicative
-import Control.Monad
-import Data.List
-import System.Directory
-import System.FilePath
-import Test.DocTest
-
-##if defined(mingw32_HOST_OS)
-##if defined(i386_HOST_ARCH)
-##define USE_CP
-import Control.Applicative
-import Control.Exception
-import Foreign.C.Types
-foreign import stdcall "windows.h SetConsoleCP" c_SetConsoleCP :: CUInt -> IO Bool
-foreign import stdcall "windows.h GetConsoleCP" c_GetConsoleCP :: IO CUInt
-##elif defined(x86_64_HOST_ARCH)
-##define USE_CP
-import Control.Applicative
-import Control.Exception
-import Foreign.C.Types
-foreign import ccall "windows.h SetConsoleCP" c_SetConsoleCP :: CUInt -> IO Bool
-foreign import ccall "windows.h GetConsoleCP" c_GetConsoleCP :: IO CUInt
-##endif
-##endif
-
--- | Run in a modified codepage where we can print UTF-8 values on Windows.
-withUnicode :: IO a -> IO a
-##ifdef USE_CP
-withUnicode m = do
-  cp <- c_GetConsoleCP
-  (c_SetConsoleCP 65001 >> m) `finally` c_SetConsoleCP cp
-##else
-withUnicode m = m
-##endif
-
-main :: IO ()
-main = withUnicode $ getSources >>= \sources -> doctest $
-    "-isrc"
-  : "-idist/build/autogen"
-  : "-optP-include"
-  : "-optPdist/build/autogen/cabal_macros.h"
-  : "-hide-all-packages"
-  : "-Iincludes"
-  : "dist/build/cbits/i2d.o"
-  : map ("-package="++) (filter (not . ("bytes-" `isPrefixOf`)) deps) ++ sources
-
-getSources :: IO [FilePath]
-getSources = filter (isSuffixOf ".hs") <$> go "src"
-  where
-    go dir = do
-      (dirs, files) <- getFilesAndDirectories dir
-      (files ++) . concat <$> mapM go dirs
-
-getFilesAndDirectories :: FilePath -> IO ([FilePath], [FilePath])
-getFilesAndDirectories dir = do
-  c <- map (dir </>) . filter (`notElem` ["..", "."]) <$> getDirectoryContents dir
-  (,) <$> filterM doesDirectoryExist c <*> filterM doesFileExist c
diff --git a/travis/cabal-apt-install b/travis/cabal-apt-install
deleted file mode 100644
--- a/travis/cabal-apt-install
+++ /dev/null
@@ -1,27 +0,0 @@
-#! /bin/bash
-set -eu
-
-APT="sudo apt-get -q -y"
-CABAL_INSTALL_DEPS="cabal install --only-dependencies --force-reinstall"
-
-$APT update
-$APT install dctrl-tools
-
-# Find potential system packages to satisfy cabal dependencies
-deps()
-{
-	local M='^\([^ ]\+\)-[0-9.]\+ (.*$'
-	local G=' -o ( -FPackage -X libghc-\L\1\E-dev )'
-	local E="$($CABAL_INSTALL_DEPS "$@" --dry-run -v 2> /dev/null \
-		| sed -ne "s/$M/$G/p" | sort -u)"
-	grep-aptavail -n -sPackage \( -FNone -X None \) $E | sort -u
-}
-
-$APT install $(deps "$@") libghc-quickcheck2-dev # QuickCheck is special
-$CABAL_INSTALL_DEPS "$@" # Install the rest via Hackage
-
-if ! $APT install hlint ; then
-	$APT install $(deps hlint)
-	cabal install hlint
-fi
-
diff --git a/travis/config b/travis/config
deleted file mode 100644
--- a/travis/config
+++ /dev/null
@@ -1,16 +0,0 @@
--- This provides a custom ~/.cabal/config file for use when hackage is down that should work on unix
---
--- This is particularly useful for travis-ci to get it to stop complaining
--- about a broken build when everything is still correct on our end.
---
--- This uses Luite Stegeman's mirror of hackage provided by his 'hdiff' site instead
---
--- To enable this, uncomment the before_script in .travis.yml
-
-remote-repo: hdiff.luite.com:http://hdiff.luite.com/packages/archive
-remote-repo-cache: ~/.cabal/packages
-world-file: ~/.cabal/world
-build-summary: ~/.cabal/logs/build.log
-remote-build-reporting: anonymous
-install-dirs user
-install-dirs global
