Re:Monads in JavaScript
by tel on Tuesday July 21, 2015 @09:24AM
(#9922034)
"Monad" is more like an adjective. "Option" is a monad, but, interestingly, the union type (A | null) is not.
[ Parent
| on HN ]
As I understand it, this is because nullability (typically?) doesn't nest and so can't be a functor (with the whole of the types of the language as domain). If you can't wind up with m (m a), then there is no place for join.
Yeah, exactly. The other way to see it is to note that `Nothing(null)` is a perfectly reasonable Javascript expression which ought to mean something different from `null` alone. If that cannot be true then you don't actually have parametricity.