Re:Exotic List Monads
by tel on Thursday January 07, 2021 @11:16PM
(#25681452)
The trivial implementation isn't law abiding. This law doesn't hold (written in Kleisli form for simplicity)
There are no other monads for Maybe. First, any definition of pure must be Just as Nothing doesn't work because of left identity and parametricity prevents any other funny business. Now, by law we know
Thus, we must define
So the only variable is what (Nothing >>= f) does. For (f: A -> B) we must end up with a Maybe B. We don't have one to start and we can produce Maybe values only via Nothing and Just. So, either >>= is the standard definition or we have to do
Thus, we must define
[ Parent
| on HN ]