@@ -25,9 +25,9 @@ exportedNames decl =
2525 ++ map exportType (names tnamesD td)
2626 DPrimType t -> [ exportType (thing . primTName <$> t) ]
2727 TDNewtype nt -> map exportType (names tnamesNT nt) ++
28- map exportBind (names namesNT nt)
28+ map exportCon (names namesNT nt)
2929 TDEnum en -> map exportType (names tnamesEnum en)
30- ++ map exportBind (names namesEnum en)
30+ ++ map exportCon (names namesEnum en)
3131 Include {} -> []
3232 DImport {} -> []
3333 DParamDecl {} -> []
@@ -70,6 +70,10 @@ exported ns (ExportSpec mp) = Map.findWithDefault Set.empty ns mp
7070exportBind :: Ord name => TopLevel name -> ExportSpec name
7171exportBind = exportName NSValue
7272
73+ -- | Add a constructor name to the export list, if it should be exported.
74+ exportCon :: Ord name => TopLevel name -> ExportSpec name
75+ exportCon = exportName NSConstructor
76+
7377-- | Add a type synonym name to the export list, if it should be exported.
7478exportType :: Ord name => TopLevel name -> ExportSpec name
7579exportType = exportName NSType
@@ -84,7 +88,7 @@ isExported ns x (ExportSpec s) =
8488
8589-- | Check to see if a binding is exported.
8690isExportedBind :: Ord name => name -> ExportSpec name -> Bool
87- isExportedBind = isExported NSValue
91+ isExportedBind x s = isExported NSValue x s || isExported NSConstructor x s
8892
8993-- | Check to see if a type synonym is exported.
9094isExportedType :: Ord name => name -> ExportSpec name -> Bool
0 commit comments