Skip to content

Commit

Permalink
Only provide Eq for NewType if there is no Order instance
Browse files Browse the repository at this point in the history
  • Loading branch information
toddburnside committed Oct 23, 2024
1 parent d4d906e commit 06aef01
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ import lucuma.core.optics.refinedPrism
import monocle.Iso
import monocle.Prism

import scala.util.NotGiven

/**
* Usage:
* ```
Expand All @@ -32,7 +34,8 @@ trait NewType[Wrapped]:
inline def modifyValue(f: Wrapped => Wrapped): Type = apply(f(value))

given (using CanEqual[Wrapped, Wrapped]): CanEqual[Type, Type] = CanEqual.derived
given (using eq: Eq[Wrapped]): Eq[Type] = eq
// Only provide an Eq instance if it doesn't also provide Order
given (using eq: Eq[Wrapped], noOrder: NotGiven[Order[Wrapped]]): Eq[Type] = eq
given (using enc: Encoder[Wrapped]): Encoder[Type] = enc
given (using dec: Decoder[Wrapped]): Decoder[Type] = dec
given (using disp: Display[Wrapped]): Display[Type] = disp
Expand Down

0 comments on commit 06aef01

Please sign in to comment.