darcs patch: implement prefix unboxed tuples syntax (#1509)
Simon Peyton-Jones
simonpj at microsoft.com
Fri Jan 4 06:30:50 EST 2008
| > You'll probably end up with a link error, because there is no curried function (#,#). With a regular data
| type, we inject the (rather odd-looking) function
| > (,) = \a \b. (a,b)
| > and similarly for all data type declarations, just so that there is a current (,) function defined.
|
| looks like a good point. Although many examples such as yours fail to be
| kind-correct.
Ah yes, it would indeed be difficult to compile a single curried function for (#,#), because it can take unboxed arguments of any width.
Ah... I've discovered that unboxed tuples are eta-expanded by CorePrep, like primops, because they have no binding. Here's the relevant function from Id.lhs, which is used in corePrep.
Hmm. I wonder if this means we don't need PrimopWrappers? Or, equivalently, it means that we can return False for PrimOpId in hasNoBinding?
Simon
-- hasNoBinding returns True of an Id which may not have a
-- binding, even though it is defined in this module.
-- Data constructor workers used to be things of this kind, but
-- they aren't any more. Instead, we inject a binding for
-- them at the CorePrep stage.
-- EXCEPT: unboxed tuples, which definitely have no binding
hasNoBinding id = case globalIdDetails id of
PrimOpId _ -> True
FCallId _ -> True
DataConWorkId dc -> isUnboxedTupleCon dc
other -> False
More information about the Cvs-ghc
mailing list