Monoid over XOR or XNOR, and Monoid lifted by Applicative.

Edward Kmett ekmett at gmail.com
Sat May 5 21:51:06 UTC 2018


There are several packagings of lattices and semilattices strewn across hackage, and not much convergence on any single one.

Sent from my iPhone

> On May 5, 2018, at 4:54 PM, Matthew Farkas-Dyck <m.farkasdyck at gmail.com> wrote:
> 
>> On 5/5/18, Edward Kmett <ekmett at gmail.com> wrote:
>> In that same light, we're also missing packaged monoids for the bitwise
>> (.|.), (.&.), xor (and the non-existent xnor) from Data.Bits.
> 
> I defined a `BitSet` type in my alg package:
> http://hackage.haskell.org/package/alg
> (Building docs failed, so here is the definition: `newtype BitSet a =
> BitSet { bits :: a }`)
> 
> The `Monoid` instance is (`False`, `xor`) (wasn't thinking about xnor,
> stupid me).
> 
> I was also trying to define `Monoid` instances for `Min (BitSet a)`
> and `Max (BitSet a)` but alas, they overlap, tho `BitSet` is not `Ord`
> (so usual instances are useless).
> 
> Maybe we want a `Lattice` class?


More information about the Libraries mailing list