Neil Mitchell [EMAIL PROTECTED] wrote:
Right. In effect, as a matter of fact, the notation
x - a
would become equivalent to
let x = (- a)
Hmm, interesting. Consider:
let x = 12
let x = (- x)
Okay, so the desugaring process wouldn't terminate in that case! One
could
david48 [EMAIL PROTECTED] wrote:
On 8/3/07, Neil Mitchell [EMAIL PROTECTED] wrote:
Hmm, interesting. Consider:
let x = 12
let x = (- x)
Wouldn't that be forbidden ?
I'd expect the x in ( - x ) have to be of type m a.
Yes, unless of course you did:
instance (Monad m, Num n)
On 8/3/07, Chris Smith [EMAIL PROTECTED] wrote:
Neil Mitchell [EMAIL PROTECTED] wrote:
I'm not convinced either, a nice concrete example would let people
ponder this a bit more.
I tried to provide something in my response to Simon. Here it is again:
One could sugar:
do tax -
Hi
let x = 12
let x = (- x)
Okay, so the desugaring process wouldn't terminate in that case! One
could either: (a) try to retain the equivalence in theory, but make it
illegal to use x in a monadic subexpression when defining x; (b) we
could abandon my claim that they are equivalent.
Hi
if you write :
let x = (-a):x
is it possible that is desugars into :
temp -a
let x = temp:x
that would'nt work ?
That would work, since 'a' doesn't refer to 'x'. I can't think of a
real example where it becomes an issue, but the scope within 'a' has
changed.
Also :
do case x of
On 8/3/07, Neil Mitchell [EMAIL PROTECTED] wrote:
temp - a
let x = temp
if you write :
let x = (-a):x
is it possible that is desugars into :
temp -a
let x = temp:x
that would'nt work ?
I realize I may be asking dumb questions but being dumb never harmed
anyone so :)
Also :
do case x of
Hi
do case x of
[] - return 1
(y:ys) - g y = \temp - f temp
See the rule about always binding to the previous line of a do block.
This case then violates that.
I assumed that the example was equivalent to :
do case x of
[] - return 1
(y:ys)
On 8/3/07, Chris Smith [EMAIL PROTECTED] wrote:
Yes, unless of course you did:
instance (Monad m, Num n) = Num (m n)
or some such nonsense. :)
I decided to take this as a dare - at first I thought it would be easy
to declare (Monad m, Num n) = m n to be an instance of Num (just lift
or
Antoine Latter wrote:
On 8/3/07, Chris Smith [EMAIL PROTECTED] wrote:
Yes, unless of course you did:
instance (Monad m, Num n) = Num (m n)
or some such nonsense. :)
I decided to take this as a dare - at first I thought it would be easy
to declare (Monad m, Num n) = m n to be an