RE: The monomorphism restriction and monomorphic pattern bindings

2008-05-01 Thread Simon Peyton-Jones
| Ok. So I counter-propose that we deal with pattern bindings like this: | |The static semantics of a pattern binding are given by the following |translation. A binding 'p = e' has the same meaning as the set of |bindings | | z = e | x1 = case z of { p - x1 } | ... |

Re: The monomorphism restriction and monomorphic pattern bindings

2008-04-30 Thread Ian Lynagh
On Wed, Apr 30, 2008 at 12:18:47PM +0100, Ross Paterson wrote: On Wed, Apr 23, 2008 at 10:32:24AM -0700, Simon Marlow wrote: The current proposal on the table for what to do about the monomorphism restriction (henceforth MR) is * remove the MR entirely Just to be clear, are we

Re: The monomorphism restriction and monomorphic pattern bindings

2008-04-28 Thread Iavor Diatchki
Hi, On Mon, Apr 28, 2008 at 9:42 AM, Simon Marlow [EMAIL PROTECTED] wrote: Ok. So I counter-propose that we deal with pattern bindings like this: The static semantics of a pattern binding are given by the following translation. A binding 'p = e' has the same meaning as the set of

Re: The monomorphism restriction and monomorphic pattern bindings

2008-04-28 Thread Ian Lynagh
On Mon, Apr 28, 2008 at 09:42:10AM -0700, Simon Marlow wrote: Ok. So I counter-propose that we deal with pattern bindings like this: The static semantics of a pattern binding are given by the following translation. A binding 'p = e' has the same meaning as the set of bindings

RE: The monomorphism restriction and monomorphic pattern bindings

2008-04-25 Thread Simon Peyton-Jones
| The report doesn't actually mention this translation although it is | widely used to implement pattern bindings, and in some compilers (not | GHC) the translation is done before type checking. | | What's interesting to me is that perhaps this gives us a way to | understand what the static

Re: The monomorphism restriction and monomorphic pattern bindings

2008-04-25 Thread Neil Mitchell
Hi Simon, Those additional reasons given are much more compelling, and should definately go on the wiki. I think the essential point is that it makes reasoning about the code simpler - regardless of the effect on implementation. My main remaining reservation is that: (x) /= x [EMAIL PROTECTED]

RE: The monomorphism restriction and monomorphic pattern bindings

2008-04-24 Thread Simon Peyton-Jones
| Iavor: | the change is valid. I do believe that you can probably work around | the problem in many situations but the question in my mind is why | should we have to work around stuff when we have a system that already | works? In other words, what problem do MBPs solve? ... | Neil: | Haskell

Re: The monomorphism restriction and monomorphic pattern bindings

2008-04-24 Thread Simon Marlow
Iavor Diatchki wrote: I should also point out that if we were to adopt the MBP rule, we would have to adjust the definition of what pattern bindings mean. For example, I think that this is how things are desugared at the moment: (x,y) = e becomes new_var = e x = case new_var of (v,_) - v y =

Re: The monomorphism restriction and monomorphic pattern bindings

2008-04-23 Thread Iavor Diatchki
Hello, Removing the MR seems reasonable. I am a little less certain about the MPB rule though. I suspect that, as the wiki page points out, many uses of pattern bindings are monomorphic but still, there seem to be a number of examples on the wiki where people have run into this problem. So I am

Re: The monomorphism restriction and monomorphic pattern bindings

2008-04-23 Thread Neil Mitchell
Hi * remove the MR entirely Finally! * adopt Monomorphic Pattern Bindings (MPB) There are 6 reasons on that page why we shouldn't adopt MPB - of those number 5 I think is particularly compelling. There seems to be 1 main reason to remove it, which is that it has a complex translation to