(no subject)

Date: 2019-05-07 02:13 am (UTC)
jducoeur: (Default)
From: [personal profile] jducoeur
Actually, that one's fairly easy: you want a Monad when it makes sense to nest things like this. Indeed, my traditional handwave explanation is that, if you find yourself wanting a for comprehension like the above, and can describe exactly how it would work, you're about 3/4 of the way to being able to write the Monad in question. (That's how I learned it in the first place.)

More precisely, Monads are a formalism for a *sequential* type, where you need to deal with the first value, which gives you enough to compute the second, which gives you enough to compute the third. That's as opposed to Applicatives, which describe a *parallel* type, where you can compute two values separately and then combine their results together.

But I don't really plan on talking about that a lot here: mostly, that sort of stuff goes into my professional blog instead, and that's mostly focused on Dotty at the moment. I only did the Monad tutorial here because Monica asked, and I'm pretty practiced at teaching the subject by now. (This is actually a *highly* compressed version of a training module that I wrote for corporate use...)
(will be screened)
(will be screened if not validated)
If you don't have an account you can create one now.
HTML doesn't work in the subject.
More info about formatting

Profile

jducoeur: (Default)
jducoeur

July 2025

S M T W T F S
  12345
6789101112
13141516171819
20212223242526
27 28293031  

Most Popular Tags

Style Credit

Expand Cut Tags

No cut tags