# Synthesize constructor for opaque types

**URL:** <https://contributors.scala-lang.org/t/synthesize-constructor-for-opaque-types/4616>\
**Category:** Language Design\
**Created:** [November 10, 2020, 8:25am UTC](https://contributors.scala-lang.org/t/synthesize-constructor-for-opaque-types/4616 "2020-11-10T08:25:06Z")\
**Posts on this page:** 1\
**Showing post:** 42

<div class="post-metadata">

**Author:** ![smarter](https://contributors.scala-lang.org/user_avatar/contributors.scala-lang.org/smarter/32/92_2.png) [@smarter](https://contributors.scala-lang.org/u/smarter)\
**Post date:** [November 17, 2020, 9:25pm UTC](https://contributors.scala-lang.org/t/synthesize-constructor-for-opaque-types/4616/42 "2020-11-17T21:25:25Z")

</div>

I still don’t get it, you can do the same with an opaque type as far as I can tell:

```auto
trait NewType[Wrapped] {
  opaque type Type = Wrapped
  
  def apply(w: Wrapped): Type = w
  
  extension (t: Type) {
    def unwrap: Wrapped = t
  }
}

```

---

_[View the full topic](https://contributors.scala-lang.org/t/synthesize-constructor-for-opaque-types/4616)._
