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

    jacob

    05/03/2019, 6:36 PM
    or getting rid of kapt a la keep-87? 😛
    p
    • 2
    • 1
  • k

    kitttn

    05/04/2019, 12:44 PM
    hi guys! any plans adding support to channels or kotlins Flow? still waiting for kinda viable approach to replace reactive streams (rx2).
    p
    • 2
    • 2
  • s

    streetsofboston

    05/04/2019, 1:08 PM
    Ah, because it helps model the
    IO
    type better?
    k
    • 2
    • 2
  • r

    Ryan Benasutti

    05/05/2019, 3:48 AM
    Why was ΛNK archived?
    i
    s
    • 3
    • 3
  • s

    simon.vergauwen

    05/05/2019, 1:50 PM
    Hi @kitttn. As a temporary measure to prepare for mpp the jvm instances for IO fx can be found in
    arrow-effects-io-extensions
    .
    k
    • 2
    • 2
  • j

    jacob

    05/05/2019, 3:12 PM
    thanks 🙂 added a PR
    ❤️ 1
    r
    j
    • 3
    • 5
  • s

    Sergio Crespo Toubes

    05/09/2019, 7:41 AM
    This is the result
    unsafe {
        runBlocking {
            fx {
                val posts = !mPostsApi.getPosts(authToken)        
                mView.showPosts(posts)
            }.handleError {
                Main.shift().map { mView.showGenericErrorAlert() }
            }
        }
    }
    p
    • 2
    • 16
  • j

    jacob

    05/11/2019, 3:37 PM
    not quite ready to demo, but getting close
    👏 1
    p
    • 2
    • 8
  • g

    Garth Gilmour

    05/11/2019, 9:19 PM
    Trying to install the KEEP87 plug-in on latest version of CE (2019.1). The install progress bar runs, but after restart the plug-in does not appear and hence the sample project will not compile. Any thoughts much appreciated…
    j
    • 2
    • 4
  • i

    Imran/Malic

    05/12/2019, 4:55 PM
    Does anyone know how to create a kotlin file programmatically?
    k
    • 2
    • 3
  • j

    jacob

    05/13/2019, 1:00 PM
    possible something is broken on the docs site
    c
    • 2
    • 7
  • s

    starke

    05/15/2019, 5:31 PM
    hello! I have a (hopefully) simple question regarding dealing with multiple
    Option
    values
    val option1 = Option.just("foo")
        val option2 = Option.just(1)
        val option3 = Option.just(Bar())
    
        val result: Option<FooBar> = option1.flatMap { unwrappedValue1 ->
            option2.flatMap { unwrappedValue2 ->
                option3.map { unwrappedValue3 ->
                    FooBar(unwrappedValue1, unwrappedValue2, unwrappedValue3)
                }
            }
        }
    }
    what is a better way to handle the use case where you want to return an
    Option
    that is, for example, a composite of multiple other types that are wrapped by
    Option
    I would like the resulting
    Option
    to be
    None
    if any of the other values are
    None
    , otherwise return
    Some
    that is a composite of the data from the other `Option`s…if that makes sense?
    • 1
    • 1
  • r

    Robert Menke

    05/17/2019, 5:38 PM
    Hey, it seem like when using
    Try
    it’s common to want to write to a log if an exception occurs. I’ve currently been using a pattern like the following, but I’m curious if there’s a more succinct or abstract way I can go about this:
    Try { db.update(model) }
       .toEither {
           logger.error("My message", it.localizedMessage)
           it
       }
       .fold(
           { /*handle failure*/ },
           { /*handle success*/ }
        )
    Thoughts on how to better handle this?
    g
    • 2
    • 3
  • r

    raulraja

    05/17/2019, 5:57 PM
    Heads up,
    Try
    is impure.
    d
    p
    • 3
    • 2
  • s

    simon.vergauwen

    05/17/2019, 6:05 PM
    So hopefully that will also help you passed the tricky bits. Feedback and questions are always welcomed here 🙂
    r
    • 2
    • 1
  • d

    Derek Berner

    05/17/2019, 7:58 PM
    So if a suspend function with side effects is pure, but its invocation is not, is that not also true of a non-suspending function with side effects?
    r
    • 2
    • 3
  • c

    ciriti

    05/18/2019, 1:13 PM
    Thanks a lot @jacob and @pakoito!!!
    j
    • 2
    • 1
  • r

    raulraja

    05/20/2019, 6:55 PM
    We need a Kotlin serialization interop module for arrow data types so we can provide all that boilerplate to users
    d
    • 2
    • 3
  • r

    raulraja

    05/20/2019, 7:45 PM
    For those of you in Madrid or nearby https://twitter.com/raulraja/status/1130472054816464896
    :arrow: 1
    s
    • 2
    • 1
  • j

    Jorge Castillo

    05/22/2019, 1:58 PM
    Our aim is to support MPP by the end of the year, before releasing 1.0.0. There’s still roadmap to get there but we aready got people putting time into that so hopefully we can meet the deadline 🙂
    c
    • 2
    • 2
  • b

    Bob Glamm

    05/22/2019, 4:05 PM
    I’ve duct-taped OCaml to NodeJS
    😳 3
    p
    • 2
    • 2
  • s

    simon.vergauwen

    05/23/2019, 3:12 PM
    Try.applicative().map(a(), b()) { a, b -> .. }
    this should work 🙂
    d
    • 2
    • 5
  • p

    pakoito

    05/23/2019, 10:44 PM
    @Francesco megna https://github.com/JorgeCastilloPrz/ArrowAndroidSamples/tree/jc-upgrade-to-0.9.0-fx
    f
    • 2
    • 1
  • j

    Joan Colmenero

    05/24/2019, 1:26 PM
    And one with MVP?
    s
    j
    • 3
    • 5
  • r

    raulraja

    05/26/2019, 10:02 PM
    @Derek Berner @Bob Glamm If
    objectMapper.convertValue
    can fail with an exception then it should be suspended and you should be using
    IO
    instead of
    Try
    . Try is going away or going to be modified because it can’t suspend effects or run suspend functions. If we make Try support suspend then we have IO. On a different token you can encode internally all your error handling efforts including validation without implying fail fast or error accumulation and then export a la carte in your public API the error strategies for each data type that you want to support. This link supports with the same code both fail fast and error accumulation https://arrow-kt.io/docs/patterns/error_handling/#example--alternative-validation-strategies-using-applicativeerror
    d
    b
    • 3
    • 53
  • t

    Tom Hall

    05/28/2019, 10:40 AM
    I've been reading Scala with Cats (https://books.underscore.io/scala-with-cats/scala-with-cats.pdf) - would that be a good intro? (it seems to me that Arrow is very similar to Cats)
    r
    • 2
    • 2
  • s

    simon.vergauwen

    05/28/2019, 11:09 AM
    The fact that this is possible is because of the lazyness. We describe a program with Fx and translate (interpret) it to a runtime (Rx, Reactor, IO).
    👍 1
    🔝 3
    s
    • 2
    • 1
  • r

    raulraja

    05/28/2019, 8:18 PM
    IO_validation.kt
    :arrow: 2
    d
    • 2
    • 5
  • p

    pakoito

    05/29/2019, 1:27 PM
    I believe Scala's Red Book has some too
    s
    • 2
    • 2
  • n

    noiano

    05/29/2019, 2:27 PM
    newbie question: I have a method which returns Unit because it just writes out a file … such method can obviously fail is something goes wrong… I’ve used Try<Unit> to capture this … it doesn’t feel quite right 😅
    p
    r
    • 3
    • 9
