
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
----- Original Message ----
From: Arie Peterson
tick :: State Int String tick = do n <- get put (n+1) return (show n)
If you want to actually run 'tick', use the 'runState' function:
runTick :: Int -> (String,Int) runTick = runState tick
____________________________________________________________________________________ Sucker-punch spam with award-winning protection. Try the free Yahoo! Mail Beta. http://advision.webevents.yahoo.com/mailbeta/features_spam.html

On 7/2/07, Gregory Propf
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.) Cheers, Tim -- 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
participants (2)
-
Gregory Propf
-
Tim Chevalier