Skip to content

Commit

Permalink
Rename Inequality to Orderable
Browse files Browse the repository at this point in the history
  • Loading branch information
propensive committed Jun 22, 2024
1 parent 217565c commit ea0053b
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 18 deletions.
24 changes: 12 additions & 12 deletions src/core/hypotenuse.Hypotenuse.scala
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ object Hypotenuse:
inline def apply(bits: B64): F64 = JDouble.longBitsToDouble(bits)
inline def apply(double: Double): F64 = double

inline given Inequality[F64, F64] as inequality:
inline given Orderable[F64, F64] as orderable:

inline def compare
(inline left: F64, inline right: F64, inline strict: Boolean, inline greaterThan: Boolean)
Expand All @@ -78,7 +78,7 @@ object Hypotenuse:
then inline if strict then left > right else left >= right
else inline if strict then left < right else left <= right

inline given Inequality[F64, Int] as inequalityInt:
inline given Orderable[F64, Int] as orderableInt:

inline def compare
(inline left: F64, inline right: Int, inline strict: Boolean, inline greaterThan: Boolean)
Expand All @@ -88,7 +88,7 @@ object Hypotenuse:
then inline if strict then left > right else left >= right
else inline if strict then left < right else left <= right

inline given Inequality[F64, Double] as inequalityDouble:
inline given Orderable[F64, Double] as orderableDouble:

inline def compare(inline left: F64, inline right: Double, inline strict: Boolean,
inline greaterThan: Boolean): Boolean =
Expand Down Expand Up @@ -136,7 +136,7 @@ object Hypotenuse:
inline given CanEqual[F32, F32 | S64 | S32 | S16 | S8 | Float | Long | Int | Short | Byte] as canEqual =
erasedValue

inline given Inequality[F32, F32] as inequality:
inline given Orderable[F32, F32] as orderable:

inline def compare
(inline left: F32, inline right: F32, inline strict: Boolean, inline greaterThan: Boolean)
Expand Down Expand Up @@ -184,7 +184,7 @@ object Hypotenuse:
given U64 is Textualizer = JLong.toUnsignedString(_).nn.tt
inline def apply(bits: B64): U64 = bits

inline given Inequality[U64, U64] as inequality:
inline given Orderable[U64, U64] as orderable:

inline def compare
(inline left: U64, inline right: U64, inline strict: Boolean, inline greaterThan: Boolean)
Expand All @@ -208,7 +208,7 @@ object Hypotenuse:
given S64 is Textualizer = _.toString.tt
inline def apply(bits: B64): S64 = bits

inline given Inequality[S64, S64] as inequality:
inline given Orderable[S64, S64] as orderable:

inline def compare
(inline left: S64, inline right: S64, inline strict: Boolean, inline greaterThan: Boolean)
Expand All @@ -229,7 +229,7 @@ object Hypotenuse:
given U32 is Textualizer = JInt.toUnsignedString(_).nn.tt
inline def apply(bits: B32): U32 = bits

inline given Inequality[U32, U32] as inequality:
inline given Orderable[U32, U32] as orderable:
inline def compare
(inline left: U32, inline right: U32, inline strict: Boolean, inline greaterThan: Boolean)
: Boolean =
Expand All @@ -252,7 +252,7 @@ object Hypotenuse:
given S32 is Textualizer = _.toString.tt
inline def apply(bits: B32): S32 = bits

inline given Inequality[S32, S32] as inequality:
inline given Orderable[S32, S32] as orderable:

inline def compare
(inline left: S32, inline right: S32, inline strict: Boolean, inline greaterThan: Boolean)
Expand All @@ -272,7 +272,7 @@ object Hypotenuse:
given U16 is Textualizer = u16 => JShort.toUnsignedInt(u16).toString.nn.tt
inline def apply(bits: B16): U16 = bits

inline given Inequality[U16, U16] as inequality:
inline given Orderable[U16, U16] as orderable:

