On 2008 Oct 14, at 23:55, Magicloud wrote:
As some articles say, do notation is expand to (>>) and (>>=) when being compiled.
  So I want to know the details. Like:
main = do
a <- getArgs
b <- getLine
myFunc1 (head a) b
myFunc2 b (head a)

  I cannot figure out what is the (>>) and (>>=) way of this.


If you are on FreeNode IRC, you can ask lambdabot to @undo such expressions (would need to use braces and semicolons instead of layout though).

main = getArgs >>=
       \a -> getLine >>=
       \b -> myFunc1 (head a) b >>
       myFunc2 b (head a)

--
brandon s. allbery [solaris,freebsd,perl,pugs,haskell] [EMAIL PROTECTED]
system administrator [openafs,heimdal,too many hats] [EMAIL PROTECTED]
electrical and computer engineering, carnegie mellon university    KF8NH


_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to