@@ -6,6 +6,7 @@ import Data.Char (isUpper)
66import Data.Function (on)
77import Data.Traversable (traverse)
88
9+import Control.Arrow (second)
910import Control.Applicative ((<$>), (<*>))
1011import Control.Monad.Trans.Reader (asks, runReaderT, ReaderT)
1112import Control.Monad.Trans.State.Strict
@@ -196,13 +197,15 @@ typeDecls = mapMaybe getTypeName . filter P.isDataDecl . P.exportedDeclarations
196197 getTypeName _ = Nothing
197198
198199identNames :: P.Module -> [(N.Ident, P.Declaration)]
199−identNames = nubOnFst . mapMaybe getDeclName . P.exportedDeclarations
200+identNames = nubOnFst . concatMap getDeclNames . P.exportedDeclarations
200201 where
201− getDeclName :: P.Declaration -> Maybe (P.Ident, P.Declaration)
202− getDeclName d@(P.ValueDeclaration ident _ _ _) = Just (ident, d)
203− getDeclName d@(P.ExternDeclaration ident _) = Just (ident, d)
204− getDeclName (P.PositionedDeclaration _ _ d) = getDeclName d
205− getDeclName _ = Nothing
202+ getDeclNames :: P.Declaration -> [(P.Ident, P.Declaration)]
203+ getDeclNames d@(P.ValueDeclaration ident _ _ _) = [(ident, d)]
204+ getDeclNames d@(P.TypeDeclaration ident _ ) = [(ident, d)]
205+ getDeclNames d@(P.ExternDeclaration ident _) = [(ident, d)]
206+ getDeclNames d@(P.TypeClassDeclaration _ _ _ ds) = map (second (const d)) $ concatMap getDeclNames ds
207+ getDeclNames (P.PositionedDeclaration _ _ d) = getDeclNames d
208+ getDeclNames _ = []
206209
207210dctorNames :: P.Module -> [(N.ProperName, P.Declaration)]
208211dctorNames = nubOnFst . concatMap go . P.exportedDeclarations