Closed maxsnew closed 9 years ago
The main reason I'd avoided diving into the laws expressing their relationship was for fear of stepping into a 'Alternative'/'MonadPlus' law hell where the actual laws are actually quite messy. They appear to really be multiple classes in disguise. Not sure how much Divisible/Decidable run into the same issue.
I'm happy to leave this thread open to hash these out, but I'm loathe to just click 'merge' here without thought.
Hm, any link to a good overview of the Alternative/MonadPlus stuff? Is the issue with those just that there have to be laws wrt how <|>
interacts with >>=
and such, in which case we don't have that problem here?
I just translated the right-seminearring laws to carry the extra functions around. I guess you're saying that not even that is agreed upon? I took the line in the current docs to mean that no one had bothered to do it yet, not that it was uncertain what the laws really were.
The right seminearring laws already don't hold for Alternative. It is dangerous to assume they'd hold universally for a contravariant version
Skim http://www.reddit.com/r/haskell/comments/2tfgol/alternatives_convert_products_to_sums/cnynnyt for a brief-ish summary of the kinds of issues that arise.
I merged the doc-fix parts. I'm going to close this out though, as we don't actually have a known-good distributive law in the presence of users using things like Alternative
to make it go.
An attempt to express the absorption and distributive laws. The
f'
definition is really ugly, but I think the laws are right.Absorption wasn't mentioned in the documentation before. Is it redundant? I know it is for rings, but I think you need additive inverses to prove it.