Powered by Linen
Title
n

noiano

05/29/2019, 2:27 PM
newbie question: I have a method which returns Unit because it just writes out a file … such method can obviously fail is something goes wrong… I’ve used Try<Unit> to capture this … it doesn’t feel quite right 😅
p

pakoito

05/29/2019, 4:30 PM
As Derek said, what you're doing is described as an effect. It's a side-effect in the sense that you're changing the world, in this case writing a file, but you'd like for that side effect to be pure, composable, error handling and all things nice. Wrapping a side-effect makes it what we call an effect. Try has most of those properties but fails one, it isn't deferred and gets executed immediately. Others like IO and Observable do have the same properties of Try, and laziness on top. Fun thing is, suspend functions also behave the same way. So at some point instead of composing Try inside suspend functions or IO or Observable, you just use those everywhere in a way that's compatible and consistent. And this reason is why we're going to phase out Try over time. We want the effect APIs to be used to prevent IO<Try<A>> or suspend fun bla(): Try<A> just for error handling
r

raulraja

05/29/2019, 7:34 PM
@noiano complementing all that Paco said here is an example of using IO for safe resource acquisition and release which is similar to your file use case. (Posting file outside this thread)
👏 1
n

noiano

05/30/2019, 1:55 PM
thank you very much for your answers ….
I actually did want to have a synchronous evaluation because I was invoking a spark action … I needed to be synchronous .. I’m now reading whether IO supports synchronous invocation
r

raulraja

05/30/2019, 2:11 PM
IO is heavily optimized for synchronous invocations
all effects are synchronous unless you move to new pools
n

noiano

05/30/2019, 2:57 PM
ook … I’ll check out the docs … basically try.invoke is similar to IO.invoke for what concerns synchronous invocation, right?
p

pakoito

05/30/2019, 2:58 PM
yes
n

noiano

05/30/2019, 2:59 PM
thank you 🙂
View count: 5