[Haskell-beginners] Monad for Pair
ky3 at atamo.com
Wed Nov 18 07:44:56 UTC 2015
On Wed, Nov 18, 2015 at 5:15 AM, Marcin Mrotek <marcin.jan.mrotek at gmail.com>
The first law could work if >>= just chose one of the values
> arbitrarily. But the second law is a hopeless case. You would need to
> pick one element of a pair, plug it into a function that repeats the
> argument, and somehow get back the other element that you've already
> Concluding, either I'm sorely mistaken or there indeed isn't a Monad
> instance for Pair.
Not quite sorely mistaken but there is a glitch in the logic of what you
wrote when you returned from join to bind.
You might want to try writing out a test instance in full and re-checking
the second law.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Beginners