haskellari / lattices

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

Stacked instance of Lattice, conversion functions from Either and Maybe #99

Closed erykciepiela closed 4 years ago

erykciepiela commented 4 years ago

Introduce Stacked data type isomorphic to Either. Add (Lattice a, Lattice b) => Lattice (Stacked a b) instance constructed by considering all minimal elements of b covering all maximal elements of a. Add conversion functions from Either to Stacked. Add conversion functions from Maybe to Dropped and Lifted.

Motivation for conversion functions is to allow for easy integration with ecosystem that pervasively uses Either and Maybe.

Disclaimer: I didn't manage to include QC.CoArbitrary and QC.Function instances of Stacked, need help in that.

I'm open to idea/naming/code style suggestions.

erykciepiela commented 4 years ago

Remarks applied. Please re-review.

phadej commented 4 years ago

I made few extra additions in #100 and published https://hackage.haskell.org/package/lattices-2.0.2

Thanks you!