[plt-scheme] Why do layman programmers care about Currying?

From: John Clements (clements at brinckerhoff.org)
Date: Tue Jan 6 18:18:29 EST 2009

Snipping everything that I agree with:

On Jan 6, 2009, at 2:03 PM, Joe Marshall wrote:

> On Sat, Jan 3, 2009 at 9:30 PM, John Clements <clements at brinckerhoff.org 
> > wrote:
>> I think you've misunderstood monads: see my comments below.
>
> I don't *think* so, but I did gloss over some stuff.

Okay, fair enough.

>
>> There *is* one way in which Haskell's 'do' is much nicer than this  
>> one:
>> Haskell's type system makes it possible to define a 'do' that works  
>> for a
>> whole bunch of different monads, and isn't chained to just one. In  
>> Scheme,
>> if you want to use 'do' for different monads, you'll probably have  
>> to enrich
>> uses of 'do' to indicate which monad's 'bind' to expand into.
>
> I think this is a seductively bad idea.  Yeah, it's nice that the type
> system figures
> out what to dispatch to, but dispatching on the return type is  
> heinous.  (It
> introduces context sensitivity.)

If I understand you correctly, this is a problem with inferred types  
being heinous, right?  If you explicitly specify the return type of  
any function whose type is monadic, then the context sensitivity goes  
away. If I understand you correctly.

> ...
> and the nastiness of continuation-passing-style in fully typed  
> languages.

Hang on.  We've got "statically typed" and "strongly typed," and  
you're adding "fully typed" to the pile? Urg...

>
> Incidentally, I observed someone writing code with the state monad the
> other day.
> He didn't actually need to model state, he just wanted to program in
> `imperative style'
> (smash this `register', assign this to that, for i from 1 to 10, etc.)
> and the monad was there
> just to let him use the `do' syntax.  Yuck!

Yes, that's gross.  On the other hand, I find that when writing Scheme  
these days, using mutation gives me the willies; it seems less error- 
prone to use a state monad, where I don't have to worry about other  
bits of the computation coming in and messing up the state.  I *think*  
this logic is bogus, but that's how it feels.

John

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 2484 bytes
Desc: not available
URL: <http://lists.racket-lang.org/users/archive/attachments/20090106/9401c1b5/attachment.p7s>

Posted on the users mailing list.