Desugaring overloaded functions

Simon Peyton-Jones simonpj at microsoft.com
Wed Nov 8 12:21:59 EST 2006


| This is almost exactly what I want. There is one thing I don't understand
| though. Namely the __letrec defining:
|
| incL_akO = incL_akH
| incL_akH = ... incL_ak0 ...
|
| Why this indirection? Is this also because the desugarer tries to do the most
| simple thing?

Yes, that's why.

| And is there a preprocess function that translates this into:
|
| incL_akH = ... incL_akH ... ?

Sure!  Just run the simplifier.  It has plenty of knobs to tell it how hard to try.

In particular,  simplifyPgm has this type
simplifyPgm :: SimplifierMode
            -> [SimplifierSwitch]
            -> HscEnv
            -> UniqSupply
            -> RuleBase
            -> ModGuts
            -> IO (SimplCount, ModGuts)  -- New bindings

Setting the SimplifierMode to SimplGently makes the simplifier just do the bare minimum.  It's probably what you want.

Simon


More information about the Glasgow-haskell-users mailing list