diff --git a/.travis.yml b/.travis.yml
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,27 +1,96 @@
-language: haskell
+language: c
+sudo: false
 
-before_install:
-  # Uncomment whenever hackage is down.
-  # - mkdir -p ~/.cabal && cp travis/config ~/.cabal/config
-  - cabal update
+cache:
+  directories:
+    - $HOME/.cabsnap
+    - $HOME/.cabal/packages
 
-  # Try installing some of the build-deps with apt-get for speed.
-  - travis/cabal-apt-install --only-dependencies --force-reinstall $mode
+before_cache:
+  - rm -fv $HOME/.cabal/packages/hackage.haskell.org/build-reports.log
+  - rm -fv $HOME/.cabal/packages/hackage.haskell.org/00-index.tar
 
+matrix:
+  include:
+    - env: CABALVER=1.16 GHCVER=7.4.2
+      compiler: ": #GHC 7.4.2"
+      addons: {apt: {packages: [cabal-install-1.16,ghc-7.4.2,alex-3.1.4,happy-1.19.5], sources: [hvr-ghc]}}
+    - env: CABALVER=1.16 GHCVER=7.6.3
+      compiler: ": #GHC 7.6.3"
+      addons: {apt: {packages: [cabal-install-1.16,ghc-7.6.3,alex-3.1.4,happy-1.19.5], sources: [hvr-ghc]}}
+    - env: CABALVER=1.18 GHCVER=7.8.4
+      compiler: ": #GHC 7.8.4"
+      addons: {apt: {packages: [cabal-install-1.18,ghc-7.8.4,alex-3.1.4,happy-1.19.5], sources: [hvr-ghc]}}
+    - env: CABALVER=1.22 GHCVER=7.10.1
+      compiler: ": #GHC 7.10.1"
+      addons: {apt: {packages: [cabal-install-1.22,ghc-7.10.1,alex-3.1.4,happy-1.19.5], sources: [hvr-ghc]}}
+    - env: CABALVER=1.22 GHCVER=7.10.2
+      compiler: ": #GHC 7.10.2"
+      addons: {apt: {packages: [cabal-install-1.22,ghc-7.10.2,alex-3.1.4,happy-1.19.5], sources: [hvr-ghc]}}
+
+before_install:
+ - unset CC
+ - export HAPPYVER=1.19.5
+ - export ALEXVER=3.1.4
+ - export PATH=~/.cabal/bin:/opt/ghc/$GHCVER/bin:/opt/cabal/$CABALVER/bin:/opt/happy/$HAPPYVER/bin:/opt/alex/$ALEXVER/bin:$PATH
+
 install:
-  - cabal configure $mode
-  - cabal build
+ - cabal --version
+ - echo "$(ghc --version) [$(ghc --print-project-git-commit-id 2> /dev/null || echo '?')]"
+ - if [ -f $HOME/.cabal/packages/hackage.haskell.org/00-index.tar.gz ];
+   then
+     zcat $HOME/.cabal/packages/hackage.haskell.org/00-index.tar.gz >
+          $HOME/.cabal/packages/hackage.haskell.org/00-index.tar;
+   fi
+ - travis_retry cabal update
+ - "sed -i  's/^jobs:.*$/jobs: 2/' $HOME/.cabal/config"
+ - cabal install --only-dependencies --enable-tests --enable-benchmarks --dry -v > installplan.txt
+ - sed -i -e '1,/^Resolving /d' installplan.txt; cat installplan.txt
 
+# check whether current requested install-plan matches cached package-db snapshot
+ - if diff -u installplan.txt $HOME/.cabsnap/installplan.txt;
+   then
+     echo "cabal build-cache HIT";
+     rm -rfv .ghc;
+     cp -a $HOME/.cabsnap/ghc $HOME/.ghc;
+     cp -a $HOME/.cabsnap/lib $HOME/.cabsnap/share $HOME/.cabsnap/bin $HOME/.cabal/;
+   else
+     echo "cabal build-cache MISS";
+     rm -rf $HOME/.cabsnap;
+     mkdir -p $HOME/.ghc $HOME/.cabal/lib $HOME/.cabal/share $HOME/.cabal/bin;
+     cabal install --only-dependencies --enable-tests --enable-benchmarks;
+     if [ "$GHCVER" = "7.10.1" ]; then cabal install Cabal-1.22.4.0; fi;
+   fi
+
+# snapshot package-db on cache miss
+ - if [ ! -d $HOME/.cabsnap ];
+   then
+      echo "snapshotting package-db to build-cache";
+      mkdir $HOME/.cabsnap;
+      cp -a $HOME/.ghc $HOME/.cabsnap/ghc;
+      cp -a $HOME/.cabal/lib $HOME/.cabal/share $HOME/.cabal/bin installplan.txt $HOME/.cabsnap/;
+   fi
+
+# Here starts the actual work to be performed for the package under test;
+# any command which exits with a non-zero exit code causes the build to fail.
 script:
