SkillAgentSearch skills...

Newtypes

Zero-cost wrappers (newtypes) for Scala 3

Install / Use

/learn @gvolpe/Newtypes
About this skill

Quality Score

0/100

Supported Platforms

Universal

README

newtypes

Exploring zero-cost wrappers (aka newtypes) for Scala 3 built on top of opaque types.

import dev.profunktor.NewType

val Foo = NewType.of[Int]
type Foo = Foo.Type

def something(foo: Foo): Unit =
  println(foo.value)

something(Foo(22)) // prints out 22
something(123)     // fails to compile
View on GitHub
GitHub Stars43
CategoryDevelopment
Updated1y ago
Forks3

Languages

Scala

Security Score

75/100

Audited on Sep 22, 2024

No findings