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-contributors
  • s

    simon.vergauwen

    04/25/2019, 9:35 AM
    @raulraja @Jannis @pakoito I vaguely remember a discussion about
    Resource
    between data type vs typeclass. https://github.com/arrow-kt/arrow/pull/1376
    j
    p
    r
    • 4
    • 6
  • s

    simon.vergauwen

    04/25/2019, 12:46 PM
    “Killing spree”
    t
    • 2
    • 5
  • s

    simon.vergauwen

    04/25/2019, 3:28 PM
    Is there a way to delegate IntelliJ formatter to klint similar to scalafmt?
    a
    m
    • 3
    • 12
  • l

    LeoColman

    04/28/2019, 2:59 AM
    I believe this file is very specific to JVM, and we can't move it to multiplatform. Do you guys have any idea on this? Is this file actually needed on all subprojects? I'm only touching
    arrowAnnotations
    i
    • 2
    • 3
  • l

    LeoColman

    04/30/2019, 10:21 PM
    So I don't implement
    GenOf
    at Multiplatform/Common, but I do it in JVM
    a
    j
    i
    • 4
    • 16
  • b

    Bob Glamm

    05/24/2019, 12:28 PM
    If you'd prefer I make them consistently authored by 'glamm' just revert and I'll put everything together from an entirely separate machine. Messing around switching git credentials on OS X is aggravating, at best
    m
    • 2
    • 1
  • b

    Bob Glamm

    06/04/2019, 3:06 AM
    @raulraja @pakoito @simon.vergauwen ok, based on a conversation with @raulraja: https://github.com/arrow-kt/arrow/pull/1472/files to change effect to match cats; rationale in pull request. Please let me know if I need to change anything
    i
    • 2
    • 3
  • b

    Bob Glamm

    06/04/2019, 3:09 AM
    and ++ on
    gradlew
    . I guess I could have tried downloading gradle-5.0 and running that instead. Gradle 5.2.1 and 5.4.1 definitely fail the same way, though
    m
    • 2
    • 1
  • p

    pakoito

    06/13/2019, 9:49 AM
    https://github.com/arrow-kt/arrow/issues/1484
    r
    • 2
    • 2
  • p

    pakoito

    06/13/2019, 9:49 AM
    one super easy ticket to add a function and its docs!
    e
    • 2
    • 7
  • i

    Imran/Malic

    06/14/2019, 10:25 AM
    Hey guys I am working on this PR https://github.com/arrow-kt/arrow/pull/1481 And I detected the Problem why I always get this error:
    e: error: Arrow's annotations can only be used on Kotlin classes. Not valid for error.NonExistentClass
    In the Debug stacktrace it occurs that the failure happens in
    arrow-core-extensions
    more specifically, the kapt Task
    kaptKotlin
    I have 2 assumptions: - Either there is a problem with codegen and I need to make this PR bigger than expected. Moving everything out of arrow-extras-data. - Or I am missing an import in gradle
    -.kt
    • 1
    • 1
  • c

    carbaj0

    06/14/2019, 3:07 PM
    the 0.9.1-SNAPSHOT doesn´t work, do i wait to the stable version?
    r
    p
    • 3
    • 11
  • i

    Imran/Malic

    06/19/2019, 10:10 AM
    I suggest reverting the last commit in masters and start from there, because if we merge right away others will have the same problem. And I am not sure if the Artifact is built if the CI does not pass
    • 1
    • 1
  • p

    pakoito

    07/08/2019, 3:13 PM
    @Imran/Malic https://github.com/arrow-kt/arrow/pull/1509#issuecomment-509267111 Good job with FunctorFilter! Let’s do the others now 😄
    👍 1
    i
    r
    • 3
    • 13
  • p

    pakoito

    07/10/2019, 11:00 AM
    you should add the error here too, it may shed some light
    i
    • 2
    • 1
  • p

    pakoito

    07/10/2019, 11:00 AM
    maybe you need to hint the type at someInt
    i
    • 2
    • 1
  • p

    pakoito

    07/10/2019, 11:00 AM
    I'd suggest testing the snippet on a test first
    i
    r
    • 3
    • 6
  • a

    addamsson

    07/14/2019, 11:07 AM
    @raulraja I'm working on a Kotlin MPP library for which I need some FP utilities which is provided by Arrow Core. My problem is that it is not MPP yet and now I'm trying to determine which is a more time-efficient solution: roll my own FP lib including the essentials or help Arrow become MPP. I've heard from @pakoito that you're working on it. Can you give me a rundown on what is needed to get there?
    r
    s
    +2
    • 5
    • 679
  • 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.
    s
    • 2
    • 103
  • a

    addamsson

    07/14/2019, 4:07 PM
    I'm looking at
    Semigroup
    and I'm wondering why
    combine
    is not just an alias for
    operator fun plus
    ?
    s
    • 2
    • 5
  • a

    addamsson

    07/14/2019, 4:25 PM
    @simon.vergauwen I've checked the typeclasses and I think I can do
    PersistentCollection
    +
    PersistentMap
    only with
    Semigroup
    ,
    Monoid
    ,
    Foldable
    ,
    Functor
    and
    FunctorFilter
    . There is one question though: Implementing removal with
    FunctorFilter
    isn't going to be ineffective? I mean it is
    O(n)
    vs
    O(log n)
    or even
    O(1)
    in some of the cases. Is there a typeclass for explicit removal instead of filtering?
    s
    r
    • 3
    • 72
  • a

    addamsson

    07/15/2019, 12:13 PM
    When do you think KEEP-87 will be out?
    i
    • 2
    • 6
  • i

    Imran/Malic

    07/15/2019, 3:08 PM
    Hi @raulraja, @Jorge Castillo came across some issues in the Docs. Some parts have the old artifact structure. Should I change them immediately. Hi Jorge, please share in this thread some of your discoveries and we can sort them out 🙂
    • 1
    • 1
  • r

    raulraja

    07/15/2019, 3:13 PM
    Next release is 0.10.0 as soon as the par traverse changes are in, then we can release
    s
    • 2
    • 3
  • s

    simon.vergauwen

    07/15/2019, 4:05 PM
    We should also verify that this is fixed. https://github.com/arrow-kt/arrow/issues/1510
    i
    • 2
    • 11
  • i

    Imran/Malic

    07/16/2019, 11:11 PM
    Even though, this compiles it’s clear that there are cornerCases where this doesn’t work.
    fun <B> mapFilter(f: (A) -> Option<B>): NonEmptyList<B> =
        map(f).foldLeft(NonEmptyList(listOf())) { acc, o -> o.fold({ acc }, { acc + it }) }
    Well I suggest to change the returnType to something like
    Option<NonEmptyList<B>>
    , because if there doesn’t exist any value which fulfills the f function and returns an Some<B> the return List is empty thus it’s not an NonEmptyList<B>. I also consider something like an
    Either<List<Nothing>, NonEmptyList<B>>
    , which is in my opinion more granular. I am happy for Feedback 🙂
    r
    s
    • 3
    • 10
  • p

    pakoito

    07/16/2019, 11:42 PM
    NEL doesn't have a FunctorFilter instance, you have to transform it to List first
    i
    • 2
    • 7
  • a

    addamsson

    07/17/2019, 8:22 AM
    Which modules do you want to transform to a MPP project first? I've identified some modules which use some features which won't work in Javascript targets because they inherit from functions (which is not supported by the JS target)
    s
    • 2
    • 14
  • j

    Jorge Castillo

    07/19/2019, 12:33 PM
    0.9.1 is not gonna be a thing is it?
    👍 1
    p
    • 2
    • 1
  • a

    addamsson

    07/21/2019, 5:29 PM
    @simon.vergauwen do you think that persistent data structures synergize really well with lenses / optics?
    s
    • 2
    • 48