-  - $script
+ - cabal configure --enable-tests -v2  # -v2 provides useful information for debugging
+ - cabal build   # this builds all libraries and executables (including tests)
+ - cabal test
+ - cabal bench || true  # expected result: these will crash
+ - cabal sdist || true  # tests that a source-distribution can be generated
 
+# Check that the resulting source distribution can be built & installed.
+# If there are no other `.tar.gz` files in `dist`, this can be even simpler:
+# `cabal install --force-reinstalls dist/*-*.tar.gz`
+ - SRC_TGZ=$(cabal info . | awk '{print $2;exit}').tar.gz &&
+   (cd dist && cabal install --force-reinstalls "$SRC_TGZ")
+
 notifications:
   irc:
     channels:
       - "irc.freenode.org#haskell-lens"
     skip_join: true
     template:
-      - "\x0313trifecta\x03/\x0306%{branch}\x03 \x0314%{commit}\x03 %{build_url} %{message}"
-
-env:
-  - mode="--enable-tests" script="cabal test --show-details=always"
+      - "\x0313trifecta\x0f/\x0306%{branch}\x0f \x0314%{commit}\x0f %{message} \x0302\x1f%{build_url}\x0f"
+# EOF
diff --git a/README.markdown b/README.markdown
--- a/README.markdown
+++ b/README.markdown
@@ -1,7 +1,7 @@
 trifecta
 ========
 
