diff --git a/scion-browser.cabal b/scion-browser.cabal
--- a/scion-browser.cabal
+++ b/scion-browser.cabal
@@ -1,5 +1,5 @@
 name:           scion-browser
-version:        0.3.3
+version:        0.3.4
 cabal-version:  >= 1.8
 build-type:     Simple
 license:        BSD3
@@ -25,7 +25,7 @@
     text,
     parsec >= 3 && < 4,
     Cabal >= 0.10,
-    haskell-src-exts >= 1.11 && < 1.16,
+    haskell-src-exts >= 1.11 && < 1.17,
     process >= 1 && < 2,
     tar >= 0.3 && < 0.5,
     zlib == 0.5.*,
@@ -76,23 +76,22 @@
     Scion.PersistentHoogle
     
   ghc-options: -rtsopts -Wall -fno-warn-unused-do-bind -fno-warn-orphans
-  other-modules:   
-                   Scion.Packages,
-                   Scion.PersistentBrowser.DbTypes,
-                   Scion.PersistentBrowser.FileUtil,
-                   Scion.PersistentBrowser.FromMissingH,
-                   Scion.PersistentBrowser.Instances.Json,
-                   Scion.PersistentBrowser.Parser,
-                   Scion.PersistentBrowser.Parser.Documentable,
-                   Scion.PersistentBrowser.Parser.Internal,
-                   Scion.PersistentBrowser.TempFile,
-                   Scion.PersistentBrowser.ToDb,
-                   Scion.PersistentBrowser.Types,
-                   Scion.PersistentBrowser.Util,
-                   Scion.PersistentHoogle.Instances.Json,
-                   Scion.PersistentHoogle.Parser,
-                   Scion.PersistentHoogle.Types,
-                   Scion.PersistentHoogle.Util
+  other-modules:   
+                   Scion.Packages,
+                   Scion.PersistentBrowser.DbTypes,
+                   Scion.PersistentBrowser.FileUtil,
+                   Scion.PersistentBrowser.FromMissingH,
+                   Scion.PersistentBrowser.Instances.Json,
+                   Scion.PersistentBrowser.Parser,
+                   Scion.PersistentBrowser.Parser.Internal,
+                   Scion.PersistentBrowser.TempFile,
+                   Scion.PersistentBrowser.ToDb,
+                   Scion.PersistentBrowser.Types,
+                   Scion.PersistentBrowser.Util,
+                   Scion.PersistentHoogle.Instances.Json,
+                   Scion.PersistentHoogle.Parser,
+                   Scion.PersistentHoogle.Types,
+                   Scion.PersistentHoogle.Util
 
 executable scion-browser
   hs-source-dirs:  src
@@ -106,7 +105,7 @@
     text,
     parsec >= 3 && < 4,
     Cabal >= 0.10,
-    haskell-src-exts >= 1.11 && < 1.16,
+    haskell-src-exts >= 1.11 && < 1.17,
     process >= 1 && < 2,
     tar >= 0.3 && < 0.5,
     zlib == 0.5.*,
@@ -152,90 +151,27 @@
   --   extra-libraries:   tinfo
     
   ghc-options: -rtsopts -Wall -fno-warn-unused-do-bind -fno-warn-orphans -threaded
