Howdy do, it's been a couple years since I've been...
# arrow
k
Howdy do, it's been a couple years since I've been here. Arrow has gone through so much since then (Arrow Meta wasn't even out yet, and
IO<A>
hadn't been deprecated for suspend yet!). Quick question: didn't Arrow used to have a Free/FreeMonad implementation? I can't seem to find it in the codebase or the docs now. I found a gist for creating a DSL using Arrow (written three years ago) but I can't even find annotations like
@higherkind
to import them. It looks like there used to be a module arrow-free or something based on links in the gist, but I can't find that now.
s
Hey @kyleg, It's been a long time! (My beard got ditched with
IO
🤣) We don't have
@higherkind
or
Free
anywhere anymore because we've found much better and more elegant solutions in Kotlin for all those use-cases.
If you have some old code you'd need to translate, or have some use-case in mind I'd be happy to help you find the solution using the current version
k
Yes, your beard did disappear, but I still recognized the name 🙂 Plus I've seen you and a few 47ers on Twitter. I don't really have personal code to translate. I'm rewriting an Android app of mine from scratch using what I've learned about FP and app architecture the past couple years in my TypeScript/enterprise excursion for work. I'd wanted to try my hand at DSLs and free monads and figured this would be a good learning opportunity. So I was looking at this gist, where they heavily rely on things like
@higherkind
and the code it generated. https://gist.github.com/PhBastiani/26d8734ff33001cb0304df337ea936a1 If it's not available anymore, no big deal: I don't need it to solve my problem. Just wanted to try it out and then write my app async but tests sync, which I understand is a nice benefit of the free monad Is there an Arrow pattern for this kind of thing now? Should I be using MonadError and fx and then at the edges deciding which specific monad to be using (so a DataRepository module might use Either/Option in tests but async/`suspend` in the actual app)? Edit Seems like I misunderstood MonadError. Thought maybe it represented "monad that can succeed or fail but no other restrictions on the context"
s
my app async but tests sync
This is not really a concern anymore for most people, since KotlinX Coroutines now officially has a test module exposing
runTest
And Kotest is MPP etc so you can run suspend functions based tests on all Kotlin MPP platforms
k
Awesome, thanks. First pattern is similar to what I was expecting to do if Free wasn't available. The context receivers thing looks pretty cool, too. I'll have to read more about that! Looks like Kotlin's been getting some cool stuff.