feral icon indicating copy to clipboard operation
feral copied to clipboard

Deprecate/remove `INothing`?

Open armanbilge opened this issue 3 years ago • 3 comments

To follow suit with https://github.com/typelevel/fs2/pull/2870.

@bpholt had an excellent minimization in https://github.com/typelevel/feral/pull/52#issuecomment-974246880 demonstrating why we needed INothing instead of Nothing. Unfortunately, subsequent refactors made it no longer applicable and I was unable to find another one, tracked in https://github.com/typelevel/feral/issues/73.

I took a quick try at replacing INothing with Nothing. So far I encountered two issues:

  • To get the Encoder[INothing] into implicit scope on Scala 3, we put it inside a companion object for INothing. We can't do this with Nothing. https://github.com/typelevel/feral/blob/81d1997372d5156ff2e74f9df357a43dcfd8d00f/lambda/shared/src/main/scala-3/feral/lambda/INothing.scala#L27-L28

  • This compile test no longer compiles, which may mean trouble for inference when using Kleisli-based tracing. https://github.com/typelevel/feral/blob/81d1997372d5156ff2e74f9df357a43dcfd8d00f/lambda/shared/src/test/scala/feral/lambda/TracedHandlerSuite.scala#L39

    type mismatch;
     found   : cats.data.Kleisli[cats.effect.IO,natchez.Span[cats.effect.IO],Option[Nothing]]
     required: cats.data.Kleisli[[+A]cats.effect.IO[A],natchez.Span[[+A]cats.effect.IO[A]],Option[Result]]
    Note: Option[Nothing] <: Option[Result], but class Kleisli is invariant in type B.
    You may wish to define B as +B instead.
    

    Update: the broken compile test is only broken on Scala 2, Scala 3 seems okay.

armanbilge avatar Apr 04 '22 13:04 armanbilge

So apparently there is this:

  • https://github.com/circe/circe/pull/1598

Reviving that PR seems like the best way to solve our implicit scope problems in the long-term.

Edit: nice, an issue as well.

  • https://github.com/circe/circe/issues/1519

armanbilge avatar May 22 '22 04:05 armanbilge

Hmm, tried reviving the Circe PR in https://github.com/armanbilge/circe/commit/3973601d85684aaa474f9f130e98fe66dca0ddf7 but it doesn't seem to work actually 😕

armanbilge avatar May 22 '22 05:05 armanbilge

I took another try at the Circe PR this afternoon. It works in Scala 3 but some form of INothing is needed for Scala 2.13. I guess we're stuck with it for now.

armanbilge avatar Jul 21 '22 01:07 armanbilge