-  other-modules:   
-                   Scion.Packages,
-                   Scion.PersistentBrowser,
-                   Scion.PersistentBrowser.Build,
-                   Scion.PersistentBrowser.DbTypes,
-                   Scion.PersistentBrowser.FileUtil,
-                   Scion.PersistentBrowser.FromMissingH,
-                   Scion.PersistentBrowser.Instances.Json,
-                   Scion.PersistentBrowser.Parser,
-                   Scion.PersistentBrowser.Parser.Documentable,
-                   Scion.PersistentBrowser.Parser.Internal,
-                   Scion.PersistentBrowser.Query,
-                   Scion.PersistentBrowser.TempFile,
-                   Scion.PersistentBrowser.ToDb,
-                   Scion.PersistentBrowser.Types,
-                   Scion.PersistentBrowser.Util,
-                   Scion.PersistentHoogle,
-                   Scion.PersistentHoogle.Instances.Json,
-                   Scion.PersistentHoogle.Parser,
-                   Scion.PersistentHoogle.Types,
-                   Scion.PersistentHoogle.Util,
-                   Server.PersistentCommands
-
---test-suite BrowserTests
---  main-is:         Test.hs
---  type:            exitcode-stdio-1.0
---  x-uses-tf:       true
---  ghc-options:     -Wall -rtsopts
---  hs-source-dirs:  src, test
---  other-modules:   Scion.Browser.Parser.Documentable, Scion.Browser.Parser.Internal, Scion.Browser.Parser, Scion.Browser.ParserTests, Scion.PersistentHoogle.Util
---  
---  build-depends:
---    HUnit             >= 1.2 && < 2,
---    QuickCheck        >= 2.4,
---    test-framework    >= 0.4.1,
---    test-framework-quickcheck2,
---    test-framework-hunit,
---    split,
---    haskeline         >= 0.6,
---    -- From library
---    attoparsec        >= 0.10,
---    base              == 4.*,
---    mtl               >= 2,
---    derive            >= 2.5 && < 3,
---    text              == 0.11.*,
---    parsec            >= 3 && < 4,
---    Cabal             >= 0.10, 
---    haskell-src-exts  >= 1.11 && < 2,
---    process           >= 1 && < 2,
---    tar               == 0.3.*,
---    zlib              == 0.5.*,
---    HTTP              >= 4000 && < 5000,
---    deepseq           >= 1.1 && < 2,
---    aeson             >= 0.4,
---    parallel-io       >= 0.3,
---    utf8-string       ,
---    persistent >= 0.7,
---    persistent-sqlite >= 0.7,
---    persistent-template >= 0.7,
---    conduit,
---    transformers,
---    unordered-containers >= 0.1.3,
---    zlib,
---    -- For Scion.packages (provisional)
---    ghc-paths         == 0.1.*
---  
---  if !os(mingw32)
---    build-depends:
---      unix            >= 2 && < 3
---  
---  if impl(ghc >= 7.0)
---    build-depends:
---      containers      >= 0.2 && < 0.5,
---      directory       == 1.1.*,
---      filepath        == 1.2.*,
---      bytestring,
---      -- For Scion.Packages (provisional)
---      ghc             >= 7
---  else
---    build-depends:
---      containers      >= 0.2 && < 0.4,
---      directory       == 1.0.*,
---      filepath        == 1.1.*,
---      bytestring,
+  other-modules:   
+                   Scion.Packages,
+                   Scion.PersistentBrowser,
+                   Scion.PersistentBrowser.Build,
+                   Scion.PersistentBrowser.DbTypes,
+                   Scion.PersistentBrowser.FileUtil,
+                   Scion.PersistentBrowser.FromMissingH,
+                   Scion.PersistentBrowser.Instances.Json,
+                   Scion.PersistentBrowser.Parser,
+                   Scion.PersistentBrowser.Parser.Internal,
+                   Scion.PersistentBrowser.Query,
+                   Scion.PersistentBrowser.TempFile,
+                   Scion.PersistentBrowser.ToDb,
+                   Scion.PersistentBrowser.Types,
+                   Scion.PersistentBrowser.Util,
+                   Scion.PersistentHoogle,
+                   Scion.PersistentHoogle.Instances.Json,
+                   Scion.PersistentHoogle.Parser,
+                   Scion.PersistentHoogle.Types,
+                   Scion.PersistentHoogle.Util,
+                   Server.PersistentCommands
 --      -- For Scion.Packages (provisional)
 
 
