haskellari / lattices

Fine-grained lattice primitives for Haskell
BSD 3-Clause "New" or "Revised" License
35 stars 15 forks source link

Added Maybe instances #73

Closed coot closed 5 years ago

coot commented 5 years ago
phadej commented 5 years ago

This is essentially http://hackage.haskell.org/package/lattices-1.7.1.1/docs/Algebra-Lattice-Lifted.html, isn't it?

I'm not keen in favoring Lifted over Dropped, so Maybe is better staying without an instance. (Similar reasoning why Int doesn't have Monoid instance).

I'd accept a PR with functions helping conversion between Lifted a <-> Maybe a <-> Dropped a thought.

coot commented 5 years ago

Yes, indeed; fair point. What about adding:

drop :: b -> (Dropped a -> b) -> Dropped a -> b

and

lift :: b -> (Lifted a-> b) -> Lifted a -> b

similar to maybe.