2 What gets done when printing an interface
3 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
5 Basically, we do three things:
7 A) Create the import decls. For classes and values, this is easy. We
8 filter the CE and GVE for all exported objects that were not declared
9 in the module. For types, this is a pain because we may have something
10 which is exported and which refers to a type that isn't. For example,
15 may export B, but A may be expected to come from somewhere else when
16 C is imported. So, we have to go through all envs which have ranges that
17 may refer to a type. This means the TCE, CE (the class op types),
18 GIE_inst (instance types) and GVE (types in the sigs). AND we have to
19 filter out prelude defined types from the resulting list.
21 Finally, we print the import decls, using the conventions that the renamer
22 expects (no explicit constructors/ class ops, etc.)
24 B) Print the fixity decls for whatever constructors/ functions are exported
26 C) Print the rest of the decls needed.
27 1) Type decls - contents of TCE with export flags
28 2) Class decls - contents of CE with export flags
29 3) Instance decls - contents of GIE_inst that refer to either
30 an exported type or an exported class
32 4) Value decls - contents of GVE which are not constructors and
33 which have an export flag
38 Type synonyms - to expand or not? Let's not, and complain if a type sig. is
41 Canonical form for interfaces - to get rid of perl post-processing!
43 Deriving for an abstract data type - shall we worry about this now or later?
48 It's convenient to make all ranges of environments know how to print themselves
49 (they do now) and decide whether to do so by looking at the export flag
50 in their Name fields. Presumably the constructors of a data type that is
51 exported abstractly will decide not to print themselves, so no special code