Skip to content

Commit 221bf4a

Browse files
committed
Fix exports to account for constructors
1 parent a5404e6 commit 221bf4a

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

src/Cryptol/ModuleSystem/Exports.hs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -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
7070
exportBind :: Ord name => TopLevel name -> ExportSpec name
7171
exportBind = 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.
7478
exportType :: Ord name => TopLevel name -> ExportSpec name
7579
exportType = exportName NSType
@@ -84,7 +88,7 @@ isExported ns x (ExportSpec s) =
8488

8589
-- | Check to see if a binding is exported.
8690
isExportedBind :: 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.
9094
isExportedType :: Ord name => name -> ExportSpec name -> Bool

0 commit comments

Comments
 (0)