Mickey Donaghy
10/05/2021, 7:47 AMWriterT
these days? I want to use Either-like and Writer-like effects togetherSatyam Agarwal
10/05/2021, 7:27 PMraulraja
10/05/2021, 8:02 PMSatyam Agarwal
10/05/2021, 8:54 PMJannis
10/05/2021, 10:30 PMinterface WriterEffect<W> {
fun tell(w: W): Unit
}
object writer {
inline fun <W, A> strict(wMonoid: Monoid<W>, act: WriterEffect<W>.() -> A): Pair<A, W> = ...
}
Other interpretations are possible:
fun writer.bytes(sink: Sink<Bytes>, act: WriterEffect<Bytes>.() -> A): A
For arrow we'd just need to interface plus a pure strict implementation. Why is this useful? Well you can implement writing out data using writers that simply write on tell rather than accumulate and in tests run the same functions with a pure strict writer and have an easy test result to compare. In general writing data is an effect that makes sense to model outside of IO to abstract it away if need be (such as in tests, refractoring etc) and implementing this is rather easy as well.Jannis
10/05/2021, 10:30 PMpass/listen
to the api as those are harder to get right in kotlin and don't add too much value imoraulraja
10/05/2021, 10:47 PMraulraja
10/05/2021, 10:48 PMraulraja
10/05/2021, 10:48 PMraulraja
10/05/2021, 10:49 PMraulraja
10/05/2021, 10:54 PMMickey Donaghy
10/06/2021, 12:01 AMMickey Donaghy
10/06/2021, 12:02 AMraulraja
10/06/2021, 4:00 PMraulraja
10/06/2021, 4:00 PM