https://kotlinlang.org logo
Docs
Join the conversationJoin Slack
Channels
100daysofcode
100daysofkotlin
100daysofkotlin-2021
advent-of-code
aem
ai
alexa
algeria
algolialibraries
amsterdam
android
android-architecture
android-databinding
android-studio
androidgithubprojects
androidthings
androidx
androidx-xprocessing
anime
anko
announcements
apollo-kotlin
appintro
arabic
argentina
arkenv
arksemdevteam
armenia
arrow
arrow-contributors
arrow-meta
ass
atlanta
atm17
atrium
austin
australia
austria
awesome-kotlin
ballast
bangladesh
barcelona
bayarea
bazel
beepiz-libraries
belgium
berlin
big-data
books
boston
brazil
brikk
budapest
build
build-tools
bulgaria
bydgoszcz
cambodia
canada
carrat
carrat-dev
carrat-feed
chicago
chile
china
chucker
cincinnati-user-group
cli
clikt
cloudfoundry
cn
cobalt
code-coverage
codeforces
codemash-precompiler
codereview
codingame
codingconventions
coimbatore
collaborations
colombia
colorado
communities
competitive-programming
competitivecoding
compiler
compose
compose-android
compose-desktop
compose-hiring
compose-ios
compose-mp
compose-ui-showcase
compose-wear
compose-web
connect-audit-events
corda
cork
coroutines
couchbase
coursera
croatia
cryptography
cscenter-course-2016
cucumber-bdd
cyprus
czech
dagger
data2viz
databinding
datascience
dckotlin
debugging
decompose
decouple
denmark
deprecated
detekt
detekt-hint
dev-core
dfw
docs-revamped
dokka
domain-driven-design
doodle
dsl
dublin
dutch
eap
eclipse
ecuador
edinburgh
education
effective-kotlin
effectivekotlin
emacs
embedded-kotlin
estatik
event21-community-content
events
exposed
failgood
fb-internal-demo
feed
firebase
flow
fluid-libraries
forkhandles
forum
fosdem
fp-in-kotlin
framework-elide
freenode
french
fritz2
fuchsia
functional
funktionale
gamedev
ge-kotlin
general-advice
georgia
geospatial
german-lang
getting-started
github-workflows-kt
glance
godot-kotlin
google-io
gradle
graphic
graphkool
graphql
graphql-kotlin
graviton-browser
greece
grpc
gsoc
gui
hackathons
hacktoberfest
hamburg
hamkrest
helios
helsinki
hexagon
hibernate
hikari-cp
hire-me
hiring
hongkong
hoplite
http4k
hungary
hyderabad
image-processing
india
indonesia
inkremental
intellij
intellij-plugins
intellij-tricks
internships
introduce-yourself
io
ios
iran
israel
istanbulcoders
italian
jackson-kotlin
jadx
japanese
jasync-sql
java-to-kotlin-refactoring
javadevelopers
javafx
javalin
javascript
jdbi
jhipster-kotlin
jobsworldwide
jpa
jshdq
juul-libraries
jvm-ir-backend-feedback
jxadapter
k2-early-adopters
kaal
kafka
kakao
kalasim
kapt
karachi
karg
karlsruhe
kash_shell
kaskade
kbuild
kdbc
kgen-doc-tools
kgraphql
kinta
klaxon
klock
kloudformation
kmdc
kmm-español
kmongo
knbt
knote
koalaql
koans
kobalt
kobweb
kodein
kodex
kohesive
koin
koin-dev
komapper
kondor-json
kong
kontent
kontributors
korau
korean
korge
korim
korio
korlibs
korte
kotest
kotest-contributors
kotless
kotlick
kotlin-asia
kotlin-beam
kotlin-by-example
kotlin-csv
kotlin-data-storage
kotlin-foundation
kotlin-fuel
kotlin-in-action
kotlin-inject
kotlin-latam
kotlin-logging
kotlin-multiplatform-contest
kotlin-mumbai
kotlin-native
kotlin-pakistan
kotlin-plugin
kotlin-pune
kotlin-roadmap
kotlin-samples
kotlin-sap
kotlin-serbia
kotlin-spark
kotlin-szeged
kotlin-website
kotlinacademy
kotlinbot
kotlinconf
kotlindl
kotlinforbeginners
kotlingforbeginners
kotlinlondon
kotlinmad
kotlinprogrammers
kotlinsu
kotlintest
kotlintest-devs
kotlintlv
kotlinultimatechallenge
kotlinx-datetime
kotlinx-files
kotlinx-html
kotrix
kotson
kovenant
kprompt
kraph
krawler
kroto-plus
ksp
ktcc
ktfmt
ktlint
ktor
ktp
kubed
kug-leads
kug-torino
kvision
kweb
lambdaworld_cadiz
lanark
language-evolution
language-proposals
latvia
leakcanary
leedskotlinusergroup
lets-have-fun
libgdx
libkgd
library-development
linkeddata
lithuania
london
losangeles
lottie
love
lychee
macedonia
machinelearningbawas
madrid
malaysia
mathematics
meetkotlin
memes
meta
metro-detroit
mexico
miami
micronaut
minnesota
minutest
mirror
mockk
moko
moldova
monsterpuzzle
montreal
moonbean
morocco
motionlayout
mpapt
mu
multiplatform
mumbai
munich
mvikotlin
mvrx
myndocs-oauth2-server
naming
navigation-architecture-component
nepal
new-mexico
new-zealand
newname
nigeria
nodejs
norway
npm-publish
nyc
oceania
ohio-kotlin-users
oldenburg
oolong
opensource
orbit-mvi
osgi
otpisani
package-search
pakistan
panamá
pattern-matching
pbandk
pdx
peru
philippines
phoenix
pinoy
pocketgitclient
polish
popkorn
portugal
practical-functional-programming
proguard
prozis-android-backup
pyhsikal
python
python-contributors
quasar
random
re
react
reaktive
realm
realworldkotlin
reductor
reduks
redux
redux-kotlin
refactoring-to-kotlin
reflect
refreshversions
reports
result
rethink
revolver
rhein-main
rocksdb
romania
room
rpi-pico
rsocket
russian
russian_feed
russian-kotlinasfirst
rx
rxjava
san-diego
science
scotland
scrcast
scrimage
script
scripting
seattle
serialization
server
sg-user-group
singapore
skia-wasm-interop-temp
skrape-it
slovak
snake
sofl-user-group
southafrica
spacemacs
spain
spanish
speaking
spek
spin
splitties
spotify-mobius
spring
spring-security
squarelibraries
stackoverflow
stacks
stayhungrystayfoolish
stdlib
stlouis
strife-discord-lib
strikt
students
stuttgart
sudan
swagger-gradle-codegen
swarm
sweden
swing
swiss-user-group
switzerland
talking-kotlin
tallinn
tampa
teamcity
tegal
tempe
tensorflow
terminal
test
testing
testtestest
texas
tgbotapi
thailand
tornadofx
touchlab-tools
training
tricity-kotlin-user-group
trójmiasto
truth
tunisia
turkey
turkiye
twitter-feed
uae
udacityindia
uk
ukrainian
uniflow
unkonf
uruguay
utah
uuid
vancouver
vankotlin
vertx
videos
vienna
vietnam
vim
vkug
vuejs
web-mpp
webassembly
webrtc
wimix_sentry
wwdc
zircon
Powered by Linen
arrow
  • r

    rcd27

    05/28/2021, 8:21 AM
    Hello guys, trying to convert
    Retrofit
    responses to
    arrow-kt
    Either monad:
    class JSONRpcResponseEnvelopeConverter<T>(
        private val delegate: Converter<ResponseBody, JSONRpcResponseEnvelope<Any>>
    ) : Converter<ResponseBody, Either<Throwable, T>> {
    
        override fun convert(value: ResponseBody): Either<Throwable, T> {
            val response = delegate.convert(value)
            val error = response?.error
            return if (error == null) {
                Either.Right(
                    response?.result as T
                )
            } else {
                Either.Left(
                    InternalServerException(response.error)
                )
            }
        }
    }
    But it fails with:
    java.lang.RuntimeException: Failed to invoke private arrow.core.Either() with no args
    	at com.google.gson.internal.ConstructorConstructor$3.construct(ConstructorConstructor.java:113)
    	at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.read(ReflectiveTypeAdapterFactory.java:212)
    	at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$1.read(ReflectiveTypeAdapterFactory.java:131)
    	at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.read(ReflectiveTypeAdapterFactory.java:222)
    	at retrofit2.converter.gson.GsonResponseBodyConverter.convert(GsonResponseBodyConverter.java:40)
    	at retrofit2.converter.gson.GsonResponseBodyConverter.convert(GsonResponseBodyConverter.java:27)
    	at com.tochka.bank.npd.core.network.JSONRpcResponseEnvelopeConverter.convert(JSONRpcResponseEnvelopeConverter.kt:12)
    	at com.tochka.bank.npd.core.network.JSONRpcResponseEnvelopeConverter.convert(JSONRpcResponseEnvelopeConverter.kt:7)
    	at retrofit2.OkHttpCall.parseResponse(OkHttpCall.java:243)
    	at retrofit2.OkHttpCall$1.onResponse(OkHttpCall.java:153)
    	at okhttp3.internal.connection.RealCall$AsyncCall.run(RealCall.kt:519)
    	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
    	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
    	at java.lang.Thread.run(Thread.java:923)
    Caused by: java.lang.InstantiationException: Can't instantiate abstract class arrow.core.Either
    	at java.lang.reflect.Constructor.newInstance0(Native Method)
    	at java.lang.reflect.Constructor.newInstance(Constructor.java:343)
    	at com.google.gson.internal.ConstructorConstructor$3.construct(ConstructorConstructor.java:110)
    	... 13 more
    Maybe there are already proper converters for retrofit2 to arrow-kt?
    r
    8 replies · 2 participants
  • g

    Giovan

    05/31/2021, 10:38 AM
    Hi everyone. I started to learn arrow recently. I feel that arrow’s API changes frequently. So I chose to use 1.0.0-SNAPSHOT. But I found out that higher kinded types and some type classes are deprecated in this version!!! This is closer to kotlin primitive at the same time more different to haskell. Should I continue to learn on 1.0.0-SNAPSHOT ? And whether it is possible to publish the Roadmap for arrow? thanks🙏
    r
    5 replies · 2 participants
  • u

    ubu

    06/01/2021, 2:08 PM
    Hello guys. I’m new to Arrow and functional programming. Trying to find a way to create a copy of sealed class instance with some modification avoiding the following `when`s (in this case, I would like to update
    abstract val
    property):
    @optics
    sealed class TestArrow {
        abstract val isSelected : Boolean
    
        companion object {}
    
        @optics
        data class Test1(override val isSelected: Boolean, val fooBar1: String) : TestArrow() {
            companion object {}
        }
    
        @optics
        data class Test2(override val isSelected: Boolean, val fooBar1: String) : TestArrow() {
            companion object {}
        }
        @optics
        data class Test3(override val isSelected: Boolean,  val fooBar1: String) : TestArrow() {
            companion object {}
        }
    }
    
    fun TestArrow.updateSelected(isSelected: Boolean) : TestArrow {
        return when(this) {
            is TestArrow.Test1 -> this.copy(isSelected = isSelected)
            is TestArrow.Test2 -> this.copy(isSelected = isSelected)
            is TestArrow.Test3 -> this.copy(isSelected = isSelected)
        }
    }
    Any help will be very appreciated
    s
    7 replies · 2 participants
  • t

    thanh

    06/02/2021, 10:07 AM
    👋 It seems Kotlin Serialization (and probably other Kotlin compiler plugins) can by pass
    refined-type
    plugin. here is an example:
    @JvmInline
    @Serializable
    value class GameId private constructor(val value: String) {
        companion object : Refined<String, GameId>(::GameId, {
            ensure((it.length == 8) to "Expected $it has 8 characters")
        })
    }
    
    @Serializable
    data class Game(
        val gameId: GameId,
        val color: String,
    )
    
    fun main() {
        val json = """{"gameId":"abcd1234","color":"white"}"""
        println(Json.decodeFromString<Game>(json))
        val json2 = """{"gameId":"","color":"white"}"""
        println(Json.decodeFromString<Game>(json2))
    }
    Output:
    Game(gameId=GameId(value=abcd1234), color=white)
    Game(gameId=GameId(value=), color=white)
    Is this something we have to accept or should we put some require in
    init
    block?
    r
    r
    22 replies · 3 participants
  • j

    Jose Antonio Jimenez

    06/02/2021, 10:26 AM
    Hi, after updating to Arrow 0.13.2 i am getting this error using 
    shouldBeLeft
     of kotest 4.4.3:
    arrow.core.Either$Left.getA()Ljava/lang/Object
    s
    m
    +1
    10 replies · 4 participants
  • m

    Marko Novakovic

    06/02/2021, 11:31 AM
    I love 1st and 2nd part of this series -> https://www.47deg.com/blog/functional-domain-modeling-part-2/ when can we expect part 3?
    ❤️ 13
    s
    t
    +1
    6 replies · 4 participants
  • k

    kierans777

    06/03/2021, 4:52 AM
    I'm a new player to Arrow, however I've done some FP work before in JS using Crocks. My current project is porting a JS library using Crocks to Kotlin so Arrow really grabbed my interest. However I couldn't find an easy "beginners guide" to Arrow. The documentation does talk a lot about Monads which is great, but I'm after other documentation like how to compose functions together, and write point free functions. After doing some digging I managed to use
    f compose g
    in my code. However why is
    compose
    an infix function? That's the sort of documentation I'm after, and I'm hoping someone can point me in the right direction. 😄
    👍 1
    s
    4 replies · 2 participants
  • m

    Mitchell Skaggs

    06/05/2021, 8:25 AM
    Am I missing something, or can
    Getter<S,A>
    be contravariant on
    S
    ? I'm trying to use it in a contravariant way and it's not working in compositions. Having it contravariant in the original type would fix this.
    r
    s
    +1
    15 replies · 4 participants
  • r

    Roger Cyr

    06/05/2021, 3:03 PM
    Hi, I’m starting with Kotlin and was wondering what was the “go to” for dependency injection… I saw that Kotlin has classic “DI containers” but was wondering if Arrow provided a more FP solution. (Environmental effects à la ZIO, or a more classic approach à la ReaderT)
    r
    4 replies · 2 participants
  • m

    Mitchell Skaggs

    06/06/2021, 3:59 AM
    Unrelated other question: Is there an easier way to
    Option.lift
    an entire optic? I'm currently just lifting each function in an
    Iso
    individually, and it seems like that would be a useful function to have when creating lots of optics.
    s
    1 reply · 2 participants
  • r

    Roger Cyr

    06/06/2021, 4:31 PM
    I’m still very new to the language and trying to make sense of that https://arrow-kt.io/docs/effects/io/#suspend-r---a In other languages, “Persistence” would be a private variable inside the class, injected via constructor… and now in that example, Persistence and Repo are… “merged” together via delegation. What about method name conflicts, or even exposing things from Persistence that should remain hidden? What if I’m trying to model en “environment” where I need to have multiple “Repo”s?
    c
    a
    8 replies · 3 participants
  • c

    CLOVIS

    06/07/2021, 3:39 PM
    What is the clean way to shortcut execution based on a boolean value in an
    either
    block? I currently have:
    if (some condition) {
      val left: Either<Failure, DbUser> =
        UnknownFailure("some message here")
          .left()
      left.bind()
    }
    I would have just written
    if (some condition)
        UnknownFailure("message").left().bind()
    however, that casts the entire either block to
    Either<Failure, Nothing>.
    c
    k
    7 replies · 3 participants
  • c

    Cody Mikol

    06/07/2021, 4:16 PM
    Is there a good way to interop from
    Mono / Flux
    to
    Either / Validated
    ? I find the suspended handling of
    parZip / parTraverse
    to be much more intuitive than the Webflux functionalities
    s
    s
    3 replies · 3 participants
  • j

    Jimmy Alvarez

    06/09/2021, 1:56 AM
    I post a PR where i use
    Either.catch {}
    on some network calls, one comment was that using a
    try/catch
    is more explicit. how could you sell the idea that
    Either.catch {}
    is better than usual
    try/catch
    . For me, the way it looks y just clean, but they think the other way, for them is more clear an imperative style. I don’t wanna get back to
    try/catch
    😂
    g
    b
    8 replies · 3 participants
  • k

    kierans777

    06/09/2021, 6:27 AM
    This might be a bit noobish of me however I'm somewhat new to Kotlin. Why can I curry a lambda (or anonymous function) but not a named function? eg:
    fun add(a: Int, b: Int): Int = a + b
    val multiply: (Int, Int) -> Int = { a: Int, b: Int -> a * b }
    
    val add3 = add.curried()(3) // does not compile
    val multiply2 = multiply.curried()(2)
    Where this affects me is that I want to have a function that can take different parameter types eg: an Int or a String. Standard function overloading gets me out of this
    fun add(a: Int, b: Int): Int = a + b
    fun add(a: String, b: String): Int = add(Integer.parseInt(a), Integer.parseInt(b))
    However I lose the nice FP'ness ie: currying, composability, etc.
    m
    r
    5 replies · 3 participants
  • k

    kierans777

    06/09/2021, 11:15 AM
    Is there a nice way in Arrow to merge two Maps?
    r
    3 replies · 2 participants
  • m

    Marius Kotsbak

    06/09/2021, 2:21 PM
    We added this to our codebase:
    fun <A, B> Collection<Either<A, B>>.allLefts(): List<A> = this.mapNotNull { either -> either.fold({ it }, { null }) }
    Do you have any ideas for better ways to do it with Arrow or should something be added? Use case here is to not do short circuit, so we can't use traverseEither.
    r
    s
    +1
    5 replies · 4 participants
  • p

    Peter

    06/09/2021, 5:23 PM
    I’m wondering if anyone know if it’s possible to somehow “pattern match” based on generic type without nasty unchecked casts etc, eg: https://gist.github.com/peterfigure/4e587895ed56b0f0c4b1d59c45613608 Is there anything in Arrow that can help?
    r
    8 replies · 2 participants
  • g

    Garth Gilmour

    06/09/2021, 7:49 PM
    Getting used to 0.13 and all good. Except I can't find where the functionality formerly in Apply / Applicative has gone. Looking for ap, mapN, tupledN etc...
    p
    c
    +1
    6 replies · 4 participants
  • r

    raulraja

    06/10/2021, 10:24 AM
    A great example by @simon.vergauwen using the new Effect interface and arrow-continuations to create a DB effect block that can rollback transactions and handle DB results in the context of Either 👏 https://twitter.com/vergauwen_simon/status/1402897198296276992
    👏 7
    👌 2
    🎉 6
    💯 3
    t
    p
    +1
    4 replies · 4 participants
  • s

    Saiedmomen

    06/11/2021, 10:00 AM
    Typeclasses in site all return 404 and I can't find the definitions in the repo. Are they removed? If no can someone please direct me to their definitions?
    t
    1 reply · 2 participants
  • c

    Chris Paul

    06/14/2021, 11:25 AM
    how do people feel about lifting a value into a right() portion of an either prior to several chained flatmaps? eg
    return newStockItem.right()
        .flatMap { checkFirstThing(newStockItem) } 
        .flatMap { checkSecondThing(newStockItem) }
    vs
    return checkFirstThing(newStockItem)
        .flatMap { checkSecondThing(newStockItem) }
    I find the first a little more readable but does mean extra box operations.
    s
    5 replies · 2 participants
  • a

    Alexander Levin

    06/14/2021, 3:09 PM
    Hi. Is it possible to use suspend function for modify inside Arrow optic? Like:
    MyType.foo.bar.every.baz.modify(obj) { someSuspendFun(it) }
    t
    s
    5 replies · 3 participants
  • d

    dnowak

    06/15/2021, 2:27 PM
    Hi, I have a question about `Option`:
    @JvmStatic
        @JvmName("tryCatch")
        inline fun <A> catch(recover: (Throwable) -> Unit, f: () -> A): Option<A> =
          try {
            Some(f())
          } catch (t: Throwable) {
            recover(t.nonFatalOrThrow())
            None
          }
    Why recover is
    (Throwable) -> Unit
    not
    (Throwable) -> Option<A>
    ? Shouldn’t the caller decide if the exception should be mapped to
    None
    or
    Some
    ?
    t
    2 replies · 2 participants
  • p

    Pedro Sena

    06/15/2021, 5:15 PM
    Hey everyone, Are you aware of any good way to integrate
    @Transactional
    and
    Either
    ? Basically I'm using
    Either<Throwable, Something>
    as return type for many of my services and now I'd like to add transactional control through annotations instead of doing it manually (just recently integrated micronaut into the project) Do you have any tips on how(if possible) to accommodate both ?
    a
    d
    +1
    5 replies · 4 participants
  • p

    Pedro Sena

    06/15/2021, 5:15 PM
    (remembering that
    @Transactional
    depends on an exception being thrown to rollback the transaction, which does not happen because I wrap the exception on
    Left
    )
    r
    3 replies · 2 participants
  • k

    kierans777

    06/17/2021, 4:18 AM
    I've searched through the Slack channel however a lot of the discussion I found was in 2020 and I think Arrow has significantly changed since then. I'm hoping to get some help on how to do Kliesli compositions in Arrow. I have a data structure and a bunch of functions that operate on that data, which return an
    Either
    . For example
    (Int) -> Either<Error, Int>
    . I can use monandic comprehensions ie:
    val c = either {
      val a = func1(1).bind()
      val b = func2(a).bind()
    
      b
    }
    However I want to create a pipe/composition to remove the intermediate variables. In pseudo code
    val pipe = func2 composeK func1
    val c = pipe(1)
    Is this possible?
    p
    s
    13 replies · 3 participants
  • m

    Marcello Lelio Albano

    06/17/2021, 11:17 PM
    Hi, I'm trying to write a plugin using arrow meta that injects some code at the beginning of some functions. Is there a way to modify a KtNamedFunction bodyBlockExpression?
    p
    r
    10 replies · 3 participants
  • s

    stojan

    06/18/2021, 8:01 AM
    https://github.com/Kotlin/KEEP/blob/context-receivers/proposals/context-receivers.md
    ❤️ 3
    💯 4
    :arrow: 2
    m
    1 reply · 2 participants
  • j

    Jascha Smacka

    06/18/2021, 2:13 PM
    Hi! In our team we have been working with (and without) Arrow and FP in Kotlin for a while now. In one of our projects we are considering to lean upon Arrow quite a bit more than before and I was wondering: Is there some kind of "Arrow Ecosystem" - i.e. known libraries building upon Arrow - where we could look for further resources and inspiration? Also, we are also considering to extract a small library with immutable recursive data structures from one of our projects and make it open source. For historical reasons that library is not yet building upon Arrow but the first major version is planned to change that substantially. Once we are there (and all necessary hylomorphisms are implemented), we would of course also hope to become part of such an ecosystem (for feedback and bragging opportunities 😁)
    o
    r
    2 replies · 3 participants
