diff --git a/haskell-docs.cabal b/haskell-docs.cabal
--- a/haskell-docs.cabal
+++ b/haskell-docs.cabal
@@ -1,5 +1,5 @@
 name:                haskell-docs
-version:             4.2.6
+version:             4.2.7
 synopsis:            A program to find and display the docs and type of a name
 description:         Given a module name and a name, or just a name, it will find and display
                      the documentation of that name.
@@ -39,18 +39,20 @@
                      .
                      /CONTRIBUTION AND ISSUES/
                      .
-                     Issues\/ideas\/contributions please make a Github issue: <http://github.com/chrisdone/haskell-docs/issues>
+                     Issues\/ideas\/contributions please make a Github issue: <http://github.com/ivan-m/haskell-docs/issues>
                      .
 license:             BSD3
 license-file:        LICENSE
 author:              Chris Done
-maintainer:          chrisdone@gmail.com
+maintainer:          Ivan.Miljenovic@gmail.com
 copyright:           2012 Chris Done
 category:            Development
 build-type:          Simple
+Tested-With:         GHC == 7.4.2, GHC == 7.6.3, GHC == 7.8.4,
+                     GHC == 7.10.2, GHC == 8.0.1, GHC == 8.1.*
 cabal-version:       >=1.8
-Homepage:            http://github.com/chrisdone/haskell-docs
-Bug-Reports:         http://github.com/chrisdone/haskell-docs/issues
+Homepage:            http://github.com/ivan-m/haskell-docs
+Bug-Reports:         http://github.com/ivan-m/haskell-docs/issues
 extra-source-files:
   src/Haskell/Docs.hs
   src/Haskell/Docs/Ghc.hs
@@ -63,7 +65,7 @@
   src/haddock-api/Haskell/Docs/HaddockDoc.hs
 
 library
-  ghc-options:         -O2 -Wall
+  ghc-options:         -Wall
   if impl(ghc>=7.8.4)
     hs-source-dirs: src, src/haddock-api
   if impl(ghc<7.8.4)
@@ -85,31 +87,31 @@
                      , cryptohash
                      , directory
                      , filepath
-                     , ghc >= 7.2 && < 7.11
+                     , ghc >= 7.4 && < 8.1
                      , ghc-paths
                      , monad-loops
                      , process
                      , text
                      , text
                      , unordered-containers
+  if impl(ghc==8.0.*)
+     build-depends:   haddock-api==2.17.*
+                    , haddock-library
   if impl(ghc==7.10.*)
      build-depends:   haddock-api==2.16.*
                     , haddock-library
   if impl(ghc==7.8.4)
-    build-depends: haddock-api==2.15.*
+    build-depends:    haddock-api==2.15.*
+                    , haddock-library
   if impl(ghc==7.8.3)
     build-depends: haddock==2.14.*
   if impl(ghc==7.6.*)
     build-depends: haddock==2.13.*
   if impl(ghc==7.4.*)
     build-depends: haddock==2.11.*
-  if impl(ghc==7.2.*)
-    build-depends: haddock==2.9.*
 
   if impl(ghc>=7.8.4)
     build-depends: haddock-api
-  if impl(ghc<7.2)
-    build-depends: haddock
 
 executable haskell-docs
   hs-source-dirs:      src/main
@@ -128,4 +130,4 @@
 
 source-repository head
   type:        git
