https://kotlinlang.org logo
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
  • s

    simon.vergauwen

    09/03/2019, 2:59 PM
    It requires a
    fix()
    at the end, no?
    👍 1
    c
    • 2
    • 1
  • k

    kluck

    09/04/2019, 9:29 AM
    Hi, this might look like a noob question, I'm not even sure it isn't doable with the kotlin standard library… I'm looking to do a "simple" addition to a list, here's a simplified version of what I want:
    data class Item(val name: String, val quantity: Int)
    fun List<Item>.addItem(item: Item): List<Item> { ??? }
    listOf(Item("apple", 3), Item("Pear", 1)).addItem(Item("apple", 2) // -> expected : listOf(Item("apple", 5), Item("Pear", 1))
    What would be an FP version of
    addItem
    ?
    m
    t
    +2
    • 5
    • 11
  • r

    raulraja

    09/04/2019, 3:43 PM
    @noiano I would go to a terminal
    IO<Unit>
    then at the very edge where you need to perform the action you can call
    unsafeRunAsync
    or any other variation of that method to run the program. What
    attempt
    does is turn
    IO<A>
    into
    IO<Either<Throwable, A>>
    forcing the receiver of the last typed value to deal in composition with the fact that the operation may have failed with an exception which can be found in the Left
    n
    s
    • 3
    • 13
  • b

    Bob Glamm

    09/04/2019, 3:45 PM
    Tangentially related: I usually would
    flatmap
    over
    Dataset<C>
    ->
    IO<Unit>
    in this case, assuming that
    map
    is intended for applying pure functions. I think that is the expected usage for those?
    ☝️ 1
    s
    • 2
    • 1
  • p

    PhBastiani

    09/06/2019, 8:08 AM
    I would like to identify the UCs linked to the syntax
    inline reified
    in Arrow. For example, here :
    inline fun <reified F> Free<ForAnkOps, ListK<File>>.run(interpreter: FunctionK<ForAnkOps, F>, MF: Monad<F>): Kind<F, ListK<File>> =
    this.foldMap(interpreter, MF)
    intuitively, this syntax is needed to typeclass instance look up. But how ? I did not find this syntax described and used outside of Arrow.
    s
    • 2
    • 11
  • b

    Bob Glamm

    09/06/2019, 6:52 PM
    There is no way to thread the
    B
    type of
    use
    in
    bracketCase
    through the
    ExitCase.Completed
    part of
    release
    , is there?
    s
    • 2
    • 2
  • r

    raulraja

    09/10/2019, 1:58 PM
    @Bob Glamm I think the importance of Bracket becomes more apparent when you compare examples. For example the fact that coroutines are eager makes them an issue for error handling and safe resource release in some scenarios:
    b
    l
    s
    • 4
    • 42
  • p

    pakoito

    09/12/2019, 11:01 AM
    we'll be deploying a new version of the site soon
    p
    • 2
    • 1
  • n

    nhaarman

    09/16/2019, 11:24 AM
    Hi, I've noticed arrow-core 0.9+ isn't on maven central; the docs instruct to include a custom
    maven { url "<https://dl.bintray.com/arrow-kt/arrow-kt/>" }
    repository. Will arrow not be published to maven central anymore?
    r
    • 2
    • 8
  • d

    Danilo Herrera

    09/16/2019, 7:36 PM
    Basic usage question: How do I satisfy a concrete return type to
    Kind<F, A>
    ? For instance, I have a
    List<Animal>
    but want to return
    Kind<F, Animal>
    . Example:
    interface AnimalMapper<F> : MonadError<F, Throwable> {
    
        fun Kind<F, FarmDto>.toAnimalsFromNetwork(): Kind<F, Animal> = flatMap { farmDto ->
            catch {
                farmDto.animalDtos.map {
                    Animal(
                        it.id,
                        it.name
                    )
                }
            }
        }
    }
    This yields a type inference error. Expected
    Kind<F, Animal>
    , but found
    Kind<F, List<Animal>>
    k
    • 2
    • 1
  • d

    David

    09/17/2019, 12:40 AM
    Hey #arrow - I’m attempting to implement a new module in my android app using @Jorge Castillo’s
    tagless-final
    example shown here: https://github.com/JorgeCastilloPrz/ArrowAndroidSamples/tree/master/tagless-final. Since my mathematical understanding of fp is low (I’ve been learning via gcanti’s
    fp-ts
    library) and my understanding of corountines in Android also low I feel like I’ve bitten off more than I can chew! Having run into a few more fundamental problems, where is best to chat about the problems I’m hitting? Here or create an SO ticket?
    s
    • 2
    • 4
  • f

    Fred Friis

    09/18/2019, 12:48 AM
    correct me if i'm wrong, but the map it.fix won't be necessary in some newer versions of arrow right?
    t
    r
    • 3
    • 2
  • y

    Yeray Cabello

    09/18/2019, 7:56 AM
    Hello. Is it feasible to do a binding for Either that does not provide its own coroutine context? I'm working with a library that is not friendly to be enclosed in the binding because of that.
    r
    • 2
    • 57
  • l

    laimiux

    09/18/2019, 6:00 PM
    👋 anyone has type inference issues when using
    Either.left && Either.right
    within a
    RxJava
    . For example request.map { Either.right(it) }.onErrorReturn { Either.left(it) }` doesn’t compile
    p
    • 2
    • 6
  • t

    thanh

    09/18/2019, 6:12 PM
    I think you need to cast like
    request.map { Either.right(it) as Either<E,A>}.onErrorReturn { Either.left(it) }
    p
    • 2
    • 3
  • t

    thanh

    09/19/2019, 5:59 AM
    I have some helper functions to make life easier when working with Either and RxJava: https://github.com/lenguyenthanh/RxArrow. Hope that can help you @laimiux.
    ❤️ 1
    p
    • 2
    • 2
  • y

    Yeray Cabello

    09/19/2019, 6:49 AM
    Hello. Is there any design reason for Either.flatMap and Either.map not being inline anymore (it was inline in 0.8.2 and it isn't in 0.10.0)? It has become unfriendly to suspending functions after that.
    p
    r
    • 3
    • 122
  • p

    pakoito

    09/19/2019, 9:02 AM
    https://github.com/arrow-kt/arrow/issues/1609
    👍 2
    t
    • 2
    • 1
  • p

    pakoito

    09/20/2019, 12:53 PM
    oh god that API
    p
    • 2
    • 1
  • p

    Pedro Silva

    09/20/2019, 2:14 PM
    If I use the
    fun CompletionStage<V>.asIO(): IO<V> = IO.async
    then I won't be able to have
    fun <V> startThings(a: Async<V>) = object : MemSource<V>, Async<V> by a
    . What am I missing that connects
    IO<F>
    to
    Async<F>
    ?
    s
    b
    • 3
    • 24
  • d

    Danilo Herrera

    09/20/2019, 2:59 PM
    Hello, hello! How do we switch CoroutineContexts within
    IO.fx { ... }
    ? I tried starting the block with
    continueOn(<http://Dispatchers.IO|Dispatchers.IO>)
    but for some reason it hangs.
    b
    p
    r
    • 4
    • 26
  • p

    PhBastiani

    09/20/2019, 3:18 PM
    Hello all. I published a GIST (internal use at this stage but public in a near future) about my attempt to write a short DSL with Λrrow Free ! In the future, I'll write more articles for my team to feel better with Λrrow. What do you think about this format ? Feedback are wellcome to improve this draft... Thx to Λrrow team members for their help 😍 https://gist.github.com/PBastiani/26d8734ff33001cb0304df337ea936a1
    👌🏽 4
    r
    p
    • 3
    • 5
  • s

    Satyam Agarwal

    09/24/2019, 8:29 AM
    @simon.vergauwen I was wondering your parTraverseN with semaphore solution made it to 0.10.0 ? I am using what you helped with now, if its there already, then I’ll just remove it ?
    s
    • 2
    • 16
  • b

    Bob Glamm

    09/25/2019, 8:08 PM
    w.r.t. Scala about half of the Cats guys have moved over to Metals + LSP-capable editor
    r
    • 2
    • 10
  • r

    raulraja

    09/27/2019, 11:19 AM
    https://www.raywenderlich.com/9527-functional-programming-with-kotlin-and-arrow-getting-started
    👁️ 4
    🤩 5
    ❤️ 2
    :kotlin-flag: 11
    d
    p
    +2
    • 5
    • 4
  • p

    pakoito

    09/29/2019, 3:53 PM
    that looks okay to me, it’s
    io.map { ei -> ei.map { l -> l.map { b -> toC(b) } } }
    j
    y
    r
    • 4
    • 45
  • s

    stojan

    09/29/2019, 4:36 PM
    quick question about ANK let's say I have a sealed class in a code snippet:
    sealed class ValidationResult<out E, out A> {
        data class Valid<A>(val a: A) : ValidationResult<Nothing, A>()
        data class Invalid<E>(val e: E) : ValidationResult<E, Nothing>()
    }
    And I want to use `Valid`/`Invalid` without prefixing with
    ValidationResult
    . How can I do that... I tried
    import ValidationResult.Valid
    import ValidationResult.Invalid
    but it doesn't work.... Error I am getting is (when trying to use just `Valid`:
    error: unresolved reference: Valid
                if (a is Valid && b is Valid) valid(f(a.a, b.a))
    i
    r
    • 3
    • 20
  • r

    raulraja

    10/01/2019, 10:56 AM
    tail recursion only makes sense in Monads that blow the stack like List, Option, Either, etc… Async monads are stack safe because they trampoline when they run. If you look at the IO ADT you see all those flatMap and binds are nothing but creating a data structure that unfolds into a terminal value when you run IO at the edge. This value can be calculated by async or concurrent processes that would scape the stack.
    tailrec
    is designed so that recursive functions don’t blow up the stack but all async monads like IO are safe because they jump out of the stack before it fills up by moving the computation into the heap via ADTs and classes that hold computations in memory.
    s
    • 2
    • 1
  • s

    stojan

    10/01/2019, 7:47 PM
    can I use fx block with
    Kind<F, Option<Something>>
    where
    F
    is
    MonadError
    ? (arrow 0.10)?
    b
    p
    r
    • 4
    • 12
  • t

    thanh

    10/02/2019, 2:24 PM
    I'm using Arrow in production, but only Arrow's data types now.
    d
    c
    j
    • 4
    • 3
Powered by Linen
Title
t

thanh

10/02/2019, 2:24 PM
I'm using Arrow in production, but only Arrow's data types now.
d

dcampogiani

10/02/2019, 2:24 PM
same here
👍 2
:arrow: 3
c

carbaj0

10/02/2019, 2:39 PM
I have included effects
:arrow: 4
j

Jose Antonio Jimenez

10/03/2019, 11:09 AM
Using Fx too
View count: 3