jem
04/02/2021, 5:50 AMReader
type after upgrading to 0.12.0. (MTL is still on 0.11.0 though). After this upgrade:
- val arrowFx = "io.arrow-kt:arrow-fx:0.10.5"
- val arrowMtlData = "io.arrow-kt:arrow-mtl-data:0.10.5"
- val arrowOptics = "io.arrow-kt:arrow-optics:0.10.5"
+ val arrowFx = "io.arrow-kt:arrow-fx:0.12.0"
+ val arrowMtlData = "io.arrow-kt:arrow-mtl-data:0.11.0"
+ val arrowOptics = "io.arrow-kt:arrow-optics:0.12.0"
I find that reader.run(thing).value()
is no longer able to resolve .value()
. How should it read now?
.run(thing)
is returning type Kind<ForId, T>
simon.vergauwen
04/02/2021, 7:25 AMmtl
is no longer actively maintained. It was an experimental module, and heavily relies on Kind
and typeclasses which are unidiomatic in Kotlin and require a lot of weird machinery.
Here are a couple examples of how you can replace Reader
with receiver functions and how you can scope/compose the T
dependency type of your Reader
.
- https://gist.github.com/raulraja/ac7a489c01193bcf5e8fdc59c89b5156
- https://gist.github.com/raulraja/97e2d5bf60e9d96680cf1fddcc90ee67
- https://gist.github.com/nomisRev/1f91710ebec1709d4ce8059812482624jem
04/02/2021, 7:28 AMsimon.vergauwen
04/02/2021, 7:41 AMCarlos Fernandes
04/03/2021, 5:25 PMReaderT
, could you please elaborate a bit on your explanation above?
I've had a look at the examples, they are quite different from one anotherraulraja
04/03/2021, 7:18 PM(Dependencies) -> F<A>
which is already covered in Kotlin by extension functions and suspension if your F is IO. suspend Dependencies.f(): A
it’s isomorphic to ReaderT<IO<_>, Dependencies, A>
, more ergonomic, faster and memory friendly since it avoids several layers of flatMap nesting. The examples above are examples of programs written in that style in which dependencies can be constrained with type bounds to enable syntax in the functions.simon.vergauwen
04/03/2021, 7:22 PMsuspend Dependencies.f(): Either<E, A>
being ReaderT<PartialEitherTOf<ForIO, E>, Dependencies, A>
Carlos Fernandes
04/04/2021, 7:35 AMrebyrg
04/07/2021, 8:31 PMraulraja
04/07/2021, 8:51 PMrebyrg
04/08/2021, 8:13 AM