diff --git a/haddock-api.cabal b/haddock-api.cabal
--- a/haddock-api.cabal
+++ b/haddock-api.cabal
@@ -1,5 +1,5 @@
 name:                 haddock-api
-version:              2.17.2
+version:              2.17.3
 synopsis:             A documentation-generation tool for Haskell libraries
 description:          Haddock is a documentation-generation tool for Haskell
                       libraries
@@ -19,7 +19,6 @@
   resources
 data-files:
   html/solarized.css
-  html/frames.html
   html/haddock-util.js
   html/highlight.js
   html/Classic.theme/haskell_icon.gif
diff --git a/resources/html/frames.html b/resources/html/frames.html
deleted file mode 100644
--- a/resources/html/frames.html
+++ /dev/null
@@ -1,30 +0,0 @@
-<!DOCTYPE html
-     PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN"
-     "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml">
-<head>
-<title></title>
-<script src="haddock-util.js" type="text/javascript"></script>
-<script type="text/javascript"><!--
-/*
-
-  The synopsis frame needs to be updated using javascript, so we hide
-  it by default and only show it if javascript is enabled.
-
-  TODO: provide some means to disable it.
-*/
-function load() {
-  var d = document.getElementById("inner-fs");
-  d.rows = "50%,50%";
-  postReframe();
-}
---></script>
-</head>
-<frameset id="outer-fs" cols="25%,75%" onload="load()">
-  <frameset id="inner-fs" rows="100%,0%">
-    <frame src="index-frames.html" name="modules" />
-    <frame src="" name="synopsis" />
-  </frameset>
-  <frame src="index.html" name="main" />
-</frameset>
-</html>
diff --git a/resources/html/haddock-util.js b/resources/html/haddock-util.js
--- a/resources/html/haddock-util.js
+++ b/resources/html/haddock-util.js
@@ -248,33 +248,6 @@
   }
 }
 
