https://kotlinlang.org logo
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
benchmarks
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
confetti
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
lincheck
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
Title
a

addamsson

07/14/2019, 4:01 PM
I'm looking at the source code of Arrow and I've noted that there are interfaces like
Functor
which are very well documented but there are things like
Profunctor
which have literally no docs. The functions are also a bit problematic because their kdocs are mostly hard to understand or non-existent. Do you plan on improving this? It would be useful for contributors who didn't come from a Scala background.
For example I have no idea what
Applicative
can be used for and what
unit
means in it without looking at the code.
It would be tremendously useful to include not only docs, but real life examples for the application of these things.
s

simon.vergauwen

07/14/2019, 4:06 PM
Yes, we have this planned and we've worked very hard on a solution to compile and test the snippets in the kdoc and host them our website as runnable snippets in the documentation.
a

addamsson

07/14/2019, 4:07 PM
I think I can help, although I have no formal FP background
s

simon.vergauwen

07/14/2019, 4:07 PM
Our focus currently lies with Kotlin MPP and stabilizing towards Arrow 1.0. We'd love contributions to the documentation and we'd love to help anyone who is interested in doing so.
That'd be awesome!
a

addamsson

07/14/2019, 4:08 PM
I've been using Arrow since its inception but I find some of its APIs unintuitive
I understand that in most of the cases it is straightforward for someone who comes from a Scala background, but for someone who worked with Java / Clojure previously it is very unintuitive
s

simon.vergauwen

07/14/2019, 4:09 PM
All feedback is welcome! There is some low hanging fruit that we're aware off and stream lining the apis is on the roadmap
Any concrete examples?
a

addamsson

07/14/2019, 4:11 PM
For example there is
Eq
It causes a mental pagefault to interpret it
If I read the kdocs I can see that it is there to check equality
good
but now I see
eqv
and
neqv
which is also not too hard to interpret
but this mental overhead adds up and I end up spending a lot of time interpreting code instead of reading it
I think using plain English would be better
something like
foo.isEquivalentTo(bar)
I also don't see the point of not using
equals(other: Any?): Boolean
that would give operator overloading for
==
and
!=
I think that these things are no brainers for those who have the context (the contributors of the project)
but the users of arrow are hindered by it
I think that by providing readable APIs would make Arrow's adoptation skyrocket
complete with real life examples for things like
Applicative
I read 3 different definitions for what an
Applicative
is and I didn't understand why it was useful until I saw the
Validation
class in VAVR
s

simon.vergauwen

07/14/2019, 4:16 PM
The point of
Eq
is that you can compose it in nested shapes and it type checks.
Understanding why defining logic by behavior instead of type makes more sense if you approach it the other way around imo.
Starting from the more powerful use cases like writing abstract validation logic and running it accumulating
Validated
vs short circuit
Either
Or writing abstract concurrenct code and running it with RxJava, Reactor and Flow.
But I'm having a hard time writing this down in an easy to understand way 😅 like a lot in the FP world I think
a

addamsson

07/14/2019, 4:21 PM
I get the behavior vs type argument
and I agree with that
my point was that I think it can be made more approachable
s

simon.vergauwen

07/14/2019, 4:21 PM
The difference between
equals
and
Eq
is essentially inheritance vs composition. So if you ask why not
equals
vs
Eq
you could also ask inheritance vs composition
a

addamsson

07/14/2019, 4:21 PM
with names which don't require much interpretation
s

simon.vergauwen

07/14/2019, 4:21 PM
There is definitely room for improvement!
I'm too used to this naming I don't see it anymore
a

addamsson

07/14/2019, 4:22 PM
I see
that's why I'm trying to be the fresh set of eyes with no domain knowledge whatsoever 😄
s

simon.vergauwen

07/14/2019, 4:22 PM
Yes, It would be great if you could keep track of this in a ticket.
a

addamsson

07/14/2019, 4:23 PM
hmm
good idea
this is not about
Eq
but the whole API
s

simon.vergauwen

07/14/2019, 4:24 PM
Yep, all feedback is great. Especially if we can improve more before 1.0
a

addamsson

07/14/2019, 4:29 PM
Do you agree with the overall sentiment that Arrow is a bit of an oddball for those who are used to how the Kotlin stdlib works and the readability of the API can be improved?
s

simon.vergauwen

07/14/2019, 4:32 PM
Well, I think the Kotlin std is the oddball. I don't expect
setOf(1, 2, 3).map
to return List.
I'm not on my computer atm but there are cases like that.
We're trying to improve the API without changing the signatures if that makes sense
I've done some investigating on Optics and stuff like named lambda params can also drastically improve the API imo. In addition with good kdocs I think we'd improve things a lot.
Also simpler apis with the result of keep-87 will drastically improve things removing the need of enabling syntax with
run
a

