-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Close #354 - Replace opaque types (newtypes) with refined4s
- Loading branch information
Showing
6 changed files
with
47 additions
and
181 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 6 additions & 18 deletions
24
modules/maven2sbt-core/src/main/scala-3/maven2sbt/core/Libs.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,18 @@ | ||
package maven2sbt.core | ||
|
||
import refined4s.* | ||
|
||
/** @author Kevin Lee | ||
* @since 2021-03-04 | ||
*/ | ||
final case class Libs(dependencies: List[(Libs.LibValName, Dependency)]) | ||
|
||
object Libs extends LibsPlus { | ||
|
||
type LibsName = LibsName.LibsName | ||
object LibsName { | ||
opaque type LibsName = String | ||
def apply(libsName: String): LibsName = libsName | ||
|
||
given libsNameCanEqual: CanEqual[LibsName, LibsName] = CanEqual.derived | ||
|
||
extension (libsName: LibsName) def value: String = libsName | ||
} | ||
|
||
type LibValName = LibValName.LibValName | ||
object LibValName { | ||
opaque type LibValName = String | ||
def apply(libValName: String): LibValName = libValName | ||
|
||
given libValNameCanEqual: CanEqual[LibValName, LibValName] = CanEqual.derived | ||
type LibsName = LibsName.Type | ||
object LibsName extends Newtype[String] | ||
|
||
extension (libValName: LibValName) def value: String = libValName | ||
} | ||
type LibValName = LibValName.Type | ||
object LibValName extends Newtype[String] | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 4 additions & 9 deletions
13
modules/maven2sbt-core/src/main/scala-3/maven2sbt/core/Props.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,13 @@ | ||
package maven2sbt.core | ||
|
||
import refined4s.* | ||
|
||
/** @author Kevin Lee | ||
* @since 2020-12-13 | ||
*/ | ||
object Props extends PropsPlus { | ||
|
||
type PropsName = PropsName.PropsName | ||
object PropsName { | ||
opaque type PropsName = String | ||
def apply(propsName: String): PropsName = propsName | ||
|
||
given propsNameCanEqual: CanEqual[PropsName, PropsName] = CanEqual.derived | ||
|
||
extension (propsName: PropsName) def value: String = propsName | ||
} | ||
type PropsName = PropsName.Type | ||
object PropsName extends Newtype[String] | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters