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