The dreaded M-R

lennart at augustsson.net lennart at augustsson.net
Mon Jan 30 10:11:54 EST 2006


Quoting Malcolm Wallace <Malcolm.Wallace at cs.york.ac.uk>:

> lennart at augustsson.net writes:
>
>> Nhc didn't use to implement the M-R (maybe it does now).  When
>> porting code to nhc this caused a few code changes.  Perhaps
>> 10 lines out of 10000 when I tried the Bluespec compiler.  So
>> my gut feeling is that the M-R is a rare beast in practise.
>
> I can confirm that nhc98 (and hence yhc) still does not implement
> the M-R.  I haven't noticed any particular performance problems in
> code compiled by nhc98 that were down to a consequent loss of sharing.
> (But I can't claim to have explicitly looked.)  But as Lennart says,
> you do get occasional type errors which mean you need to restructure
> your code.  Almost always, these are local bindings, e.g.:
>
>    Context required in LHS pattern
>
> is an error emitted for code like:
>
>    do (x,y) <- something complicated and numeric
>       ...
>
> and the fix is
>
>    do xy <- something complicated and numeric
>       let x = fst xy
>           y = snd xy
>       ...
>
> As I recall, there were about 4-5 of these I needed to fix in the
> entire nofib suite.

The changes I had to make were almost all simpler than that.
I just had to add a few type signatures.

(And thanks for supporting evidence from nhc. :)

    -- Lennart





More information about the Haskell-prime mailing list