Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Scala-3.x Introduce Opaque Types #3835

Closed
diesalbla opened this issue Mar 23, 2021 · 0 comments
Closed

Scala-3.x Introduce Opaque Types #3835

diesalbla opened this issue Mar 23, 2021 · 0 comments
Milestone

Comments

@diesalbla
Copy link
Contributor

diesalbla commented Mar 23, 2021

Scala 3 introduces Opaque Type Aliases. Although Scala 2 already had type aliases and AnyVal, opacity is relevant in two ways:

  • Opaque types should not be as fragile and restrictive as the AnyVal wrappers were.
  • Unlike Scala-2 type aliases, opaque types are different symbols for implicit resolution, and thus allows us to define distinct instances of Functor or Monad for OptionT[F, A], which acts differently from that of F[Option[A]] (which is Monad[F]).

Many data types in cats can be seen as mere wrappers, interface adapters, or type renames, of data types. This include IdT, OptionT, EitherT, Kleisli, Cokleisli, ConstT, IorT, Const, Nested, ...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants