Simon L Peyton Jones wrote:
> What worries me is that a programmer might write this:
>
> read2 :: (Read a, Read b) => String -> (a,b)
> read2 2 = let [(r1,s1)] = read s
> [(r2,s2)] = read s1
> in
> (r1,r2)
The examples of John Peterson and Simon Peyton Jones demonstrate the usefulness
of the MR for non-simple pattern bindings, but not for *simple* pattern
bindings, i.e. where the pattern is a single variable. In my opinion the case of
simple pattern bindings is just the one where most programmers have problems
with the MR, because everybody considers
let f x = ... in ...
and
let f = \x -> ... in ...
as equivalent.
Hence I suggest that part (b) of rule 1 of the MR should be deleted, i.e. simple
pattern bindings are just treated as function bindings. As I have said in a
previous email, the recomputation issue could be handled by warnings from the
compiler.
Olaf
PS: For me the description of the MR in the report was quite difficult to
understand. The two reasons for the MR should stand out clearly and not be
separated by a paragraph on the fact that non-simple pattern bindings are always
monomorphic.
Simon's example should become part of the report.
--
OLAF CHITIL, Lehrstuhl fuer Informatik II, RWTH Aachen, 52056 Aachen, Germany
Tel: (+49/0)241/80-21212; Fax: (+49/0)241/8888-217
URL: http://www-i2.informatik.rwth-aachen.de/~chitil/