[Haskell-cafe] About do notation.
Brandon S. Allbery KF8NH
allbery at ece.cmu.edu
Tue Oct 14 23:58:17 EDT 2008
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] allbery at kf8nh.com
system administrator [openafs,heimdal,too many hats] allbery at ece.cmu.edu
electrical and computer engineering, carnegie mellon university KF8NH
More information about the Haskell-Cafe
mailing list