@@ -59,7 +59,7 @@ isExported (Just exps) decl = any (matches decl) exps
59 matches _ _ = False
59 matches _ _ = False
61exportedDeclarations :: Module -> [Declaration]
61exportedDeclarations :: Module -> [Declaration]
62−exportedDeclarations (Module _ decls exps) = filter (isExported exps) decls
62+exportedDeclarations (Module _ decls exps) = filter (isExported exps) (flattenDecls decls)
65-- Test if a data constructor for a given type is exported, given a module's export list.
65-- Test if a data constructor for a given type is exported, given a module's export list.
@@ -80,7 +80,7 @@ exportedDctors :: Module -> ProperName -> [ProperName]
80exportedDctors (Module _ decls exps) ident =
80exportedDctors (Module _ decls exps) ident =
81 filter (isDctorExported ident exps) dctors
81 filter (isDctorExported ident exps) dctors
83− dctors = concatMap getDctors decls
83+ dctors = concatMap getDctors (flattenDecls decls)
84 getDctors (DataDeclaration _ _ _ ctors) = map fst ctors
84 getDctors (DataDeclaration _ _ _ ctors) = map fst ctors
85 getDctors (PositionedDeclaration _ d) = getDctors d
85 getDctors (PositionedDeclaration _ d) = getDctors d
86 getDctors _ = []
86 getDctors _ = []
@@ -267,6 +267,14 @@ isTypeClassDeclaration TypeInstanceDeclaration{} = True
267isTypeClassDeclaration (PositionedDeclaration _ d) = isTypeClassDeclaration d
267isTypeClassDeclaration (PositionedDeclaration _ d) = isTypeClassDeclaration d
268isTypeClassDeclaration _ = False
268isTypeClassDeclaration _ = False
271+-- Recursively flatten data binding groups in the list of declarations
272+flattenDecls :: [Declaration] -> [Declaration]
273+flattenDecls = concatMap flattenOne
274+ where flattenOne :: Declaration -> [Declaration]
275+ flattenOne (DataBindingGroupDeclaration decls) = concatMap flattenOne decls
271-- A guard is just a boolean-valued expression that appears alongside a set of binders
279-- A guard is just a boolean-valued expression that appears alongside a set of binders