From 83f67a029110e465eeac52d26b6a4ed7adae18fe Mon Sep 17 00:00:00 2001 From: Yuki Ishikawa Date: Tue, 16 Jan 2018 15:56:11 +0900 Subject: [PATCH] Add refined floating-point types --- .../eu/timepit/refined/types/numeric.scala | 40 +++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/modules/core/shared/src/main/scala/eu/timepit/refined/types/numeric.scala b/modules/core/shared/src/main/scala/eu/timepit/refined/types/numeric.scala index 41dd260ae..0673267c5 100644 --- a/modules/core/shared/src/main/scala/eu/timepit/refined/types/numeric.scala +++ b/modules/core/shared/src/main/scala/eu/timepit/refined/types/numeric.scala @@ -47,4 +47,44 @@ trait NumericTypes { type NonPosLong = Long Refined NonPositive object NonPosLong extends RefinedTypeOps.Numeric[NonPosLong, Long] + + /** A `Float` greater than 0. */ + type PosFloat = Float Refined Positive + + object PosFloat extends RefinedTypeOps.Numeric[PosFloat, Float] + + /** A `Float` greater than or equal to 0. */ + type NonNegFloat = Float Refined NonNegative + + object NonNegFloat extends RefinedTypeOps.Numeric[NonNegFloat, Float] + + /** A `Float` less than 0. */ + type NegFloat = Float Refined Negative + + object NegFloat extends RefinedTypeOps.Numeric[NegFloat, Float] + + /** A `Float` less than or equal to 0. */ + type NonPosFloat = Float Refined NonPositive + + object NonPosFloat extends RefinedTypeOps.Numeric[NonPosFloat, Float] + + /** A `Double` greater than 0. */ + type PosDouble = Double Refined Positive + + object PosDouble extends RefinedTypeOps.Numeric[PosDouble, Double] + + /** A `Double` greater than or equal to 0. */ + type NonNegDouble = Double Refined NonNegative + + object NonNegDouble extends RefinedTypeOps.Numeric[NonNegDouble, Double] + + /** A `Double` less than 0. */ + type NegDouble = Double Refined Negative + + object NegDouble extends RefinedTypeOps.Numeric[NegDouble, Double] + + /** A `Double` less than or equal to 0. */ + type NonPosDouble = Double Refined NonPositive + + object NonPosDouble extends RefinedTypeOps.Numeric[NonPosDouble, Double] }