| xpika | mux: No instance for (MonadState s ((->) (IO ()))) |
| pjd | osfameron: SoE? great stuff :) |
| int-e | xpika: runStateT (modify (+1) >> (liftIO $ putStrLn "incremented")) 3 >>= print |
| osfameron | pjd: yeah |
| xpika | runStateT (modify (+1) >> (liftIO $ putStrLn "incremented")) 3 -- yep extra brackets needed i really need to understand the diff between () and $ |
| lemmih | @type ($) |
| lambdabot | forall a b. (a -> b) -> a -> b |
| lemmih | @type () |
| lambdabot | () |
| xpika | runStateT (modify (+1) >> liftIO ( putStrLn "incremented") 3 |
| pjd | foo (bar ...) <=> foo $ bar ... sort of |
| int-e | xpika: the problem is that (modify (+1) >> liftIO $ putStrLn "incremented") gets parsed as ((modify (+1) >> liftIO) $ putStrLn "incremented") xpika: because >> binds stronger than $. |
| pjd | everything binds more strongly than $, innit? |
| xpika | int-e: and () binds the strongest? |
| osfameron | pjd, 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) |
| lambdabot | http://tinyurl.com/2flw6s |
| xpika | ok, now all i have to do is remember the precendence levels |
| int-e | xpika: for (...), binding is irrelevant - ( groups until the matching closing ). |
| quicksilver | best 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 |
| pjd | osfameron: about the ghci thing, you have to prefix definitions with "let" as in: let simple x y z = x * (y + z) |
| int-e | quicksilver: do you lean towards a . b $ c, a $ b c or a $ b $ c? |
| pjd | the reason for this is that ghci is in an implicit do block |
| xpika | its funny because thats maths aswell |
| quicksilver | a . b $ c or (a . b) c |
| xpika | bracket when unsure |
| pjd | so it's not exactly like top-level haskell |
| osfameron | pjd: Ah! I even remember working that out at one point. Thanks! I'll update it |
| siti | I love $ :D |
| pjd | hmm, the ghci let thing needs to be in some FAQ |
| vincenz | meurning |
| xpika | whats the default precedence of an infix function? |
| fuzan | anyone play with bncf much? left is generally preferred. |