-function adjustForFrames() {
-  var bodyCls;
-
-  if (parent.location.href == window.location.href) {
-    // not in frames, so add Frames button
-    addMenuItem("<a href='#' onclick='reframe();return true;'>Frames</a>");
-    bodyCls = "no-frame";
-  }
-  else {
-    bodyCls = "in-frame";
-  }
-  addClass(document.body, bodyCls);
-}
-
-function reframe() {
-  setCookie("haddock-reframe", document.URL);
-  window.location = "frames.html";
-}
-
-function postReframe() {
-  var s = getCookie("haddock-reframe");
-  if (s) {
-    parent.window.main.location = s;
-    clearCookie("haddock-reframe");
-  }
-}
-
 function styles() {
   var i, a, es = document.getElementsByTagName("link"), rs = [];
   for (i = 0; a = es[i]; i++) {
@@ -337,7 +310,6 @@
 
 function pageLoad() {
   addStyleMenu();
-  adjustForFrames();
   resetStyle();
   restoreCollapsed();
 }
diff --git a/src/Haddock/Backends/Xhtml.hs b/src/Haddock/Backends/Xhtml.hs
--- a/src/Haddock/Backends/Xhtml.hs
+++ b/src/Haddock/Backends/Xhtml.hs
@@ -36,14 +36,13 @@
 
 import Control.Monad         ( when, unless )
 import Data.Char             ( toUpper )
-import Data.List             ( sortBy, groupBy, intercalate, isPrefixOf )
+import Data.List             ( sortBy, intercalate, isPrefixOf )
 import Data.Maybe
 import System.FilePath hiding ( (</>) )
 import System.Directory
 import Data.Map              ( Map )
 import qualified Data.Map as Map hiding ( Map )
 import qualified Data.Set as Set hiding ( Set )
-import Data.Function
 import Data.Ord              ( comparing )
 
 import DynFlags (Language(..))
@@ -105,7 +104,8 @@
     copyCssFile f = copyFile f (combine odir (takeFileName f))
     copyLibFile f = copyFile (joinPath [libhtmldir, f]) (joinPath [odir, f])
   mapM_ copyCssFile (cssFiles themes)
-  mapM_ copyLibFile [ jsFile, framesFile ]
+  copyLibFile jsFile
+  return ()
 
 
 headHtml :: String -> Maybe String -> Themes -> Maybe String -> Html
@@ -268,10 +268,7 @@
   createDirectoryIfMissing True odir
   writeFile (joinPath [odir, contentsHtmlFile]) (renderToString debug html)
 
-  -- XXX: think of a better place for this?
-  ppHtmlContentsFrame odir doctitle themes mathjax_url ifaces debug
 
-
 ppPrologue :: Qualification -> String -> Maybe (MDoc GHC.RdrName) -> Html
 ppPrologue _ _ Nothing = noHtml
 ppPrologue qual title (Just doc) =
@@ -320,39 +317,6 @@
 
     subtree = mkNodeList qual (s:ss) p ts ! collapseSection p True ""
 
-
--- | Turn a module tree into a flat list of full module names.  E.g.,
--- @
---  A
---  +-B
---  +-C
--- @
--- becomes
--- @["A", "A.B", "A.B.C"]@
-flatModuleTree :: [InstalledInterface] -> [Html]
-flatModuleTree ifaces =
-    map (uncurry ppModule' . head)
-            . groupBy ((==) `on` fst)
-            . sortBy (comparing fst)
-            $ mods
-  where
-    mods = [ (moduleString mdl, mdl) | mdl <- map instMod ifaces ]
-    ppModule' txt mdl =
-      anchor ! [href (moduleHtmlFile mdl), target mainFrameName]
-        << toHtml txt
-
-
-ppHtmlContentsFrame :: FilePath -> String -> Themes -> Maybe String
-  -> [InstalledInterface] -> Bool -> IO ()
-ppHtmlContentsFrame odir doctitle themes maybe_mathjax_url ifaces debug = do
-  let mods = flatModuleTree ifaces
-      html =
-        headHtml doctitle Nothing themes maybe_mathjax_url +++
-        miniBody << divModuleList <<
-          (sectionName << "Modules" +++
-           ulist << [ li ! [theclass "module"] << m | m <- mods ])
-  createDirectoryIfMissing True odir
-  writeFile (joinPath [odir, frameIndexHtmlFile]) (renderToString debug html)
 
 
 --------------------------------------------------------------------------------
diff --git a/src/Haddock/Interface/Create.hs b/src/Haddock/Interface/Create.hs
--- a/src/Haddock/Interface/Create.hs
+++ b/src/Haddock/Interface/Create.hs
@@ -36,7 +36,6 @@
 import Control.DeepSeq
 import Control.Monad
 import Data.Function (on)
-import qualified Data.Foldable as F
 
 import qualified Packages
 import qualified Module
@@ -50,7 +49,7 @@
 import FastString (concatFS)
 import BasicTypes ( StringLiteral(..) )
 import qualified Outputable as O
-import HsDecls ( gadtDeclDetails,getConDetails )
+import HsDecls ( getConDetails )
 
 -- | Use a 'TypecheckedModule' to produce an 'Interface'.
 -- To do this, we need access to already processed modules in the topological
@@ -784,13 +783,21 @@
   | otherwise  =
     case unLoc decl of
       TyClD d@ClassDecl {} ->
-        let matches = [ sig | sig <- tcdSigs d, name `elem` sigName sig,
-                        isTypeLSig sig ] -- TODO: document fixity
+        let matches = [ lsig
+                      | lsig <- tcdSigs d
+                      , ClassOpSig False _ _ <- pure $ unLoc lsig
+                        -- Note: exclude `default` declarations (see #505)
+                      , name `elem` sigName lsig
+                      ]
+            -- TODO: document fixity
         in case matches of
           [s0] -> let (n, tyvar_names) = (tcdName d, tyClDeclTyVars d)
                       L pos sig = addClassContext n tyvar_names s0
                   in L pos (SigD sig)
-          _ -> error "internal: extractDecl (ClassDecl)"
+          _ -> O.pprPanic "extractDecl" (O.text "Ambiguous decl for" O.<+> O.ppr name O.<+> O.text "in class:"
+                                         O.$$ O.nest 4 (O.ppr d)
+                                         O.$$ O.text "Matches:"
+                                         O.$$ O.nest 4 (O.ppr matches))
       TyClD d@DataDecl {} ->
         let (n, tyvar_tys) = (tcdName d, lHsQTyVarsToTypes (tyClDeclTyVars d))
         in SigD <$> extractRecSel name mdl n tyvar_tys (dd_cons (tcdDataDefn d))
@@ -825,7 +832,7 @@
   matching_fields flds = [ (l,f) | f@(L _ (ConDeclField ns _ _)) <- flds
                                  , L l n <- ns, selectorFieldOcc n == nm ]
   data_ty
-    -- | ResTyGADT _ ty <- con_res con = ty
+    -- ResTyGADT _ ty <- con_res con = ty
     | ConDeclGADT{} <- con = hsib_body $ con_type con
     | otherwise = foldl' (\x y -> noLoc (HsAppTy x y)) (noLoc (HsTyVar (noLoc t))) tvs
 
diff --git a/src/Haddock/Interface/ParseModuleHeader.hs b/src/Haddock/Interface/ParseModuleHeader.hs
--- a/src/Haddock/Interface/ParseModuleHeader.hs
+++ b/src/Haddock/Interface/ParseModuleHeader.hs
@@ -76,7 +76,7 @@
 parseKey key toParse0 =
    do
       let
-         (spaces0,toParse1) = extractLeadingSpaces toParse0
+         (spaces0,toParse1) = extractLeadingSpaces (dropWhile (`elem` ['\r', '\n']) toParse0)
 
          indentation = spaces0
       afterKey0 <- extractPrefix key toParse1
diff --git a/src/Haddock/Utils.hs b/src/Haddock/Utils.hs
--- a/src/Haddock/Utils.hs
+++ b/src/Haddock/Utils.hs
@@ -21,10 +21,9 @@
   -- * Filename utilities
   moduleHtmlFile, moduleHtmlFile',
   contentsHtmlFile, indexHtmlFile,
-  frameIndexHtmlFile,
   moduleIndexFrameName, mainFrameName, synopsisFrameName,
   subIndexHtmlFile,
-  jsFile, framesFile,
+  jsFile,
 
   -- * Anchor and URL utilities
   moduleNameUrl, moduleNameUrl', moduleUrl,
@@ -262,13 +261,7 @@
 indexHtmlFile = "doc-index.html"
 
 
--- | The name of the module index file to be displayed inside a frame.
--- Modules are display in full, but without indentation.  Clicking opens in
--- the main window.
-frameIndexHtmlFile :: String
-frameIndexHtmlFile = "index-frames.html"
 
-
 moduleIndexFrameName, mainFrameName, synopsisFrameName :: String
 moduleIndexFrameName = "modules"
 mainFrameName = "main"
@@ -333,9 +326,8 @@
 -------------------------------------------------------------------------------
 
 
-jsFile, framesFile :: String
+jsFile :: String
 jsFile    = "haddock-util.js"
-framesFile = "frames.html"
 
 
 -------------------------------------------------------------------------------
