Skip to content

Commit

Permalink
Close #67 - [core] Add NegShort, NonNegShort, PosShort and NonPosShor…
Browse files Browse the repository at this point in the history
…t to numeric package
  • Loading branch information
kevin-lee committed Dec 8, 2023
1 parent 0289017 commit 82dce99
Show file tree
Hide file tree
Showing 2 changed files with 489 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -78,5 +78,37 @@ trait numeric {

}

type NegShort = NegShort.Type
object NegShort extends Numeric[Short] {
override inline def invalidReason(a: Short): String = expectedMessage("a negative Short")

override inline def predicate(a: Short): Boolean = a < 0

}

type NonNegShort = NonNegShort.Type
object NonNegShort extends Numeric[Short] {
override inline def invalidReason(a: Short): String = expectedMessage("a non-negative Short")

override inline def predicate(a: Short): Boolean = a >= 0

}

type PosShort = PosShort.Type
object PosShort extends Numeric[Short] {
override inline def invalidReason(a: Short): String = expectedMessage("a positive Short")

override inline def predicate(a: Short): Boolean = a > 0

}

type NonPosShort = NonPosShort.Type
object NonPosShort extends Numeric[Short] {
override inline def invalidReason(a: Short): String = expectedMessage("a non-positive Short")

override inline def predicate(a: Short): Boolean = a <= 0

}

}
object numeric extends numeric
Loading

0 comments on commit 82dce99

Please sign in to comment.