Closed emilypi closed 6 years ago
@fommil I know you have a special way you'dlike to do instances, feel free to reconfigure, or give a run down of what you thinkis best
Cool!
In 7.2 the MonadIO is able to lift nested monad transformers, did you look into how it is able to do that?
It might be worthwhile overriding a few more things for performance. Especially map.
That said, I prefer the implicit Monad approach. Would it be hard to change that?
@fommil naw i could change it relatively easily - it just means i get to do less work in the instance creation 😄
also, shouldn't this be LiftIO
not MonadIO
?
I don't understand the point of MonadIO
.
@fommil LiftIO
is what cats.effect
renamed MonadIO
. https://hackage.haskell.org/package/transformers-0.2.2.1/docs/Control-Monad-IO-Class.html
I'd rather be at parity with Haskell than further their poor naming conventions
we have prior art https://github.com/scalaz/scalaz/blob/series/7.3.x/effect/src/main/scala/scalaz/effect/LiftIO.scala (going back to 2011, at least)
I don't think this needs an implicit Monad
to implement.
I think the E
should be on the typeclass rather than the method.
@fommil It looks like they made LiftIO
MonadIO
, and MonadIO
Monad with LiftIO
. I don't know about that, since MonadIO
requires monad laws to make sense as a typeclass. There really isn't a semistructure here to abstract out. It's one method
@fommil alright I've switched it up so we're no longer using inheritance, but now the implicits aren't being found for each transformer appropriately. Would this have something to do with the new wait we're making instances discoverable? This should compile.
if you want laws, you'll need to extend Monad
and add them using the scalaz style, e.g. see how Monad
does it from the Bind
laws.
[error] MonadIOInstances.scala:16:25: type parameter E defined in method liftIO shadows type E defined in method ioMonadIO. You may want to rename your type parameter, or possibly remove it.
[error] override def liftIO[E, A](io: IO[E, A])(implicit M: Monad[IO[E, ?]]): IO[E, A] = io
[error] ^
Will do. I'll get this fixed up by tonight.
@fommil alright, looks like we're good to go on this one
Here are the MonadIO instances available to us, as well as a shameless theft of
redeem
from ZIO