
On 04/08/2011 21:02, Simon Peyton-Jones wrote:
| data LiteralDesugaring m = | LiteralDesugaring | { desugarInt :: MonadThings m => Integer -> m CoreExpr | , desugarWord :: MonadThings m => Integer -> m CoreExpr ...
I am not sure why you want to control the desugaring of literals. Why literals? And why is literals enough?
| But I don't still understand what can I do with foreign | imports/exports. DsForeign module seems to be too complicated. As I | can see, I shouldn't make whole dsForeigns function replaceable, but I | can't understand what part of it should be replaceble.
I still think that the stub generation for foreign declarations should be easily separable. The desugarer generates a certainly amount of unwrapping, but you'll want that for JavaScript too. The actual calling convention is embedded inside the Id: see the FCallId constructor of IdDetails in IdInfo.lhs, and the ForeignCall type in ForiegnCall.lhs.
There's a lot that's backend-specific about the way we desugar foreign import "wrapper" - calls to createAdjustor passing magic strings and suchlike. It would be nice to identify the stuff that is backend-specific and separate it out, I think. Cheers, Simon