Reputation: 195
I am collecting examples of join semilattices amongst Semigroup
instances. As you may know join semilattice is similar to semigroup but requires additionally commutativity and idempotence. From the quick scan of the libraries on hackage I found the following examples:
Data.Semigroup.Max
Data.Semigroup.All
Data.Semigroup.Any
Data.Map.Append.AppendMap
I'm curious whether you came across any other (interesting and useful) join semilattices examples in Haskell libraries?
Upvotes: 2
Views: 178
Reputation: 71065
Ordered strictly increasing lists of wholly compared elements (where equality implies sameness) seem to form join semilattice under Data.List.Ordered.union
from data-ordlist
package.
Upvotes: 1
Reputation: 48582
Data.IntSet.IntSet
has the set union operation as its <>
, which seems to meet your criteria. This may be true for other sets too, as long as you're okay with pathological Eq
instances for their elements breaking it.
This is also true for Proxy
, but that's about as far from useful as you can get.
Upvotes: 0