-  location:    git://github.com/chrisdone/haskell-docs.git
+  location:    git://github.com/ivan-m/haskell-docs.git
diff --git a/src/Haskell/Docs.hs b/src/Haskell/Docs.hs
--- a/src/Haskell/Docs.hs
+++ b/src/Haskell/Docs.hs
@@ -1,5 +1,4 @@
-{-# LANGUAGE TupleSections #-}
-{-# LANGUAGE ViewPatterns  #-}
+{-# LANGUAGE TupleSections, ViewPatterns #-}
 
 -- | Lookup the documentation of a name in a module (and in a specific
 -- package in the case of ambiguity).
@@ -16,7 +15,6 @@
 import Haskell.Docs.Haddock
 import Haskell.Docs.Index
 import Haskell.Docs.Types
-import PackageConfig           hiding (PackageName)
 
 import           Control.Exception
 import           Control.Monad
@@ -55,7 +53,7 @@
                                (nub docs))
   where searchResult pkgs (pkgName,modName) =
           case find (matchingPkg pkgName) pkgs of
-            Nothing -> return []
+            Nothing  -> return []
             Just pkg -> searchPkg pkg modName
           where matchingPkg pkgNm = (== pkgNm) . T.pack . showPackageName .
                                     getIdentifier
diff --git a/src/Haskell/Docs/Cabal.hs b/src/Haskell/Docs/Cabal.hs
--- a/src/Haskell/Docs/Cabal.hs
+++ b/src/Haskell/Docs/Cabal.hs
@@ -18,7 +18,7 @@
 import Module
 
 #if __GLASGOW_HASKELL__ >= 710
-import PackageConfig hiding (InstalledPackageInfo (..))
+import PackageConfig hiding (InstalledPackageInfo(..))
 #else
 import PackageConfig
 #endif
@@ -35,7 +35,14 @@
 getAllPackages :: [String] -> Ghc [PackageConfig.PackageConfig]
 getAllPackages _gs =
   do flags <- getSessionDynFlags
-     return (fromMaybe [] (pkgDatabase flags))
+     return (fromMaybe [] (pkgDB flags))
+
+pkgDB :: DynFlags -> Maybe [PackageConfig]
+#if __GLASGOW_HASKELL__ >= 800
+pkgDB = fmap (concatMap snd) . pkgDatabase
+#else
+pkgDB = pkgDatabase
+#endif
 
 -- | Version-portable version of allPackagesByName.
 #if MIN_VERSION_Cabal (1,22,0)
diff --git a/src/Haskell/Docs/Ghc.hs b/src/Haskell/Docs/Ghc.hs
--- a/src/Haskell/Docs/Ghc.hs
+++ b/src/Haskell/Docs/Ghc.hs
@@ -1,5 +1,4 @@
-{-# LANGUAGE CPP                 #-}
-{-# LANGUAGE ScopedTypeVariables #-}
+{-# LANGUAGE CPP, ScopedTypeVariables #-}
 {-# OPTIONS -Wall -fno-warn-missing-signatures #-}
 
 -- | Ghc compatibility layer.
@@ -47,7 +46,7 @@
              mty <- lookupName (head (filter ((==unIdentifier name).getOccString) names))
              case mty of
                Just (AnId i) -> return (Just i)
-               _ -> return Nothing)
+               _             -> return Nothing)
          (\(_ :: SomeException) -> return Nothing)
 
 -- | Make a module name.
@@ -84,6 +83,9 @@
 #if __GLASGOW_HASKELL__ == 710
 showSDocForUser = Outputable.showSDocForUser
 #endif
+#if __GLASGOW_HASKELL__ == 800
+showSDocForUser = Outputable.showSDocForUser
+#endif
 
 -- | Set the import context.
 setImportContext :: ModuleName -> Ghc ()
@@ -94,10 +96,11 @@
 #endif
 
 -- | Show the package name e.g. base.
-#if __GLASGOW_HASKELL__ >= 710
-showPackageName :: PackageKey -> String
+showPackageName :: PkgID -> String
+#if __GLASGOW_HASKELL__ >= 800
+showPackageName = unitIdString
+#elif __GLASGOW_HASKELL__ >= 710
 showPackageName = packageKeyString
 #else
-showPackageName :: PackageIdentifier -> String
 showPackageName = packageIdString . mkPackageId
 #endif
diff --git a/src/Haskell/Docs/Haddock.hs b/src/Haskell/Docs/Haddock.hs
--- a/src/Haskell/Docs/Haddock.hs
+++ b/src/Haskell/Docs/Haddock.hs
@@ -1,5 +1,4 @@
-{-# LANGUAGE CPP                 #-}
-{-# LANGUAGE ScopedTypeVariables #-}
+{-# LANGUAGE CPP, ScopedTypeVariables #-}
 {-# OPTIONS -Wall -fno-warn-missing-signatures #-}
 
 -- | Haddock compatibilty layer and query functions.
@@ -9,7 +8,7 @@
 import Haskell.Docs.Cabal
 import Haskell.Docs.Ghc
 import Haskell.Docs.HaddockDoc
-import Haskell.Docs.Types as T
+import Haskell.Docs.Types      as T
 
 import           Control.Arrow
 import           Control.Exception     (IOException, try)
@@ -77,7 +76,9 @@
 
 -- | Obtain the current notion of a package identifier.
 getIdentifier :: PackageConfig -> PkgID
-#if __GLASGOW_HASKELL__ >= 710
+#if __GLASGOW_HASKELL__ >= 800
+getIdentifier = packageConfigId
+#elif __GLASGOW_HASKELL__ >= 710
 getIdentifier = packageKey
 #else
 getIdentifier = sourcePackageId
@@ -188,7 +189,7 @@
           do result <- try (readInterfaceFile cache p)
              case result of
                Left (_::IOException) -> return (Left "Couldn't read file.")
-               Right r -> return r
+               Right r               -> return r
 
 -- * Internal functions
 
diff --git a/src/Haskell/Docs/Index.hs b/src/Haskell/Docs/Index.hs
--- a/src/Haskell/Docs/Index.hs
+++ b/src/Haskell/Docs/Index.hs
@@ -1,13 +1,11 @@
-{-# LANGUAGE CPP                 #-}
-{-# LANGUAGE OverloadedStrings   #-}
-{-# LANGUAGE ScopedTypeVariables #-}
-{-# LANGUAGE TupleSections       #-}
-{-# LANGUAGE ViewPatterns        #-}
+{-# LANGUAGE CPP, OverloadedStrings, ScopedTypeVariables, TupleSections,
+             ViewPatterns #-}
 
 -- | Make an index from identifiers to modules.
 
 module Haskell.Docs.Index where
 
+import Haskell.Docs.Cabal   (pkgDB)
 import Haskell.Docs.Ghc
 import Haskell.Docs.Haddock
 
@@ -84,7 +82,7 @@
   do packages <- withInitializedPackages
                    flags
                    (do df <- getSessionDynFlags
-                       return (fromMaybe [] (pkgDatabase df)))
+                       return (fromMaybe [] (pkgDB df)))
      fmap (concat . map explode . concat)
           (forM packages
                 (\package ->
@@ -147,7 +145,7 @@
   where chunks = T.split isSpace
         unpair t = case T.split (==':') t of
                      [package,modu] -> Just (package,modu)
-                     _ -> Nothing
+                     _              -> Nothing
         ins m (pkg,modu) = M.insertWith (++) pkg [modu] m
 
 -- | SHA1 hex-encode a string.
@@ -162,4 +160,4 @@
        Just uflags -> return uflags
        Nothing -> case lookup "GHC_PACKAGE_PATH" env of
            Just path -> return ("-no-user-pg-db" ++ "-pkg-db=" ++ path)
-           Nothing -> readProcess "ghc-pkg" ["--version"] ""
+           Nothing   -> readProcess "ghc-pkg" ["--version"] ""
diff --git a/src/Haskell/Docs/Types.hs b/src/Haskell/Docs/Types.hs
--- a/src/Haskell/Docs/Types.hs
+++ b/src/Haskell/Docs/Types.hs
@@ -18,7 +18,11 @@
 import GHC            (Id)
 import Module (ModuleName)
 
-#if __GLASGOW_HASKELL__ >= 710
+#if __GLASGOW_HASKELL__ >= 800
+import Module (UnitId)
+
+type PkgID = UnitId
+#elif __GLASGOW_HASKELL__ >= 710
 import Module (PackageKey)
 
 type PkgID = PackageKey
diff --git a/src/haddock-api/Haskell/Docs/HaddockDoc.hs b/src/haddock-api/Haskell/Docs/HaddockDoc.hs
--- a/src/haddock-api/Haskell/Docs/HaddockDoc.hs
+++ b/src/haddock-api/Haskell/Docs/HaddockDoc.hs
@@ -6,15 +6,17 @@
 
 import           Control.Arrow
 import           Data.Char
-import           Data.Map                    (Map)
-import qualified Data.Map                    as M
-import           Documentation.Haddock       (Doc, DocH (..), Example (..),
-                                              Hyperlink (..),
-                                              InstalledInterface (..))
-import           Documentation.Haddock.Types (_doc)
-import           GHC                         (Name, moduleNameString)
-import           Name                        (getOccString, occNameString)
+import           Data.Map              (Map)
+import qualified Data.Map              as M
+import           Documentation.Haddock (Doc, DocH(..), Example(..),
+                                        Hyperlink(..), InstalledInterface(..))
+import           GHC                   (Name, moduleNameString)
+import           Name                  (getOccString, occNameString)
 
+#if MIN_VERSION_haddock_api(2,16,0)
+import Documentation.Haddock.Types (_doc)
+#endif
+
 -- | Render the doc.
 doc :: Doc String -> String
 doc DocEmpty = ""
@@ -30,6 +32,10 @@
 doc (DocCodeBlock bl) = unlines (map ("    " ++) (lines (doc bl))) ++ "\n"
 doc (DocAName name) = name
 doc (DocExamples exs) = unlines (map formatExample exs)
+#if MIN_VERSION_haddock_api (2,17,0)
+doc (DocMathInline mth) = mth
+doc (DocMathDisplay mth) = mth
+#endif
 
 -- The header type is unexported, so this constructor is useless.
 doc (DocIdentifier i) = i
