Replacing Ty in ExternalCore with IfaceType

Aaron Tomb atomb at soe.ucsc.edu
Mon Dec 4 01:59:19 EST 2006


Hi All,

I've had a bit of time to work on External Core again, and I've come  
across a potential simplification. I'd like to hear what the more  
seasoned developers think of it.

The current situation is that ExternalCore.lhs defines datatypes for  
both expressions and types (Exp and Ty, respectively), and the  
External Core parser uses IfaceType to represent type declarations,  
and IfaceBndr to represent term declarations.

A while back, Simon PJ suggested extending HsBind with an alternative  
for External Core bindings, and using that instead of IfaceBndr for  
term declarations. Unfortunately, the parser sometimes needs to parse  
types that appear as components of terms (such as abstractions, and  
case expressions), and sometimes needs to parse them as part of type  
declarations. Thus, the parser either needs separate productions for  
parsing types that appear in terms and in type declarations, or code  
to convert between IfaceType and Ty.

One way to simplify this situation would be to remove the Ty data  
type altogether, and use IfaceType in ExternalCore. Code already  
exists to parse External Core into an IfaceType representation, and  
pretty-printing IfaceTypes shouldn't be any harder than pretty- 
printing Tys. However, doing this would require ExternalCore, which  
currently imports nothing at all, to import IfaceType. IfaceType, in  
turn, imports a number of other modules. So ExternalCore would no  
longer be so appealingly self-contained.

Does anyone have a preference? Should I scrap Ty in favor of  
IfaceType, or should I make the External Core parser slightly more  
complex?

Aaron



More information about the Cvs-ghc mailing list