Powered by Linen
Title
j

Jascha Smacka

06/18/2021, 2:13 PM
Hi! In our team we have been working with (and without) Arrow and FP in Kotlin for a while now. In one of our projects we are considering to lean upon Arrow quite a bit more than before and I was wondering: Is there some kind of "Arrow Ecosystem" - i.e. known libraries building upon Arrow - where we could look for further resources and inspiration? Also, we are also considering to extract a small library with immutable recursive data structures from one of our projects and make it open source. For historical reasons that library is not yet building upon Arrow but the first major version is planned to change that substantially. Once we are there (and all necessary hylomorphisms are implemented), we would of course also hope to become part of such an ecosystem (for feedback and bragging opportunities 😁)
o

Oliver Eisenbarth

06/19/2021, 6:30 PM
Maybe take a look at https://47degrees.github.io/helios.
❤️ 1
r

raulraja

06/20/2021, 9:12 AM
Hi @Jascha Smacka , Arrow’s ecosystem is currently the same as KotlinX Coroutines or Kotlin in general since it embraces suspension and continuations. This means you don’t need to choose libraries specific to Arrow for other purposes like serialization, persistence, you could just use for example KotlinX serialization, Exposed or any other libraries that integrate with
suspend fun
. There are no ambitions to compete against those as in most cases they are purely functional or offer a means to just use suspension which is equivalent as being wrapped in
IO[A]
plus the additional powers like direct syntax that continuations offer natively. In contrast to other langs like Scala where there is no native IO and most FP programs are written depending on heavy frameworks here instead we just rely on suspension. This means that if you want to make a library compatible with Arrow, you could definitely use Arrow to build and provide utilities like Either, comprehensions, parZip etc but if your library does not need those and you just use
suspend fun
for all IO related ops then it’s still compatible 100% with arrow and the rest of Kotlin’s libraries. In Scala and others the discipline is about writing code over F with the type class abstractions these libraries provide or sticking to the boxed data types framework like Zio pack. In Arrow the discipline is just use
suspend fun
when you need to perform IO or anything that need to be effect protected. IMO Kotlin already has better dependency injection and support for FP interoperability of libraries and programs through receiver funs, inline and suspension (eliminating transformers), compiler optimized continuations and soon multiple scoped functions which in my opinion cover most of the features you find in other Scala libraries in a boxed form, here in a more performant and ergonomic syntax.
👍 13
👌 1
👍🏻 1
View count: 9