Commit fa16f707 authored by Jan Rasmus Tikovsky 's avatar Jan Rasmus Tikovsky
Browse files

Now the comment regarding the export expansion of records matches the...

Now the comment regarding the export expansion of records matches the behaviour implemented in the frontend
parent fe83ac4d
...@@ -233,17 +233,15 @@ exportType t = ExportTypeWith tc xs ...@@ -233,17 +233,15 @@ exportType t = ExportTypeWith tc xs
where tc = origName t where tc = origName t
xs = elements t xs = elements t
-- For compatibility with Haskell, we allow exporting field labels but -- In contrast to Haskell, the export of field labels and record constructors
-- not constructors individually as well as together with their types. -- without their types is NOT allowed.
-- Thus, given the declaration @data T a = C { l :: a }@ -- Thus, given the declaration @data T a = C { l :: a }@
-- the export lists @(T(C,l))@ and @(T(C),l)@ are equivalent and both -- the label @l@ and the constructor @C@ can only be exported together with the
-- export the constructor @C@ and the field label @l@ together with the -- type @T@, i.e., @(T(C,l))@.
-- type @T@. However, it is also possible to export the label @l@ -- Since record update operations are desugared to case expressions matching the
-- without exporting its type @T@. In this case, the label is exported -- corresponding constructors of the record, the export of a label without its
-- just like a top-level function (namely the implicit record selection -- type could result in a type error, when it is used for an update operation in
-- function corresponding to the label). In order to avoid ambiguities -- another module.
-- in the interface, we convert an individual export of a label @l@ into
-- the form @T(l)@ whenever its type @T@ occurs in the export list as well.
canonExports :: TCEnv -> [Export] -> [Export] canonExports :: TCEnv -> [Export] -> [Export]
canonExports tcEnv es = map (canonExport (canonLabels tcEnv es)) es canonExports tcEnv es = map (canonExport (canonLabels tcEnv es)) es
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment