# Pre-SIP: Allow fully implicit conversions in Scala 3 with \`into\`

**URL:** <https://contributors.scala-lang.org/t/pre-sip-allow-fully-implicit-conversions-in-scala-3-with-into/7105>\
**Category:** Scala Improvement Process\
**Created:** [April 17, 2025, 2:51pm UTC](https://contributors.scala-lang.org/t/pre-sip-allow-fully-implicit-conversions-in-scala-3-with-into/7105 "2025-04-17T14:51:01Z")\
**Posts on this page:** 16\
**Page:** 3

<div class="post-metadata">

**Author:** ![AMatveev](https://contributors.scala-lang.org/user_avatar/contributors.scala-lang.org/amatveev/32/847_2.png) [@AMatveev](https://contributors.scala-lang.org/u/AMatveev)\
**Post date:** [April 23, 2025, 11:04am UTC](https://contributors.scala-lang.org/t/pre-sip-allow-fully-implicit-conversions-in-scala-3-with-into/7105/41 "2025-04-23T11:04:24Z")

</div>

> [@odersky](#):
>
> We allow `into` as a soft modifier

Why can not we use soft modifier `convertable` which will be able to allow convertion in both directions?  
It would allow to implement “boxing” and “unboxing” with standart libraries and operators for dsl types.

---

<div class="post-metadata">

**Author:** ![fwbrasil](https://contributors.scala-lang.org/user_avatar/contributors.scala-lang.org/fwbrasil/32/3144_2.png) [@fwbrasil](https://contributors.scala-lang.org/u/fwbrasil)\
**Post date:** [April 24, 2025, 1:59pm UTC](https://contributors.scala-lang.org/t/pre-sip-allow-fully-implicit-conversions-in-scala-3-with-into/7105/42 "2025-04-24T13:59:06Z")

</div>

> Thanks for the detailed report. Would the second alternative, i.e. `into` as a modifier on the boxing wrapper class, work better than into constructors in your case?

I believe not. As mentioned, `<` is an opaque type and the modifier proposal is limited to class types. Is there a rationale for the limitation? Here’s how it looks like today:

```scala
opaque type <[+A, -S] = A | Kyo[A, S]

object `<`:
    implicit def lift[A: WeakFlat, S](v: A): A < S =
        v match
            case kyo: Kyo[?, ?] => Nested(kyo)
            case _ => v.asInstanceOf[A < S]

// internal to the kernel
sealed abstract class Kyo[+A, -S]
case class Nested[+A](v: A) extends Kyo[A, Any]
// other subclasses

```

As it is now, it seems the SIP would essentially break one of Kyo’s main optimizations: unboxed monadic execution. It’s alarming since it could inviabilize the project. The alternative of adding `into` to all parameters of type `<` would be quite problematic as well given that it’d pollute the entire codebase. Users would need to do the same in their code to be able to use Kyo as it’s designed to be used.

Would exposing a type bound with `into` be a viable workaround? It wouldn’t be ideal to expose a type that is meant to be internal but could the compiler locate the conversion whenever an `A` needs to be used in a context where a `<` is required?

```scala
opaque type <[+A, -S] >: into[Nested[A]] = A | Kyo[A, S]

```

---

<div class="post-metadata">

**Author:** ![odersky](https://contributors.scala-lang.org/user_avatar/contributors.scala-lang.org/odersky/32/42_2.png) [@odersky](https://contributors.scala-lang.org/u/odersky)\
**Post date:** [April 24, 2025, 2:55pm UTC](https://contributors.scala-lang.org/t/pre-sip-allow-fully-implicit-conversions-in-scala-3-with-into/7105/43 "2025-04-24T14:55:41Z")

</div>

I think a modifier on an opaque type would also work. I see no good reason to exclude it. Unless someone argues against, I will extend the proposal.

---

<div class="post-metadata">

**Author:** ![fwbrasil](https://contributors.scala-lang.org/user_avatar/contributors.scala-lang.org/fwbrasil/32/3144_2.png) [@fwbrasil](https://contributors.scala-lang.org/u/fwbrasil)\
**Post date:** [April 24, 2025, 6:31pm UTC](https://contributors.scala-lang.org/t/pre-sip-allow-fully-implicit-conversions-in-scala-3-with-into/7105/44 "2025-04-24T18:31:30Z")

</div>

Thank you for considering Kyo’s usage. Supporting opaque types with the `into` modifier should be enough for the project’s needs.

---

<div class="post-metadata">

**Author:** ![steinybot](https://contributors.scala-lang.org/user_avatar/contributors.scala-lang.org/steinybot/32/1654_2.png) [@steinybot](https://contributors.scala-lang.org/u/steinybot)\
**Post date:** [April 24, 2025, 10:11pm UTC](https://contributors.scala-lang.org/t/pre-sip-allow-fully-implicit-conversions-in-scala-3-with-into/7105/45 "2025-04-24T22:11:38Z")

</div>

Would it be possible to infer the `into` modifier on a type whose companion object contains a conversion? Designers of the target type have already made an explicit choice to support conversions so having to add the `into` modifier seems redundant. In a lot of cases, library authors wouldn’t need to do anything.

Are there even valid use cases of the `into` modifier where the companion object does not contain the conversion? In those cases the author of the target type isn’t providing the conversion and so that seems bad for the same reason that adding it to `IterableOnce` would be bad.

---

<div class="post-metadata">

**Author:** ![bishabosha](https://contributors.scala-lang.org/user_avatar/contributors.scala-lang.org/bishabosha/32/3101_2.png) [@bishabosha](https://contributors.scala-lang.org/u/bishabosha)\
**Post date:** [April 25, 2025, 7:22am UTC](https://contributors.scala-lang.org/t/pre-sip-allow-fully-implicit-conversions-in-scala-3-with-into/7105/46 "2025-04-25T07:22:38Z")

</div>

> [@steinybot](#):
>
> Are there even valid use cases of the `into` modifier where the companion object does not contain the conversion?

all of the java standard library types that integrate with collections library

---

<div class="post-metadata">

**Author:** ![morgen-peschke](https://contributors.scala-lang.org/user_avatar/contributors.scala-lang.org/morgen-peschke/32/2528_2.png) [@morgen-peschke](https://contributors.scala-lang.org/u/morgen-peschke)\
**Post date:** [April 25, 2025, 5:50pm UTC](https://contributors.scala-lang.org/t/pre-sip-allow-fully-implicit-conversions-in-scala-3-with-into/7105/47 "2025-04-25T17:50:54Z")

</div>

> [@steinybot](#):
>
> Are there even valid use cases of the `into` modifier where the companion object does not contain the conversion?

I could see this also being the case when writing shims or integration libraries like the various `*-scalatest` or `*-munit` libraries.

---

<div class="post-metadata">

**Author:** ![steinybot](https://contributors.scala-lang.org/user_avatar/contributors.scala-lang.org/steinybot/32/1654_2.png) [@steinybot](https://contributors.scala-lang.org/u/steinybot)\
**Post date:** [April 26, 2025, 1:37am UTC](https://contributors.scala-lang.org/t/pre-sip-allow-fully-implicit-conversions-in-scala-3-with-into/7105/48 "2025-04-26T01:37:57Z")

</div>

> [@bishabosha](#):
>
> all of the java standard library types that integrate with collections library

`AsScala` could have a companion object that extends `DecorateAsScala` which would then make it eligible.

---

<div class="post-metadata">

**Author:** ![steinybot](https://contributors.scala-lang.org/user_avatar/contributors.scala-lang.org/steinybot/32/1654_2.png) [@steinybot](https://contributors.scala-lang.org/u/steinybot)\
**Post date:** [April 26, 2025, 1:41am UTC](https://contributors.scala-lang.org/t/pre-sip-allow-fully-implicit-conversions-in-scala-3-with-into/7105/49 "2025-04-26T01:41:57Z")

</div>

> [@morgen-peschke](#):
>
> I could see this also being the case when writing shims or integration libraries like the various `*-scalatest` or `*-munit` libraries.

How so? If you control the target type you have just as much control over adding the `into` modifier as adding a companion object with a conversion. If you aren’t defining the conversions in the same library as the target type then you aren’t following the warnings and probably shouldn’t be adding the `into` modifier anyway.

---

<div class="post-metadata">

**Author:** ![morgen-peschke](https://contributors.scala-lang.org/user_avatar/contributors.scala-lang.org/morgen-peschke/32/2528_2.png) [@morgen-peschke](https://contributors.scala-lang.org/u/morgen-peschke)\
**Post date:** [April 30, 2025, 7:04pm UTC](https://contributors.scala-lang.org/t/pre-sip-allow-fully-implicit-conversions-in-scala-3-with-into/7105/50 "2025-04-30T19:04:25Z")

</div>

In those libraries, it’s usually a third party providing the glue code that allows quality of life benefits like being able to write async tests using `IO` instead of `Future`.

This removes the maintenance burden of integrating with other libraries from the authors of frameworks like Scalatest and MUnit, and requiring the library that controls the types to add these conversionn means we likely won’t have these additional integrations at all.

Categorically dismissing these glue libraries as something that probably shouldn’t exist is, at least in my opinion, extremely short-sighted.

---

<div class="post-metadata">

**Author:** ![odersky](https://contributors.scala-lang.org/user_avatar/contributors.scala-lang.org/odersky/32/42_2.png) [@odersky](https://contributors.scala-lang.org/u/odersky)\
**Post date:** [May 25, 2025, 11:45am UTC](https://contributors.scala-lang.org/t/pre-sip-allow-fully-implicit-conversions-in-scala-3-with-into/7105/51 "2025-05-25T11:45:02Z")

</div>

[SIP 71](https://github.com/scala/improvement-proposals/pull/109) has been accepted for implementation at the SIP meeting of May 23rd. A draft implementation is in the Scala 3 PR [23014](https://github.com/scala/scala3/pull/23014).

---

<div class="post-metadata">

**Author:** ![nafg](https://contributors.scala-lang.org/user_avatar/contributors.scala-lang.org/nafg/32/38_2.png) [@nafg](https://contributors.scala-lang.org/u/nafg)\
**Post date:** [May 29, 2025, 10:43am UTC](https://contributors.scala-lang.org/t/pre-sip-allow-fully-implicit-conversions-in-scala-3-with-into/7105/52 "2025-05-29T10:43:09Z")

</div>

If `into` will be a keyword as a modifier for classes, why not let it be a modifier keyword for types as well? In what sense is `into[T]` actually a type in a way that’s useful?

One thing that was mentioned was being able to alias it: `type A = into[B]`. But if it can be a modifier on a class wouldn’t `into type A = B` make more sense?

---

<div class="post-metadata">

**Author:** ![nafg](https://contributors.scala-lang.org/user_avatar/contributors.scala-lang.org/nafg/32/38_2.png) [@nafg](https://contributors.scala-lang.org/u/nafg)\
**Post date:** [May 29, 2025, 10:44am UTC](https://contributors.scala-lang.org/t/pre-sip-allow-fully-implicit-conversions-in-scala-3-with-into/7105/53 "2025-05-29T10:44:02Z")

</div>

Like, would `type A = Either[B, into[C]]` make any sense?

What should “into-ness” really be a property of?

---

<div class="post-metadata">

**Author:** ![odersky](https://contributors.scala-lang.org/user_avatar/contributors.scala-lang.org/odersky/32/42_2.png) [@odersky](https://contributors.scala-lang.org/u/odersky)\
**Post date:** [September 26, 2025, 5:57pm UTC](https://contributors.scala-lang.org/t/pre-sip-allow-fully-implicit-conversions-in-scala-3-with-into/7105/54 "2025-09-26T17:57:51Z")

</div>

An update: [SIP 71](https://github.com/scala/improvement-proposals/pull/109) has been accepted for inclusion in the language at today’s SIP meeting. I expect it will land in `-preview` mode in Scala 3.8 and as a regular feature in Scala 3.9.

---

<div class="post-metadata">

**Author:** ![halotukozak](https://contributors.scala-lang.org/user_avatar/contributors.scala-lang.org/halotukozak/32/3217_2.png) [@halotukozak](https://contributors.scala-lang.org/u/halotukozak)\
**Post date:** [May 24, 2026, 10:01am UTC](https://contributors.scala-lang.org/t/pre-sip-allow-fully-implicit-conversions-in-scala-3-with-into/7105/55 "2026-05-24T10:01:23Z")

</div>

Are there any plans to integrate `Conversion.into` (nomen omen) into the standard library? Like it was done with the capture checking? It would be beneficial for places like `scala.collection.IterableOnceOps#to`. Current state requires e.g. `scala.collection.IterableFactory.toFactory` to be an implicit conversion, it also implies for the custom types, like this:

```scala
object MyCustomFactory
trait MyCustomCollection[T]

given [T] => Conversion[MyCustomFactory, Factory[A, MyCustomCollection[A]] = ???

List(???).to(MyCustomFactory) // warn: Use of implicit conversion given instance should be enabled...

```

(it would work with an `implicit def` and `import scala.language.implicitConversions`, but we’d like to avoid the old solutions, wouldn’t we?)

---

<div class="post-metadata">

**Author:** ![bishabosha](https://contributors.scala-lang.org/user_avatar/contributors.scala-lang.org/bishabosha/32/3101_2.png) [@bishabosha](https://contributors.scala-lang.org/u/bishabosha)\
**Post date:** [May 26, 2026, 9:57am UTC](https://contributors.scala-lang.org/t/pre-sip-allow-fully-implicit-conversions-in-scala-3-with-into/7105/56 "2026-05-26T09:57:32Z")

</div>

Sure we can introduce `into` from 3.10 onwards

[Previous page](https://contributors.scala-lang.org/t/pre-sip-allow-fully-implicit-conversions-in-scala-3-with-into/7105.md?page=2)
