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
  • m

    Matt Thiffault

    10/02/2019, 10:15 PM
    @raulraja Cool, I'm also relatively new to Kotlin so I didn't realize compiler plugins are a common thing. Though we don't use gradle where I work, so I'll have to figure out how to get it working in our build system.
    i
    r
    p
    • 4
    • 12
  • l

    laimiux

    10/03/2019, 5:56 PM
    👋 “quick question”, maybe someone in this channel can help answer, how does Kotlin typeclass proposal compare to Swift’s protocols?
    p
    • 2
    • 6
  • t

    Tolegen Izbassar

    10/06/2019, 12:15 PM
    Hi, does somebody have correct version of
    jackson
    de-serializer for the
    Option
    type? https://stackoverflow.com/questions/58257121/how-to-write-custom-jackson-deserializer-in-kotlin-for-arrows-option
    n
    • 2
    • 3
  • k

    kvothe

    10/07/2019, 3:26 PM
    Hi! Someone has a minute this evening for a quick 1:1 to help me contribute to Arrow :arrow: ? 🙂
    i
    r
    • 3
    • 7
  • m

    Matt Thiffault

    10/07/2019, 8:31 PM
    Do I need to make the function suspending and make the recursive call in an effect block or something?
    p
    r
    • 3
    • 11
  • m

    Matt Thiffault

    10/07/2019, 8:37 PM
    If I change my recursive call to
    !effect { ioRecurseNTimes(n - 1) }.bind()
    , I don't get a stack overflow but everything seems to slow down and my CPU starts to work really hard after about 400k recursions.
    p
    r
    • 3
    • 20
  • s

    stojan

    10/07/2019, 9:00 PM
    https://stackoverflow.com/questions/58243913/arrowkt-optics-annotation-not-generating-code/58267910?noredirect=1#comment102919970_58267910 The annotation and empty companion should do the trick right?
    👍🏼 1
    p
    • 2
    • 1
  • r

    Ryan Benasutti

    10/08/2019, 12:43 AM
    Any database recommendations for something that would work well with Arrow?
    p
    j
    s
    • 4
    • 8
  • j

    Joram Visser

    10/08/2019, 7:37 AM
    In my use case, I do not control the main fun. The endpoint is an HttpTrigger in an Azure Function App.
    s
    • 2
    • 4
  • m

    Matt Thiffault

    10/08/2019, 7:44 AM
    Is there a safe version of unsafeRunTimed? Something that will run an IO action with a timeout but return an IO<Option<A>>?
    s
    • 2
    • 3
  • p

    pakoito

    10/09/2019, 11:02 AM
    @jereksel wanted to do it, but with compiler plugins coming he decided to close it for now: https://github.com/arrow-kt/arrow/pull/1647
    👍 1
    s
    r
    • 3
    • 2
  • b

    Bob Glamm

    10/09/2019, 3:32 PM
    weird, Arrow-0.8.2/0.9.0 does funny things with IntelliJ map literals:
    r
    • 2
    • 6
  • p

    pakoito

    10/09/2019, 5:18 PM
    or ReaderT
    s
    r
    • 3
    • 5
  • p

    pakoito

    10/09/2019, 5:41 PM
    instead of the JUnit4 one? We upgraded at some point, never looked back
    s
    r
    • 3
    • 5
  • m

    Matt Thiffault

    10/10/2019, 6:47 PM
    So I'm trying to do something a bit tricky. I want to send a message on a Channel to another coroutine, and then wait for a response. However if the response is sent before the sender starts listening, the message will be dropped. So I can't really send the message first and then start listening, as the other coroutine could reply first (race condition). With standard coroutines I'd likely do something like:
    val deferredReply = async { startListening(replyChannel) }
    sendChannel.send(message)
    val reply = defferedReply.await()
    What would be the idomatic way to do this with Arrow? Is it asyncF I'm looking for?
    p
    • 2
    • 1
  • p

    pakoito

    10/11/2019, 10:48 AM
    @extension interface Bla<T> {
      fun showLogin(par: T): ReaderT<ForIO, Context, Unit> = ... // some ugly ReaderT blob
    }
    d
    • 2
    • 1
  • s

    Stian N

    10/11/2019, 10:51 AM
    Sorry for disturbing the discussion but I have question regarding the use of a group of Eithers. Is List<Either<a,b>> an anti-pattern? If not, how do you handle the left cases in a good way? Let's say that if one of the Eithers is left I want to stop and bubble the Left?
    p
    b
    • 3
    • 18
  • a

    alilosoft

    10/12/2019, 12:08 PM
    Hi! I found the following question by @johangwbasson on Gitter and I'm interested to know the answer but its not answered yet! so I forwarded it here:
    Good day. I'm new to functional programming and the arrow library and was wondering if anybody can help me.
    I was wondering how one handles resources like database pools or connections and how you pass them to a function. For instance: Let say I have an authenticate method:
    fun authenticate(username: String, password: String): Either<Error, Token> {
    // validation etc ..
    val user = getUserByUsername(username)
    }
    fun getUserByUsername(username: String): Option<User> {
    // JDBC Query for user
    val rs = con.prepareStatement("SELECT * FROM user .....")
    ....
    val user = mapRowToUser(rs) // etc
    return Option.fromNullable(user)
    }
    My question is do I pass in the connection of database pool as a parameter like so:
    fun authenticate(con: Connection, username: String, password: String) ....
    fun getUserByUsername(con: Connection, username: String): Option<User>  ...
    What is the best practice when it comes to functional programming?
    Also from what I have read and if my understanding is correct, this is impure and normally IO would be used?
    fun getUserByUsername(username: String): IO<Option<User>>
    Is this correct? Any help appreciated
    PS: I think it could be better if a link to this channel is added to Arrow-kt.io web site home page.
    t
    • 2
    • 2
  • j

    jimn

    10/13/2019, 10:24 AM
    i was reading about factor programming language again to check in on how it has matured over the years, and these Kotlin-Arrow discussions seem to be revisiting the functional elements of concatenative programming but held back by kotlin basic underpinnings. Factor compiles to native, but afaic anything that emits llvm IR is as native as it needs to be. so what are thoughts and dispositions of Arrow-kt as a standalone collection of idioms with Kotlin's coroutines, bindings, and serialization, but a clean seperation from the kotlin grammars via an llvm front-end for Arrow?
    a
    • 2
    • 2
  • p

    pakoito

    10/13/2019, 11:33 AM
    the alternative is learning what hoisting and a temporal dead zone is when moving to Javascript, how a CoroutineScope and CoroutineErrorHandler interact together in Kotlin, what @asynccontextmanager does in Python, decipher what function of CompletableFuture corresponds to mapping a value, or how to safely compose Futures in Scala
    j
    • 2
    • 15
  • g

    girafferson

    10/13/2019, 5:32 PM
    If I want to try out keep-87, should I build the Kotlin fork and add it to my project?
    p
    m
    r
    • 4
    • 6
  • m

    Matt Thiffault

    10/13/2019, 5:34 PM
    Wow, I'm trying to write camera control code for Android in a functional style...but using Optics/Lenses is hard without running into name clashes/ambiguities 😛
    s
    f
    s
    • 4
    • 4
  • s

    simon.vergauwen

    10/14/2019, 11:52 AM
    There shouldn’t be any need for fiber and bracket.
    IO
    can run in a cancellable way with a cancelable reference
    typealias Disposeable = () -> Unit
    . Whenever the coroutine gets cancelled you can also cancel the underlying
    IO
    using that reference.
    fun <A> IOOf<A>.suspendCancellable() : Either<Throwable, A> =
     suspendCancellableCoroutine { continuation ->
        val disposable = fix().unsafeRunSyncCancellable {  continuation.resume(it) }
        continuation.invokeOnCancellation { disposable.invoke() }
      }
    t
    • 2
    • 1
  • s

    simon.vergauwen

    10/14/2019, 11:57 AM
    If people are interested in starting
    arrow-android
    we’d love to help people get started with any help they need 🙂
    👍 9
    d
    t
    +2
    • 5
    • 24
  • r

    raulraja

    10/14/2019, 9:36 PM
    This Friday @simon.vergauwen and I are gonna be rocking the big stage presenting Arrow Meta to many FP folk from different languages in Lambda World. Hope to see a few of you there. For the rest please watch the video if you are interested in meta. This unlocks metaprogramimg and a set of new possibilities for Kotlin and the tooling ecosystem including IDE integration https://twitter.com/raulraja/status/1183855903692472328?s=19
    :arrow: 6
    🎉 3
    s
    s
    • 3
    • 2
  • p

    pakoito

    10/15/2019, 2:10 PM
    the recording of my talk about the state of the ecosystem in Sept 2019 is available now: https://twitter.com/pacoworks/status/1184090662779674632
    🔝 7
    :arrow: 17
    a
    j
    a
    • 4
    • 17
  • p

    pakoito

    10/16/2019, 10:22 AM
    one easy ticket, if someone wants that Hacktoberfest shirt 😄 https://github.com/arrow-kt/arrow/issues/1717
    k
    • 2
    • 3
  • b

    Bob Glamm

    10/16/2019, 2:10 PM
    Then you'd get an
    Either<Throwable, Unit>
    y
    r
    • 3
    • 4
  • p

    pakoito

    10/16/2019, 2:15 PM
    or
    .handleErrorWith { IO { log(it) }  }
    if it's an effect
    y
    • 2
    • 3
  • i

    Imran/Malic

    10/17/2019, 2:31 PM
    Do we have Laarhoven Lenses in Arrow?
    • 1
    • 2
Powered by Linen
Title
i

Imran/Malic

10/17/2019, 2:31 PM
Do we have Laarhoven Lenses in Arrow?
Or is it whenever we’re using P<something> e.g.:
PIso
💪🏽 We do
View count: 3