#haskell - Mon 19 Feb 2007 between 06:11 and 06:26

xpikamux: No instance for (MonadState s ((->) (IO ())))
pjdosfameron: SoE? great stuff :)
int-expika: runStateT (modify (+1) >> (liftIO $ putStrLn "incremented")) 3 >>= print
osfameronpjd: yeah
xpikarunStateT (modify (+1) >> (liftIO $ putStrLn "incremented")) 3 -- yep extra brackets needed
i really need to understand the diff between () and $
lemmih@type ($)
lambdabotforall a b. (a -> b) -> a -> b
lemmih@type ()
xpikarunStateT (modify (+1) >> liftIO ( putStrLn "incremented") 3
pjdfoo (bar ...) <=> foo $ bar ...
sort of
int-expika: the problem is that (modify (+1) >> liftIO $ putStrLn "incremented") gets parsed as ((modify (+1) >> liftIO) $ putStrLn "incremented")
xpika: because >> binds stronger than $.
pjdeverything binds more strongly than $, innit?
xpikaint-e: and () binds the strongest?
osfameronpjd, anyone else who has a second: http://osfameron.vox.com/library/post/chapter-1-of-hudaks-haskell-school-of-expression.html (I know that this is rather a dull entry, but my question is... do you think this is reasonable in terms of "Fair use" quoting? I think it's respectful, and I'm promoting the book, but please let me know if you think I'm exaggerating)
xpikaok, now all i have to do is remember the precendence levels
int-expika: for (...), binding is irrelevant - ( groups until the matching closing ).
quicksilverbest thing is to use () when unsure
$ is an overused hack for reducing the number of (), that's all
I use it too much myself :) but if you're feeling doubtful, bracket by hand
pjdosfameron: about the ghci thing, you have to prefix definitions with "let"
as in: let simple x y z = x * (y + z)
int-equicksilver: do you lean towards a . b $ c, a $ b c or a $ b $ c?
pjdthe reason for this is that ghci is in an implicit do block
xpikaits funny because thats maths aswell
quicksilvera . b $ c
or (a . b) c
xpikabracket when unsure
pjdso it's not exactly like top-level haskell
osfameronpjd: Ah! I even remember working that out at one point. Thanks! I'll update it
sitiI love $ :D
pjdhmm, the ghci let thing needs to be in some FAQ
xpikawhats the default precedence of an infix function?
fuzananyone play with bncf much?
left is generally preferred.

Page: 3 10 17 24 31 38 45 52 59 66 73 80 87