addamsson

07/14/2019, 4:38 PM
you have a point
what I meant is that the names could be improved
to be intuitive for those who are not yet familiar with FP
i'm just trying to get on the same page as you
s

simon.vergauwen

07/14/2019, 4:42 PM
Yes, we’re on the same page. I just wanted to clarify to avoid confusion
a

addamsson

07/14/2019, 4:52 PM
got it
you mean that the stdlib is oddball from a correctness perspective: it is weird that `List`s are returned for example
s

simon.vergauwen

07/14/2019, 4:53 PM
Exactly, but besides that we do have the freedom to change things around to make them more user friendly.
a

addamsson

07/14/2019, 4:53 PM
my argument is that Arrow is an oddball from a readability / pragmatic programmer standpoint: I don't really care in most of the cases that a
List
is returned but I want my code to be readable so when the next guy comes around to maintain my code and they don't know Arrow they at least have a chance to understand what i've written by just looking at it
s

simon.vergauwen

07/14/2019, 4:55 PM
Yes absolutely. Do you feel like this is the case with Vavr? From my Java work experience of the passed 4 years I’ve experienced a lot of pushback for things like Vavr in Java but that might’ve been region specific.
And if so do you feel this is because of the laxer APIs? Or is that irrelevant.
a

addamsson

07/14/2019, 5:05 PM
I haven't used it for a long enough time to be able to tell
but I've had this experience with Arrow
If you check the Issues (and even the issue about keep 87) you can see that people are asking for things like using
Composable
instead of
Monoid
I dont' agree with them because you can look up what a
Monoid
is and is is unambiguous
but the names of functions are kinda arbitrary
for example to construct a
Functor
I've seen things like
pure
,
of
,
just
if would be nice to have something readable which is familiar for Java devs as well
I like
of
because it is part of Effective Java and most folks understand it by looking at it
s

simon.vergauwen

07/14/2019, 5:07 PM
Yes, we had
pure
because originally we thought that since Arrow is build for FPers it should be immediately clear to anyone with FP experience.
We've moved away from that train of thought. In this case we choose for
just
because it's well know from RxJava and Reactor.
Having a lot of aliases is something we wanted to avoid since having multiple ways of doing is probably a bigger drawback.
I find naming extremely difficult and especially in Arrow because we'd like to take in account multiple audiences
a

addamsson

07/14/2019, 5:14 PM
I see
I agree with the alias problem
There is one important question though
what is the purpose of Arrow itself?
are you writing it for Scala/Haskell expats
are are you writing it for the general populace?
for the pragmatic everyday programmer?
s

simon.vergauwen

07/14/2019, 6:04 PM
The purpose of Arrow is for everyone to be able to do pure FP in Kotlin. The important part here is that we want to stay pure in all APIs, because that's what we feel brings the most benefit and thus makes the most sense.
We're not writing it for the occasional Scala / Haskell guy. We expect most developers (already) heavily invested in FP in those languages will probably not switch.
Ideally it should be able to suit everyone's needs depending on your needs you'd import more or less modules.
a

addamsson

07/14/2019, 6:15 PM
This is great
but in this case there has to be some reconciliation
to make Arrow approachable for PEP™s (Pragmatic Everyday Programmer)
For example right now if I want a
ListK
(which I figured out I'll need if I want to tamper with the list) with some elements the familiar syntax from the stdlib would be
listKOf(1, 2, 3)
but instead I need to do this:
listOf(1, 2, 3).k()
and if I look at the code I see this:
fun <A> List<A>.k(): ListK<A> = ListK(this)
I can see that this creates a
ListK
but I have no idea what the
k
means
looking at the code of
ListK
it says it is a wrapper but I see no explanation of the
K
. Is it because it is a kind? It has a
@higherkind
annotation. But then why the docs says it is just a wrapper? Why not
ListW
then? or
ListWrapper
. And I still can't remove an element form
ListK
because there is no such operation
With VAVR for example it is just
List.of(1, 2, 3).remove(1)
and I get all the operations I need. It is approachable and intuitive
So if we want to add persistent data structures to Arrow there has to be a
remove
operation and a
persistentListOf(1, 2, 3)
function
otherwise users will just stare at the code complition and wonder how it works
s

simon.vergauwen

07/14/2019, 7:11 PM
Good point about
listKOf
vs
listOf().k()
!
We already have a working compiler plugin that adds HKTs*
a

addamsson

07/14/2019, 7:12 PM
I give you a counter example:
Try.invoke { require(1 == 2) }.map {
        println("Sorry, I won't be printed :(")
    }
this is pretty intuitive
i've never used Arrrow's
Try
but just using code completion i was able to do this in 5 seconds