[Haskell-beginners] let (x',seed') = x seed
Amy de Buitléir
amy at nualeargais.ie
Thu Apr 29 11:45:02 EDT 2010
I'm confused by the syntax this function definition I found in a tutorial:
bind :: (a → StdGen → (b,StdGen)) → (StdGen → (a,StdGen)) → (StdGen →
(b,StdGen))
bind f x seed = let (x',seed') = x seed in f x' seed'
The part that confuses me is "let (x',seed') = x seed". The left side
is a tuple, and the right side is two separate values, so how does the
binding work? I gather from the context of the example (a tutorial on
monads) that the value of x is bound to x', and the value of seed is
bound to seed', so that "bind f" is a function that acts on a tuple
and produces a new tuple. Is that correct?
Thank you in advance to anyone who can de-confuse me.
More information about the Beginners
mailing list