haskus / packages

Haskus packages
https://haskus.org/
24 stars 11 forks source link

No Eq instance for Haskus.Utils.Variant.VEither #41

Closed frabbit closed 2 years ago

frabbit commented 2 years ago

Is there any reason why there is no Eq instance for Haskus.Utils.Variant.VEither?

I'm currently using this Orphan:

instance ( Eq a, Eq (V es)) => Eq (VEither es a) where
  (==) (VLeft as) (VLeft bs) =  as == bs
  (==) (VRight a) (VRight b) = a == b
  (==) _ _ = False

If there are no arguments against it, i can create a PR for this.

hsyl20 commented 2 years ago

No particular reason. Both Eq and Ord instances could be newtype derived to benefit from the optimized implementation for Variant. PR welcome :)

frabbit commented 2 years ago

There you go: https://github.com/haskus/packages/pull/42/commits

hsyl20 commented 2 years ago

Thanks, merged! I'll make a Hackage release soon