-[![Build Status](https://secure.travis-ci.org/ekmett/trifecta.png?branch=master)](http://travis-ci.org/ekmett/trifecta)
+[![Hackage](https://img.shields.io/hackage/v/trifecta.svg)](https://hackage.haskell.org/package/trifecta) [![Build Status](https://secure.travis-ci.org/ekmett/trifecta.png?branch=master)](http://travis-ci.org/ekmett/trifecta)
 
 This package provides a parser that focuses on nice diagnostics.
 
diff --git a/src/Text/Trifecta/Delta.hs b/src/Text/Trifecta/Delta.hs
--- a/src/Text/Trifecta/Delta.hs
+++ b/src/Text/Trifecta/Delta.hs
@@ -1,8 +1,10 @@
-{-# LANGUAGE DeriveDataTypeable, DeriveGeneric #-}
+{-# LANGUAGE CPP #-}
+{-# LANGUAGE DeriveDataTypeable #-}
+{-# LANGUAGE DeriveGeneric #-}
 -----------------------------------------------------------------------------
 -- |
 -- Module      :  Text.Trifecta.Delta
--- Copyright   :  (C) 2011-2014 Edward Kmett
+-- Copyright   :  (C) 2011-2015 Edward Kmett
 -- License     :  BSD-style (see the file LICENSE)
 --
 -- Maintainer  :  Edward Kmett <ekmett@gmail.com>
@@ -26,7 +28,9 @@
 import Data.Int
 import Data.Data
 import Data.Word
+#if __GLASGOW_HASKELL__ < 710
 import Data.Foldable
+#endif
 import Data.Function (on)
 import Data.FingerTree hiding (empty)
 import Data.ByteString as Strict hiding (empty)
diff --git a/src/Text/Trifecta/Highlight.hs b/src/Text/Trifecta/Highlight.hs
--- a/src/Text/Trifecta/Highlight.hs
+++ b/src/Text/Trifecta/Highlight.hs
@@ -1,5 +1,10 @@
+{-# LANGUAGE CPP #-}
 {-# LANGUAGE OverloadedStrings #-}
 {-# LANGUAGE TemplateHaskell #-}
+
+#ifndef MIN_VERSION_lens
+#define MIN_VERSION_lens(x,y,z) 1
+#endif
 -----------------------------------------------------------------------------
 -- |
 -- Module      :  Text.Trifecta.Highlight
@@ -22,6 +27,9 @@
   ) where
 
 import Control.Lens
+#if MIN_VERSION_lens(4,13,0) && __GLASGOW_HASKELL__ >= 710
+  hiding (Empty)
+#endif
 import Data.Foldable as F
 import Data.Int (Int64)
 import Data.List (sort)
diff --git a/src/Text/Trifecta/Result.hs b/src/Text/Trifecta/Result.hs
--- a/src/Text/Trifecta/Result.hs
+++ b/src/Text/Trifecta/Result.hs
@@ -80,7 +80,7 @@
   | isJust mm   = report $ withEx $ Pretty.char ',' <+> expecting
   | otherwise   = report expecting
   where
-    now = spaceHack $ List.nub $ toList es
+    now = spaceHack $ toList es
     spaceHack [""] = ["space"]
     spaceHack xs = List.filter (/= "") xs
     withEx x = fromMaybe (fillSep $ text <$> words "unspecified error") mm <> x
diff --git a/src/Text/Trifecta/Util/Array.hs b/src/Text/Trifecta/Util/Array.hs
--- a/src/Text/Trifecta/Util/Array.hs
+++ b/src/Text/Trifecta/Util/Array.hs
@@ -2,7 +2,7 @@
 -----------------------------------------------------------------------------
 -- |
 -- Module      :  Text.Trifecta.Util.Array
--- Copyright   :  Edward Kmett 2011-2014
+-- Copyright   :  Edward Kmett 2011-2015
 --                Johan Tibell 2011
 -- License     :  BSD3
 --
@@ -53,7 +53,9 @@
   ) where
 
 import qualified Data.Traversable as Traversable
+#if __GLASGOW_HASKELL__ < 710
 import Control.Applicative (Applicative)
+#endif
 import Control.DeepSeq
 import Control.Monad.ST
 import GHC.Exts (
diff --git a/src/Text/Trifecta/Util/IntervalMap.hs b/src/Text/Trifecta/Util/IntervalMap.hs
--- a/src/Text/Trifecta/Util/IntervalMap.hs
+++ b/src/Text/Trifecta/Util/IntervalMap.hs
@@ -1,6 +1,11 @@
+{-# LANGUAGE CPP #-}
 {-# LANGUAGE FlexibleInstances #-}
 {-# LANGUAGE MultiParamTypeClasses #-}
 {-# LANGUAGE TypeFamilies #-}
+
+#ifndef MIN_VERSION_lens
+#define MIN_VERSION_lens(x,y,z) 1
+#endif
 -----------------------------------------------------------------------------
 -- |
 -- Module      :  Text.Trifecta.Util.IntervalMap
@@ -47,11 +52,18 @@
   , fromList
   ) where
 
+#if __GLASGOW_HASKELL__ < 710
 import Control.Applicative hiding (empty)
-import Control.Lens hiding ((<|),(|>))
+import Data.Foldable (Foldable(foldMap))
+#endif
+import Control.Lens
+  hiding ((<|),(|>)
+#if MIN_VERSION_lens(4,13,0) && __GLASGOW_HASKELL__ >= 710
+  ,(:<)
+#endif
+  )
 import qualified Data.FingerTree as FT
 import Data.FingerTree (FingerTree, Measured(..), ViewL(..), (<|), (><))
-import Data.Foldable (Foldable(foldMap))
 import Data.Semigroup
 import Data.Semigroup.Reducer
 import Data.Semigroup.Union
diff --git a/src/Text/Trifecta/Util/It.hs b/src/Text/Trifecta/Util/It.hs
--- a/src/Text/Trifecta/Util/It.hs
+++ b/src/Text/Trifecta/Util/It.hs
@@ -1,8 +1,9 @@
-{-# LANGUAGE MultiParamTypeClasses #-}
-{-# LANGUAGE BangPatterns #-}
+{-# LANGUAGE CPP #-}
 {-# LANGUAGE MagicHash #-}
-{-# LANGUAGE UnboxedTuples #-}
+{-# LANGUAGE BangPatterns #-}
 {-# LANGUAGE TypeFamilies #-}
+{-# LANGUAGE UnboxedTuples #-}
+{-# LANGUAGE MultiParamTypeClasses #-}
 -----------------------------------------------------------------------------
 -- |
 -- Module      :  Text.Trifecta.Util.It
@@ -26,12 +27,19 @@
   , sliceIt
   ) where
 
+#if __GLASGOW_HASKELL__ < 710
 import Control.Applicative
+#endif
 import Control.Comonad
 import Control.Monad
-import Data.Semigroup
+
+#if __GLASGOW_HASKELL__ < 710
+import Data.Monoid
+#endif
+
 import Data.ByteString as Strict
 import Data.ByteString.Lazy as Lazy
+import Data.Profunctor
 import Text.Trifecta.Rope
 import Text.Trifecta.Delta
 import Text.Trifecta.Util.Combinators as Util
@@ -47,6 +55,11 @@
 instance Functor (It r) where
   fmap f (Pure a) = Pure $ f a
   fmap f (It a k) = It (f a) $ fmap f . k
+  
+instance Profunctor It where
+  rmap = fmap
+  lmap _ (Pure a) = Pure a
+  lmap f (It a g) = It a (lmap f . g . f)
 
 instance Applicative (It r) where
   pure = Pure
diff --git a/tests/QuickCheck.hs b/tests/QuickCheck.hs
--- a/tests/QuickCheck.hs
+++ b/tests/QuickCheck.hs
@@ -1,5 +1,5 @@
-{-# LANGUAGE OverloadedStrings #-}
 {-# LANGUAGE CPP #-}
+{-# LANGUAGE OverloadedStrings #-}
 
 module Main
 ( main
@@ -10,7 +10,10 @@
 #if MIN_VERSION_base(4,7,0)
 import Data.Either
 #endif
+
+#if __GLASGOW_HASKELL__ < 710
 import Data.Monoid
+#endif
 
 import qualified Test.QuickCheck as Q
 
diff --git a/tests/doctests.hs b/tests/doctests.hs
--- a/tests/doctests.hs
+++ b/tests/doctests.hs
@@ -1,7 +1,10 @@
+{-# LANGUAGE CPP #-}
 module Main where
 
 import Build_doctests (deps)
+#if __GLASGOW_HASKELL__ < 710
 import Control.Applicative
+#endif
 import Control.Monad
 import Data.List
 import System.Directory
@@ -13,6 +16,7 @@
     "-isrc"
   : "-idist/build/autogen"
   : "-optP-include"
+  : "-fobject-code"
   : "-optPdist/build/autogen/cabal_macros.h"
   : "-hide-all-packages"
   : map ("-package="++) deps ++ sources
diff --git a/trifecta.cabal b/trifecta.cabal
--- a/trifecta.cabal
+++ b/trifecta.cabal
@@ -1,6 +1,6 @@
 name:          trifecta
 category:      Text, Parsing, Diagnostics, Pretty Printer, Logging
-version:       1.5.1.3
+version:       1.5.2
 license:       BSD3
 cabal-version: >= 1.10
 license-file:  LICENSE
@@ -45,9 +45,9 @@
     ansi-terminal        >= 0.6     && < 0.7,
     array                >= 0.3.0.2 && < 0.6,
     base                 >= 4.4     && < 5,
-    blaze-builder        >= 0.3.0.1 && < 0.4,
+    blaze-builder        >= 0.3.0.1 && < 0.5,
     blaze-html           >= 0.5     && < 0.9,
-    blaze-markup         >= 0.5     && < 0.7,
+    blaze-markup         >= 0.5     && < 0.8,
     bytestring           >= 0.9.1   && < 0.11,
     charset              >= 0.3.5.1 && < 1,
     comonad              >= 4       && < 5,
@@ -59,6 +59,7 @@
     lens                 >= 4.0     && < 5,
     mtl                  >= 2.0.1   && < 2.3,
     parsers              >= 0.12.1  && < 1,
+    profunctors          >= 4.0     && < 6,
     reducers             >= 3.10    && < 4,
     semigroups           >= 0.8.3.1 && < 1,
     transformers         >= 0.2     && < 0.5,
@@ -81,9 +82,6 @@
     directory >= 1.0,
     doctest   >= 0.9.1,
     filepath
-
-  if impl(ghc<7.6.1)
-    ghc-options: -Werror
 
 test-suite quickcheck
   type:    exitcode-stdio-1.0
