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

    Derek Berner

    05/29/2019, 2:31 PM
    FWIW,
    Try<Unit>
    is wrong but it's only because
    Try
    is soon to be deprecated, not because of the Unit type param.
    e
    • 2
    • 3
  • b

    Bob Glamm

    05/29/2019, 7:34 PM
    with LOG & s3 being abstract vals in the interfaces
    r
    • 2
    • 23
  • r

    raulraja

    05/29/2019, 7:35 PM
    Since we are getting more traction lately we should start using threads since there is a lot of cross posting xD
    :stackoverflow: 1
    :arrow: 2
    d
    • 2
    • 1
  • b

    Bob Glamm

    05/30/2019, 1:02 PM
    That small example of S3 + logging I wrote yesterday might be suitable as a demonstration of a practical use-case, as it (potentially) demonstrates moving from Spring DI to composable algebras using Arrow without any framework
    :arrow: 2
    s
    • 2
    • 1
  • s

    sam

    05/31/2019, 2:22 AM
    This is a project that 20 people have spent 2 years working on - it's all kotlin, spring, spring-mvc, jpa, hibernate. Basically your typical enterprise java app but in Kotlin. It's well written, well tested. I've just spent 8 years doing Scala full time and this is now my first Kotlin role and I'm finding it hard to justify ditching spring, etc and doing things in a more functional way. Arrow is just one part of that. No one uses any of that stuff in Scala land.
    d
    • 2
    • 31
  • r

    raulraja

    05/31/2019, 11:33 AM
    Kotlin already supports DI with delegation and extension functions natively. Not sure why people insist on using DI with a runtime container. An example of DI with delegation and another one with type arg constrains: https://gist.github.com/raulraja/97e2d5bf60e9d96680cf1fddcc90ee67
    t
    d
    b
    • 4
    • 30
  • s

    sam

    05/31/2019, 11:54 AM
    What would you use for configuration loading? Equiv of pureconfig for scala basically
    d
    • 2
    • 19
  • s

    sam

    05/31/2019, 8:06 PM
    This is a minor thing, but I find
    Option.fromNullable
    to be very verbose. Isn't the point of option that you may or may not have a nullable value, and so shouldn't Option(t) accept a nullable ?
    s
    p
    r
    • 4
    • 49
  • p

    pakoito

    06/02/2019, 1:09 AM
    ReaderT.monad<F, AccountRepository<F>>(this).tupled(debit(from, amount), credit(to, amount))
    s
    • 2
    • 1
  • p

    pakoito

    06/02/2019, 1:58 AM
    if B doesn’t depend on A then use
    applicative().map(val1, val2, val3) { a, b, c -> SomeClass(a, b, c) }
    s
    s
    • 3
    • 3
  • p

    pakoito

    06/02/2019, 9:07 AM
    in both cases there’s no way of generating an
    a
    of type
    Int
    from the
    Invalid
    origin, so those lambdas that you pass cannot be called and the internal function calls won’t execute to create a new Validated that accumulates errors
    s
    • 2
    • 19
  • s

    sam

    06/02/2019, 10:36 PM
    What dependency do I need for
    arrow.data.extensions.option.monad.binding
    r
    • 2
    • 3
  • s

    sam

    06/03/2019, 10:32 AM
    I notice that
    val (nuke) = arm()
    if you remove the parenthesis it fails to extract
    p
    • 2
    • 7
  • s

    snackycracky

    06/03/2019, 10:42 AM
    hey @raulraja 🙂 what was the intention for https://github.com/arrow-kt/arrow-ktor ?
    r
    • 2
    • 2
  • r

    raulraja

    06/03/2019, 2:57 PM
    fun validateExpiryDate(date: LocalDate): ValidatedNel<ValidationError, LocalDate> =
      if (logic) date.validNel() else Expired.invalidNel()
    s
    • 2
    • 2
  • r

    raulraja

    06/03/2019, 3:02 PM
    import arrow.data.extensions.validated.apply.map
    s
    • 2
    • 8
  • r

    raulraja

    06/03/2019, 3:09 PM
    so it returns
    this
    and does not delegate to the platform dependent trace stuff
    s
    • 2
    • 1
  • r

    raulraja

    06/03/2019, 3:10 PM
    fun <A> Try<A>.toValidatedNel(): ValidatedNel<Throwable, A> =
      fold({ it.invalidNel() }, { it.validNel() })
    • 1
    • 1
  • s

    sam

    06/03/2019, 3:11 PM
    Is that predefined ?
    r
    d
    • 3
    • 11
  • s

    sam

    06/03/2019, 3:16 PM
    ok, so in that other method, same question
    b
    r
    +2
    • 5
    • 283
  • p

    pakoito

    06/04/2019, 7:41 AM
    I did a talk about “Headless Android development” where I go through an app, refactor it, and then test it completely from the JVM on the Kotlin REPL. Sadly it wasn’t recorded, so you’ll need to follow the slides, the demo, and the snippet that came with it: https://www.pacoworks.com/2017/03/16/headless-development-at-mobos-librarymaking-updates-and-plans-for-2017-2/
    s
    • 2
    • 1
  • s

    simon.vergauwen

    06/04/2019, 7:42 AM
    Hi @earroyoron, Raul gave a talk on this https://www.47deg.com/presentations/2018/06/08/better-types-fewer-tests/. I don’t think it was recorded tho. Jullian Traffaut also did a couple of presentations but I have not checked out recording and focuses more on theory than practice compared to Raul’s https://github.com/julien-truffaut/types-vs-tests.
    s
    • 2
    • 1
  • s

    sam

    06/04/2019, 12:28 PM
    what's the goal of non-fx arrow
    😄 1
    p
    • 2
    • 1
  • s

    sam

    06/04/2019, 12:45 PM
    So, in summary, if the goal is that you want to focus on pure constructs only, that's a good goal, but one that isn't going to work for me (not that I expect your project to focus on me only) but I do think that 99% of kotliners are coming from a Java background, and making it as accessible as possible is important. And what I mean by that is allowing impure FP as a stepping stone.
    s
    d
    • 3
    • 86
  • s

    simon.vergauwen

    06/04/2019, 12:45 PM
    suspend fun foo()  = start().flatMap { a ->
       bar(a).flatMap { b ->
         update(b).map { result(c) 
       }
    }
    s
    • 2
    • 1
  • r

    raulraja

    06/04/2019, 2:22 PM
    @sam you can always call the function like that inside
    suspend
    we may even lift that restriction in
    fx
    down the road but in whatever case the biz about getting rid of Either is that IO is gonna be soon
    IO<E, A>
    so you don't need
    Either
    because you can do
    just(a)
    or
    raiseError(e)
    and that is the same as Either. You can also do
    raiseError(exception)
    .
    d
    s
    k
    • 4
    • 36
  • d

    Derek Berner

    06/04/2019, 3:07 PM
    So that concerns me. Even well tested, "pure" code could throw an OutOfMemoryError
    s
    • 2
    • 14
  • r

    raulraja

    06/04/2019, 9:27 PM
    https://twitter.com/arrow_kt/status/1135961780377726976?s=19
    :arrow: 10
    r
    s
    • 3
    • 6
  • i

    Imran/Malic

    06/05/2019, 2:34 PM
    @Derek Berner good question. Look here https://kotlinlang.slack.com/archives/C5UPMM0A0/p1520103294000092
    d
    r
    • 3
    • 24
  • r

    Robert Menke

    06/05/2019, 9:35 PM
    Sort of random, but something in the #compose channel made me think of this. Do you think the arrow stdlib should include something like compose or andThen as utility functions?
    //left to right
    infix fun <A, B, C> ((A) -> B).andThen(right : (B) -> C) : (A) -> C = {
        arg -> right(invoke(arg))
    }
    
    //right to left
    infix fun <A, B, C> ((B) -> C).compose(right : (A) -> B) : (A) -> C = {
        arg -> invoke(right(arg))
    }
    s
    p
    d
    • 4
    • 9
Powered by Linen
Title
r

Robert Menke

06/05/2019, 9:35 PM
Sort of random, but something in the #compose channel made me think of this. Do you think the arrow stdlib should include something like compose or andThen as utility functions?
//left to right
infix fun <A, B, C> ((A) -> B).andThen(right : (B) -> C) : (A) -> C = {
    arg -> right(invoke(arg))
}

//right to left
infix fun <A, B, C> ((B) -> C).compose(right : (A) -> B) : (A) -> C = {
    arg -> invoke(right(arg))
}
s

streetsofboston

06/05/2019, 9:36 PM
I think they already are part of (a) Arrow library…
r

Robert Menke

06/05/2019, 9:37 PM
oh are they?
hmm must have missed that in the docs
s

streetsofboston

06/05/2019, 9:37 PM
https://github.com/arrow-kt/arrow/blob/master/modules/core/arrow-syntax/src/main/kotlin/arrow/syntax/function/composition.kt
Judging from that, in the arrow-syntax lib…?
r

Robert Menke

06/05/2019, 9:37 PM
Thanks!
s

streetsofboston

06/05/2019, 9:39 PM
And other ones can be found in is parent directory (eg currying and such 🙂 ) https://github.com/arrow-kt/arrow/tree/master/modules/core/arrow-syntax/src/main/kotlin/arrow/syntax/function
p

pakoito

06/05/2019, 10:00 PM
these were brought from Funktionale, so thank @dh44t!!!
👏 4
d

dh44t

06/06/2019, 4:14 AM
😅
View count: 3