Powered by Linen
Title
a

addamsson

07/21/2019, 5:29 PM
@simon.vergauwen do you think that persistent data structures synergize really well with lenses / optics?
im' just reading the docs and it occurred to me
s

simon.vergauwen

07/21/2019, 7:10 PM
Optics are meant to be used with immutable data so it's a perfect fit. However it's solves a different problem than the typeclass hierarchy.
a

addamsson

07/22/2019, 7:25 AM
it solves the problem of mutating deeply nested immutable structures, no?
like
assoc-in
in clojure
s

simon.vergauwen

07/22/2019, 7:27 AM
Not only that, it also solves the problem that those operations aren't reusable or composable.
Not sure if that's similar in Clojure or not tho.
a

addamsson

07/22/2019, 7:57 AM
does this also solve thread safety?
like atoms/refs in clojure?
s

simon.vergauwen

07/22/2019, 7:58 AM
We have
Ref
in Arrow Fx 🙂
a

addamsson

07/22/2019, 7:59 AM
what does it do?
s

simon.vergauwen

07/22/2019, 8:00 AM
It’s a functional atomic ref (or a higher kind version of AtomicReference). It’s built on top of effects so we can take into account exceptions and async jumps and we can guarantee safety across that.
a

addamsson

07/22/2019, 8:19 AM
how about performance?
s

