[Haskell-cafe] Very simple parser

Gregory Propf gregorypropf at yahoo.com
Mon Jul 2 21:42:52 EDT 2007

OK, I get the reference to currying now.  A function of 2 variables can be seen as a function of one that returns another function of one.  So a function of one variable can be seen as a function of no variables that returns a function of one.  Very nice.

----- Original Message ----
From: Tim Chevalier <catamorphism at gmail.com>
To: Gregory Propf <gregorypropf at yahoo.com>
Cc: haskell-cafe at haskell.org
Sent: Monday, July 2, 2007 5:37:41 PM
Subject: Re: [Haskell-cafe] Very simple parser

On 7/2/07, Gregory Propf <gregorypropf at yahoo.com> wrote:
> This was a bit baffling too.  It appears that there's an implied argument to runTick.  This also works and makes it more explicit.  I suppose the compiler just works out that the only place to put the 'n' is after tick.
> runTick :: Int -> (String,Int)
> runTick n = runState tick n

Not exactly. Look up "currying". (Writing out the same definition with
the argument "n" specified explicitly like you did is called
"eta-expansion", by the way.)


Tim Chevalier* catamorphism.org *Often in error, never in doubt
"My writing is all completely autobiographical. That's why I write
lesbian vampire stories." -- Jewelle Gomez

Got a little couch potato? 
Check out fun summer activities for kids.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/haskell-cafe/attachments/20070702/951e32b9/attachment.htm

More information about the Haskell-Cafe mailing list