inline def compare
(inline left: U16, inline right: U16, inline strict: Boolean, inline greaterThan: Boolean)
Expand All @@ -297,7 +297,7 @@ object Hypotenuse:
given S16 is Textualizer = _.toString.tt
inline def apply(bits: B16): S16 = bits

inline given Inequality[S16, S16] as inequality:
inline given Orderable[S16, S16] as orderable:

inline def compare
(inline left: S16, inline right: S16, inline strict: Boolean, inline greaterThan: Boolean)
Expand All @@ -317,7 +317,7 @@ object Hypotenuse:
inline def apply(bits: B8): U8 = bits


inline given Inequality[U8, U8] as inequality:
inline given Orderable[U8, U8] as orderable:

inline def compare
(inline left: U8, inline right: U8, inline strict: Boolean, inline greaterThan: Boolean)
Expand All @@ -342,7 +342,7 @@ object Hypotenuse:
given S8 is Textualizer = _.toString.tt
inline def apply(bits: B8): S8 = bits

inline given Inequality[S8, S8] as inquality:
inline given Orderable[S8, S8] as inquality:

inline def compare
(inline left: S8, inline right: S8, inline strict: Boolean, inline greaterThan: Boolean)
Expand Down
2 changes: 1 addition & 1 deletion src/core/hypotenuse.Hypotenuse2.scala
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ object Hypotenuse2:

Expr(int.toByte)

def inequality
def orderable
(expr: Expr[Boolean],
bound: Expr[Int | Double | Char | Byte | Short | Long | Float],
strict: Expr[Boolean],
Expand Down
6 changes: 3 additions & 3 deletions src/core/hypotenuse.NumericallyComparable.scala
Original file line number Diff line number Diff line change
Expand Up @@ -23,17 +23,17 @@ import scala.annotation.*
import rudiments.*

object NumericallyComparable:
inline given Inequality[Boolean, Int | Double | Char | Byte | Short | Float | Long] as numeric:
inline given Orderable[Boolean, Int | Double | Char | Byte | Short | Float | Long] as numeric:
inline def compare
(inline left: Boolean,
inline right: Int | Double | Char | Byte | Short | Float | Long,
inline strict: Boolean,
inline greaterThan: Boolean)
: Boolean =

${Hypotenuse2.inequality('left, 'right, 'strict, 'greaterThan)}
${Hypotenuse2.orderable('left, 'right, 'strict, 'greaterThan)}

given Inequality[ByteSize, ByteSize] as inequality:
given Orderable[ByteSize, ByteSize] as orderable:
inline def compare
(inline left: ByteSize, inline right: ByteSize, inline strict: Boolean, inline greaterThan: Boolean)
: Boolean =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import language.experimental.captureChecking

import scala.annotation.*

trait Inequality[-LeftType, -RightType]
trait Orderable[-LeftType, -RightType]
extends
CompareGreaterEqual[LeftType, RightType, Boolean],
CompareLess[LeftType, RightType, Boolean],
Expand Down
2 changes: 1 addition & 1 deletion src/core/soundness+hypotenuse-core.scala
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
package soundness

export hypotenuse.{CheckOverflow, CompareGreater, CompareGreaterEqual, CompareLess, CompareLessEqual, DivisionByZero,
DivisionError, Inequality, NumericallyComparable, OverflowError, B8, B16, B32, B64, S8, S16, S32, S64, U8, U16,
DivisionError, Orderable, NumericallyComparable, OverflowError, B8, B16, B32, B64, S8, S16, S32, S64, U8, U16,
U32, U64, F32, F64, abs, sqrt, cbrt, ceiling, floor, exponent, increment, decrement, round, scalb, signum, ulp,
bits, rawBits, finite, infinite, nan, **, mantissa, long, int, short, octal, hex, base32, binary, %%,
\, apply, erf, π, pi, e, eulerNumber, φ, goldenRatio, cos, acos, cosh, sin, asin, sinh, tan, atan, hyp, exp,
Expand Down

0 comments on commit ea0053b

Please sign in to comment.