simon.vergauwen

07/22/2019, 8:20 AM
It’s uses a similar principle as typeclasses. All Optics are interfaces so you can delegate to whatever preforms best but in general we can derive all this boilerplate at compile time. I.e. data classes just use
copy
to update immutable fields and
copy
gets generated by the compiler.
Sealed classes use
when
which is equivalent to
TABLE_SWITCH
so super fast
Complexer structures with Optics like
Fold
or
Traversal
can be derived from
Foldable
and
Traverse
so they always should be the highest performing.
The idea is also that you use code gen with Optics so you get composable (re-useable) and boilerplate free code to work with immutable data.
A very nice example when working with a complex structure like Json here. https://github.com/47deg/helios/blob/master/helios-sample/src/main/kotlin/helios/sample/sample.kt
I need to work on docs there 2…. but the code for Optics is vey small (less than 200 loc) so definitely interesting to check out if you’re curios about the internals. I hand wrote everything there to produce an artefact with small bytecode 🙂
how about performance?
Or did you mean something else?
a

addamsson

07/22/2019, 9:12 AM
yep I understand how the code is generated / can be overridden
I was asking about the atomic ref
i'm interested in the performance characteristics of ref vs actor or simple thread confinement
s

simon.vergauwen

07/22/2019, 9:12 AM
Oh, it just wraps
AtomicReference
. And for MPP we’ll wrap kotlinx.atomicfu which is also a simply a typealiased
AtomicReference
for Java.
i’m interested in the performance characteristics of ref vs actor or simple thread confinement
Oh, that’s more related to architecture than it’s related to individual building blocks of Arrow. In Arrow Fx you’ll typically find all low level building blocks but in the context of
F
.
Ref
is
AtomicReference
,
Promise
has many use-cases but a good example is that you can use it as a latch to do synchronisation and
Semaphore
. So it’s all low level building blocks concurrency people are typically familiar with.
Wish I could comment more on your actual question but I am not knowledge enough on those subjects.
Feel free to share any lecture you find 🙂
a

addamsson

07/22/2019, 11:55 AM
i'll write some prototypes after my vacation
i've tried Kotlin's
actor
but its performance is abysmal
i need shared mutable state
but the state needs to remain consistent
s

simon.vergauwen

07/22/2019, 11:55 AM
Ye, I imagine. I have an
actor
implementation on top of
IO
and concurrency tools in Arrow
a

addamsson

07/22/2019, 11:56 AM
that's why i need the persistent data structures
so I don't have to confine reads only writes
but with atomic-fu I might not even need to confine writes
s

simon.vergauwen

07/22/2019, 11:56 AM
Then my solution might work for you, although it’s rather an example as an actual fast impl.
It’s a combination of
Queue
,
Ref
and
Promise
. Where you basically have a
Queue
of
Promise
and you can
take
in the actor to act on a message and you can
put
in the
Queue
to send a message.
a

addamsson

07/22/2019, 11:57 AM
i see
i figured something similar
that writes are wrapped in an
Eval
and put in a queue
and a single threaded coroutine executes them in sequence
i don't even need a queue/eval for this since this functionality is provided by coroutines out of the box
s

simon.vergauwen

07/22/2019, 11:59 AM
I based it on this. https://github.com/vlovgr/actors-cats-effect-fs2 The 20min live coding session is very enlightening on how to build advance concurrency stuff with Arrow Fx (Cats-effects).
a

addamsson

07/22/2019, 11:59 AM
thanks I'll take a look
👍
did you have a chance to review the changes to my PR?
s

simon.vergauwen

07/22/2019, 12:07 PM
I am reviewing it now 🙂
a

addamsson

07/22/2019, 12:08 PM
👍
View count: 1