diff --git a/src/Scion/PersistentBrowser/Parser/Documentable.hs b/src/Scion/PersistentBrowser/Parser/Documentable.hs
deleted file mode 100644
--- a/src/Scion/PersistentBrowser/Parser/Documentable.hs
+++ /dev/null
@@ -1,88 +0,0 @@
-{-# LANGUAGE MultiParamTypeClasses, FunctionalDependencies, TypeSynonymInstances, FlexibleInstances #-}
-
-module Scion.PersistentBrowser.Parser.Documentable where
-
-import Scion.PersistentBrowser.Types
-import qualified Language.Haskell.Exts.Syntax as S
-import qualified Language.Haskell.Exts.Annotated.Syntax as A
-
-class Documentable a b | a -> b where
-  document :: Doc -> a -> (Documented b)
-
-instance Documentable S.Type A.Type where
-  document d (S.TyForall b c t) = A.TyForall d (fmap (fmap (document d)) b)
-                                               (Just (document d c))
-                                               (document d t)
-  document d (S.TyFun t1 t2)    = A.TyFun d (document d t1)
-                                            (document d t2)
-  document d (S.TyTuple b t)    = A.TyTuple d (documentBoxed d b)
-                                              (fmap (document d) t)
-  document d (S.TyList t)       = A.TyList d (document d t)
-  document d (S.TyApp t1 t2)    = A.TyApp d (document d t1)
-                                            (document d t2)
-  document d (S.TyVar n)        = A.TyVar d (document d n)
-  document d (S.TyCon c)        = A.TyCon d (document d c)
-  document d (S.TyParen t)      = A.TyParen d (document d t)
-  document d (S.TyInfix l n r)  = A.TyInfix d (document d l)
-                                              (document d n)
-                                              (document d r)
-  document d (S.TyKind t k)     = A.TyKind d (document d t)
-                                             (document d k)
-
-instance Documentable S.TyVarBind A.TyVarBind where
-  document d (S.KindedVar n k) = A.KindedVar d (document d n)
-                                               (document d k)
-  document d (S.UnkindedVar n) = A.UnkindedVar d (document d n)
-
-instance Documentable S.Context A.Context where
-  document d [a] = A.CxSingle d (document d a)
-  document d v   = A.CxTuple d (fmap (document d) v)
-
-instance Documentable S.Asst A.Asst where
-  document d (S.ClassA q t)   = A.ClassA d (document d q)
-                                           (fmap (document d) t)
-  document d (S.InfixA l q r) = A.InfixA d (document d l)
-                                           (document d q)
-                                           (document d r)
-  document d (S.IParam n t)   = A.IParam d (document d n)
-                                           (document d t)
-  document d (S.EqualP t1 t2) = A.EqualP d (document d t1)
-                                           (document d t2)
-
-instance Documentable S.Name A.Name where
-  document d (S.Ident s)  = A.Ident d s
-  document d (S.Symbol s) = A.Symbol d s
-
-instance Documentable S.QName A.QName where
-  document d (S.Qual mn n) = A.Qual d (document d mn)
-                                      (document d n)
-  document d (S.UnQual n)  = A.UnQual d (document d n)
-  document d (S.Special c) = A.Special d (document d c)
-
-instance Documentable S.ModuleName A.ModuleName where
-  document d (S.ModuleName n) = A.ModuleName d n
-
-instance Documentable S.IPName A.IPName where
-  document d (S.IPDup s) = A.IPDup d s
-  document d (S.IPLin s) = A.IPLin d s
-
-instance Documentable S.SpecialCon A.SpecialCon where
-  document d S.UnitCon          = A.UnitCon d
-  document d S.ListCon          = A.ListCon d
-  document d S.FunCon           = A.FunCon d
-  document d (S.TupleCon b n)   = A.TupleCon d (documentBoxed d b) n
-  document d S.Cons             = A.Cons d
-  document d S.UnboxedSingleCon = A.UnboxedSingleCon d
-
-instance Documentable S.Kind A.Kind where
-  document d S.KindStar       = A.KindStar d
-  document d S.KindBang       = A.KindBang d
-  document d (S.KindFn k1 k2) = A.KindFn d (document d k1)
-                                           (document d k2)
-  document d (S.KindParen k)  = A.KindParen d (document d k)
-  document d (S.KindVar n)    = A.KindVar d (document d n)
-
-documentBoxed :: Doc -> S.Boxed -> A.Boxed
-documentBoxed _ S.Boxed   = A.Boxed
-documentBoxed _ S.Unboxed = A.Unboxed
-
diff --git a/src/Scion/PersistentBrowser/Parser/Internal.hs b/src/Scion/PersistentBrowser/Parser/Internal.hs
--- a/src/Scion/PersistentBrowser/Parser/Internal.hs
+++ b/src/Scion/PersistentBrowser/Parser/Internal.hs
@@ -10,10 +10,10 @@
 import Distribution.Version
 import Language.Haskell.Exts.Annotated.Syntax
 import Language.Haskell.Exts.Extension
-import qualified Language.Haskell.Exts.Parser as Parser
+import qualified Language.Haskell.Exts.Annotated as Parser
 import Scion.PersistentBrowser.Types
 import Scion.PersistentBrowser.FromMissingH (replace)
-import Scion.PersistentBrowser.Parser.Documentable
+-- import Scion.PersistentBrowser.Parser.Documentable
 import Text.Parsec.String as BS
 import Text.Parsec.Char
 import Text.Parsec.Combinator
@@ -90,7 +90,7 @@
 
 getModuleName :: Documented Module -> String
 getModuleName (Module _ (Just (ModuleHead _ (ModuleName _ name) _ _)) _ _ _) = name
-getModuleName _ = error "This should never happen"
+getModuleName _ = error "getModuleName: This should never happen: a module with no name"
 
 decl :: Doc -> BSParser [Documented Decl]
 decl doc =  choice [ listed $ function doc
@@ -131,7 +131,7 @@
                     parsed = Parser.parseTypeWithMode parseTypeMode noHashString
                  in case parsed of
                       Parser.ParseFailed _ _ -> TyVar NoDoc (Ident NoDoc "not parsed")
-                      Parser.ParseOk ty -> mapOnNames (theInverseReplacements . generateInverseLatinReplacements nonAsciiChars) (document NoDoc ty)
+                      Parser.ParseOk ty -> mapOnNames (theInverseReplacements . generateInverseLatinReplacements nonAsciiChars) (fmap (const NoDoc) ty)
 
 theReplacements :: String -> String
 theReplacements = (replace "#" "__HASH__") . (replace "[:" "__GHC_ARR_OPEN__") . (replace ":]" "__GHC_ARR_CLOSE__") . (replace "!" "BANG__")
@@ -173,6 +173,7 @@
 mapOnNames f (TyParen doc ty) = TyParen doc (mapOnNames f ty)
 mapOnNames f (TyInfix doc t1 name t2) = TyInfix doc (mapOnNames f t1) (mapOnNamesQName f name) (mapOnNames f t2)
 mapOnNames f (TyKind doc ty k) = TyKind doc (mapOnNames f ty) k
+mapOnNames _ r = r
 
 mapOnNamesTyVar :: (String -> String) -> Documented TyVarBind -> Documented TyVarBind
 mapOnNamesTyVar f (KindedVar doc name k) = KindedVar doc (mapOnNamesName f name) k
@@ -190,7 +191,9 @@
 mapOnNamesContext :: (String -> String) -> Documented Context -> Documented Context
 mapOnNamesContext f (CxSingle doc asst) = CxSingle doc (mapOnNamesAsst f asst)
 mapOnNamesContext f (CxTuple doc assts) = CxTuple doc (fmap (mapOnNamesAsst f) assts)
+#if !MIN_VERSION_haskell_src_exts(1,16,0) 
 mapOnNamesContext f (CxParen doc ctx)   = CxParen doc (mapOnNamesContext f ctx)         
+#endif
 mapOnNamesContext _ (CxEmpty doc)       = CxEmpty doc
 
 mapOnNamesAsst :: (String -> String) -> Documented Asst -> Documented Asst
@@ -198,6 +201,7 @@
 mapOnNamesAsst f (InfixA doc ty1 name ty2) = InfixA doc (mapOnNames f ty1) (mapOnNamesQName f name) (mapOnNames f ty2)
 mapOnNamesAsst f (IParam doc name ty) = IParam doc (mapOnNamesIPName f name) (mapOnNames f ty)
 mapOnNamesAsst f (EqualP doc ty1 ty2) = EqualP doc (mapOnNames f ty1) (mapOnNames f ty2)
+mapOnNamesAsst _ r = r
 
 mapOnNamesIPName :: (String -> String) -> Documented IPName -> Documented IPName
 mapOnNamesIPName f (IPDup doc s) = IPDup doc (f s)
@@ -231,7 +235,11 @@
 
 constructor :: Doc -> BSParser (Documented GadtDecl)
 constructor doc = do (names, ty) <- functionLike conid
+#if MIN_VERSION_haskell_src_exts(1,16,0) 
+                     return $ GadtDecl doc (head names) Nothing ty
+#else
                      return $ GadtDecl doc (head names) ty
+#endif
 
 constructorOrFunction :: Doc -> BSParser (Either (Documented Decl) (Documented GadtDecl))
 constructorOrFunction doc = do f <- function doc
@@ -290,8 +298,13 @@
                    let (ctx, ty) = getContextAndType ty'
                        (qhead:params) = lineariseType ty
                    case qhead of
+#if MIN_VERSION_haskell_src_exts(1,16,0) 
+                     TyCon _ qname -> return $ InstDecl doc Nothing (IRule NoDoc Nothing ctx (IHCon NoDoc qname)) Nothing
+                     _             -> return $ InstDecl doc Nothing (IRule NoDoc Nothing ctx (IHCon NoDoc (UnQual NoDoc (Ident NoDoc "#unparsed#")))) Nothing
+#else                   
                      TyCon _ qname -> return $ InstDecl doc ctx (IHead NoDoc qname params) Nothing
                      _             -> return $ InstDecl doc ctx (IHead NoDoc (UnQual NoDoc (Ident NoDoc "#unparsed#")) params) Nothing
+#endif
 
 type_ :: Doc -> BSParser (Documented Decl)
 type_ doc = do string "type"
@@ -303,7 +316,12 @@
                spaces0
                rest <- restOfLine
                ty <- parseType rest
+#if MIN_VERSION_haskell_src_exts(1,16,0) 
+               let h = foldl (\h1 tv -> DHApp NoDoc h1 tv) (DHead NoDoc con) vars
+               return $ TypeDecl doc h ty
+#else
                return $ TypeDecl doc (DHead NoDoc con vars) ty
+#endif
 
 tyVarBind :: BSParser (Documented TyVarBind)
 tyVarBind = (do char '('
@@ -549,8 +567,13 @@
                                 ((TyCon _ (Qual _ _ name')):params) -> (name', toKindedVars params) 
                                 ((TyCon _ (Special l _)):params)    -> (Symbol l "", toKindedVars params)
                                 (_:params)                          -> (Ident NoDoc "#unparsed#", toKindedVars params)
-                                []                                  -> error "This should never happen"
+                                []                                  -> error $ "typeToContextAndHead: This should never happen: " ++ (show $ lineariseType ty)
+#if MIN_VERSION_haskell_src_exts(1,16,0) 
+                             h = foldl (\h1 tv -> DHApp NoDoc h1 tv) (DHead NoDoc name) vars
+                         in  (ctx, h)
+#else
                          in  (ctx, DHead NoDoc name vars)
+#endif
 
 toKindedVars :: [Type Doc] -> [TyVarBind Doc]
 toKindedVars []         = []
@@ -558,5 +581,7 @@
   (UnkindedVar d (Ident NoDoc $ n1 ++ "[" ++ n2 ++ "]")) : toKindedVars xs
 toKindedVars ((TyVar d n):xs)       = (UnkindedVar d n) : toKindedVars xs
 toKindedVars ((TyParen _ inner):xs) = toKindedVars (inner:xs)
-toKindedVars (x:_)                  = error $ show x
+toKindedVars ((TyApp _ t _):xs) = toKindedVars [t] ++ toKindedVars xs
+-- TyApp NoDoc (TyApp NoDoc (TyVar NoDoc (Ident NoDoc "l_a5YI")) (TyCon NoDoc (UnQual NoDoc (Ident NoDoc "Z")))) (TyCon NoDoc (UnQual NoDoc (Ident NoDoc "Z")))
+toKindedVars _                  = [] -- error $ show x
 
diff --git a/src/Scion/PersistentBrowser/ToDb.hs b/src/Scion/PersistentBrowser/ToDb.hs
--- a/src/Scion/PersistentBrowser/ToDb.hs
+++ b/src/Scion/PersistentBrowser/ToDb.hs
@@ -1,6 +1,7 @@
-{-# LANGUAGE RankNTypes, KindSignatures #-}
+{-# LANGUAGE RankNTypes, KindSignatures, CPP #-}
 module Scion.PersistentBrowser.ToDb where
 
+import Data.Maybe (maybeToList)
 import qualified Data.Map as M
 import qualified Data.Text as T
 import Data.Version (showVersion)
@@ -8,6 +9,7 @@
 import Distribution.Package hiding (Package)
 import Language.Haskell.Exts.Annotated.Syntax hiding (String)
 import Language.Haskell.Exts.Pretty
+import Language.Haskell.Exts.SrcLoc
 import Scion.PersistentBrowser.DbTypes
 import Scion.PersistentBrowser.Types
 
@@ -23,7 +25,7 @@
 saveModuleToDb pkgId (Module doc (Just (ModuleHead _ (ModuleName _ name)_ _)) _ _ decls) =
   do moduleId <- insert $ DbModule name (docToString doc) pkgId
      mapM_ (saveDeclToDb moduleId) decls
-saveModuleToDb _ _ = error "This should never happen"
+saveModuleToDb _ m = error $ "saveModuleToDb: This should never happen" ++ (show m)
 
 -- saveDeclToDb :: PersistBackend backend m => DbModuleId -> Documented Decl -> backend m ()
 -- Datatypes
@@ -51,8 +53,14 @@
      mapM_ (saveContextToDb declId) (contextToDb (maybeEmptyContext ctx))
      mapM_ (saveFunDepToDb declId) (map singleLinePrettyPrint fdeps)
 -- Instances
+#if MIN_VERSION_haskell_src_exts(1,16,0) 
+saveDeclToDb moduleId (InstDecl doc _ hd _) =
+  do let (declName, declVars) = instRuleToDb hd
+         ctx = Nothing
+#else
 saveDeclToDb moduleId (InstDecl doc ctx hd _) =
   do let (declName, declVars) = instHeadToDb hd
+#endif
      declId <- insert $ DbDecl DbInstance declName (docToString doc)
                                Nothing Nothing Nothing moduleId
      mapM_ (saveTyVarToDb declId) declVars
@@ -70,7 +78,7 @@
                                Nothing Nothing (Just (singleLinePrettyPrint ty)) moduleId
      mapM_ (saveTyVarToDb declId) declVars
 -- Other
-saveDeclToDb _ _ = error "This should never happen"
+saveDeclToDb _ t = error $ "saveDeclToDb: This should never happen" ++ (show t)
 
 -- saveTyVarToDb :: PersistBackend backend m => DbDeclId -> String -> backend m ()
 saveTyVarToDb declId var = insert $ DbTyVar var declId
@@ -82,8 +90,11 @@
 saveContextToDb declId ctx = insert $ DbContext ctx declId
 
 -- saveConstructorToDb :: PersistBackend backend m => DbDeclId -> Documented GadtDecl -> backend m ()
+#if MIN_VERSION_haskell_src_exts(1,16,0) 
+saveConstructorToDb declId (GadtDecl _ name _ ty) = insert $ DbConstructor (getNameString name) (singleLinePrettyPrint ty) declId
+#else
 saveConstructorToDb declId (GadtDecl _ name ty) = insert $ DbConstructor (getNameString name) (singleLinePrettyPrint ty) declId
-
+#endif
 -- DELETE PACKAGE FROM DATABASE
 -- ============================
 
@@ -120,14 +131,38 @@
 docToString NoDoc     = Nothing
 docToString (Doc doc) = Just (T.unpack doc)
 
-declHeadToDb :: DeclHead l -> (String, [String])
+declHeadToDb :: (Show l) => DeclHead l -> (String, [String])
+#if MIN_VERSION_haskell_src_exts(1,16,0) 
+declHeadToDb (DHead _ name) = (getNameString name, [])
+declHeadToDb (DHApp _ h _) = declHeadToDb h
+#else
 declHeadToDb (DHead _ name vars) = (getNameString name, map singleLinePrettyPrint vars)
-declHeadToDb _ = error "This should never happen"
+#endif
+declHeadToDb h = error $ "declHeadToDb: This should never happen" ++ (show h)
 
-instHeadToDb :: InstHead l -> (String, [String])
+#if MIN_VERSION_haskell_src_exts(1,16,0) 
+instRuleToDb :: (Show l) => InstRule l -> (String, [String])
+instRuleToDb (IRule _ mt _ (IHCon _ name )) = (getQNameString name, map singleLinePrettyPrint $ concat $ maybeToList mt)
+instRuleToDb r = error $ "instRuleToDb: This should never happen" ++ (show r)
+#endif
+
+instHeadToDb :: (Show l) => InstHead l -> (String, [String])
+#if MIN_VERSION_haskell_src_exts(1,16,0) 
+instHeadToDb (IHCon _ name) = (getQNameString name, [])
+#else
 instHeadToDb (IHead _ name vars) = (getQNameString name, map singleLinePrettyPrint vars)
-instHeadToDb _ = error "This should never happen"
+#endif
+instHeadToDb h = error $ "instHeadToDb: This should never happen" ++ (show h)
 
+#if MIN_VERSION_haskell_src_exts(1,16,0) 
+instance SrcInfo Doc where
+  toSrcInfo _ _ _ = NoDoc
+  fromSrcInfo _ = NoDoc
+  fileName = const "<unknown"
+  startLine = const 0
+  startColumn = const 0
+#endif
+
 singleLinePrettyPrint :: Pretty a => a -> String
 singleLinePrettyPrint = prettyPrintWithMode $ defaultMode { layout = PPNoLayout }
 
@@ -135,9 +170,15 @@
 maybeEmptyContext Nothing    = CxEmpty NoDoc
 maybeEmptyContext (Just ctx) = ctx
 
+#if MIN_VERSION_haskell_src_exts(1,16,0) 
+contextToDb :: (SrcInfo l) => Context l -> [String]
+#else
 contextToDb :: Context l -> [String]
+#endif
 contextToDb (CxSingle _ a)  = [ singleLinePrettyPrint a ]
 contextToDb (CxTuple _ as)  = map singleLinePrettyPrint as
+#if !MIN_VERSION_haskell_src_exts(1,16,0) 
 contextToDb (CxParen _ ctx) = contextToDb ctx
+#endif
 contextToDb (CxEmpty _)     = []
 
diff --git a/src/Scion/PersistentBrowser/Types.hs b/src/Scion/PersistentBrowser/Types.hs
--- a/src/Scion/PersistentBrowser/Types.hs
+++ b/src/Scion/PersistentBrowser/Types.hs
@@ -1,4 +1,4 @@
-{-# LANGUAGE QuasiQuotes, TemplateHaskell,MultiParamTypeClasses, FunctionalDependencies #-}
+{-# LANGUAGE QuasiQuotes, TemplateHaskell,MultiParamTypeClasses, FunctionalDependencies, CPP #-}
 
 module Scion.PersistentBrowser.Types where
 
@@ -80,10 +80,18 @@
   getChildren _                      = []
 
 instance Named Decl where
+
+#if MIN_VERSION_haskell_src_exts(1,16,0) 
+  getName (TypeDecl _ (DHead _ name) _)          = getNameString name
+  getName (GDataDecl _ _ _ (DHead _ name) _ _ _) = getNameString name
+  getName (ClassDecl _ _ (DHead _ name) _ _)     = getNameString name
+  getName (InstDecl _ _ (IRule _ _ _ (IHCon _ name )) _)        = getQNameString name
+#else  
   getName (TypeDecl _ (DHead _ name _) _)          = getNameString name
   getName (GDataDecl _ _ _ (DHead _ name _) _ _ _) = getNameString name
   getName (ClassDecl _ _ (DHead _ name _) _ _)     = getNameString name
   getName (InstDecl _ _ (IHead _ name _) _)        = getQNameString name
+#endif  
   getName (TypeSig _ name _)                       = concat $ intersperse "," $ map getNameString name
   getName v                                        = error $ "This should not be possible: " ++ show v
 
@@ -92,5 +100,8 @@
   getChildren _                            = []
 
 instance Named GadtDecl where
+#if MIN_VERSION_haskell_src_exts(1,16,0) 
+  getName (GadtDecl _ name _ _) = getNameString name
+#else
   getName (GadtDecl _ name _) = getNameString name
-
+#endif
