From b5740f64cdfeae57972193403e018900ab1783c3 Mon Sep 17 00:00:00 2001 From: Kevin Lee Date: Sun, 21 Jan 2024 02:20:40 +1100 Subject: [PATCH] Close #255 - [refined4s-refined-compat-scala2] Add Uri, Url and Uuid --- .../compat/RefinedCompatAllTypes.scala | 28 ++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/modules/refined4s-refined-compat-scala2/shared/src/main/scala-2/refined4s/compat/RefinedCompatAllTypes.scala b/modules/refined4s-refined-compat-scala2/shared/src/main/scala-2/refined4s/compat/RefinedCompatAllTypes.scala index a54d6b2..0b334c2 100644 --- a/modules/refined4s-refined-compat-scala2/shared/src/main/scala-2/refined4s/compat/RefinedCompatAllTypes.scala +++ b/modules/refined4s-refined-compat-scala2/shared/src/main/scala-2/refined4s/compat/RefinedCompatAllTypes.scala @@ -1,5 +1,7 @@ package refined4s.compat +import eu.timepit.refined +import eu.timepit.refined.api.{Refined, RefinedTypeOps} import eu.timepit.refined.types.AllTypes import eu.timepit.refined.types.AllTypesBinCompat1 import eu.timepit.refined.types.AllTypesBinCompat2 @@ -8,5 +10,29 @@ import eu.timepit.refined.types.AllTypesBinCompat3 /** @author Kevin Lee * @since 2024-01-19 */ -trait RefinedCompatAllTypes extends AllTypes with AllTypesBinCompat1 with AllTypesBinCompat2 with AllTypesBinCompat3 +trait RefinedCompatAllTypes extends AllTypes with AllTypesBinCompat1 with AllTypesBinCompat2 with AllTypesBinCompat3 { + + final type Uri = allTypes.Uri + final val Uri = allTypes.Uri + + final type Url = allTypes.Url + final val Url = allTypes.Url + + final type Uuid = allTypes.Uuid + final val Uuid = allTypes.Uuid + +} object RefinedCompatAllTypes extends RefinedCompatAllTypes + +private[compat] object allTypes { + + type Uri = String Refined refined.string.Uri + object Uri extends RefinedTypeOps[Uri, String] + + type Url = String Refined refined.string.Url + object Url extends RefinedTypeOps[Url, String] + + type Uuid = String Refined refined.string.Uuid + object Uuid extends RefinedTypeOps[Uuid, String] + +}