3 ms·
The notation x <- f y means "f y returns a monadic value; take the next line (which is a monadic function) and apply it to x." Naively, you can think of x <- f
by yummyfajitas 19y ago
The notation x <- f y means "f y returns a monadic value; take the next line (which is a monadic function) and apply it to x."
Naively, you can think of x <- f y as pulling the value out of the monad. Now you can apply non-monadic functions to it. In a certain sense, this is true. However, by the time the do statement is finished, you will need to push it back in (the return statement). So you can only pull stuff out of the monad if you immediately put it back in (otherwise you get a type error).
(card, rem) is simply unpacking a 2-tuple, containing the card and the remaining deck (after picking 1 element).
The "let straight = ... in \newline (some statement)" means exactly what it sounds like. "let x = 3 in xx" means "take the statement xx, replace x by 3, you get 3*3=9".