haskellari / lattices

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

add comparable function to PartialOrd #23

Closed dbeacham closed 8 years ago

dbeacham commented 8 years ago

Could we add

comparable :: PartialOrd a => a -> a -> Bool
comparable x y = leq x y || leq y x

either as a standalone function or a class method on PartialOrd with default implementation as above? Only reason I suggest a class method is so that instances could improve performance a touch, but it's possibly only a minor benefit.

Happy to send over a pull request for preferred approach.

phadej commented 8 years ago

How that would be different from Eq's == ?

EDIT now I see, it's with || not &&!

phadej commented 8 years ago

I'm ok with class method, it would still be a backward compatible change. PR is more then welcome.