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

    tmg

    08/13/2019, 2:07 PM
    University of Minho, Braga, Portugal, FP thought first there.
    s
    • 2
    • 7
  • t

    tmg

    08/13/2019, 3:54 PM
    I also don't see any haskell or erlang job postings, most is the usual Java / C# and JS.....
    s
    • 2
    • 4
  • s

    stojan

    08/13/2019, 4:52 PM
    I went to university in Macedonia... We learned C++, PHP and Java. I didn't even know fp existed...
    ☝️ 1
    s
    • 2
    • 1
  • d

    Derek Berner

    08/13/2019, 6:41 PM
    I keep thinking I'm gonna send my kids to free college abroad (higher education is expensive in the US), but this lack of FP makes me wonder 😂
    🇵🇹 2
    🇪🇸 2
    b
    r
    +2
    • 5
    • 7
  • r

    Rafal Piotrowski

    08/14/2019, 9:49 AM
    Hi @Bob Glamm, I saw in the channel history that you were working with ktor and you were trying to use IO as a ktor handler (which is suspended function). Have you managed to do that using Arrow 0.9.0 or you had to use snapshot version (0.10.0-SNAPSHOT)?
    b
    • 2
    • 18
  • b

    Bob Glamm

    08/15/2019, 7:55 PM
    I'm not convinced these adapters I'm trying to write are the right way to go about doing this. @pakoito @raulraja @simon.vergauwen thoughts on transforming
    Route.get(path: String, body: suspend PipelineContext<Unit, ApplicationCall>.(Unit) -> Unit): Route
    from something more like
    Route.get(path: String, body: Async<F>.(ApplicationCall) -> Kind<F, Unit>): Route
    ? I keep running into issues where trying to just transform the second argument from
    Async
    to
    PipelineContext
    cannot resolve
    .fix().suspended()
    to end up with
    suspend () -> Unit
    r
    • 2
    • 1
  • r

    Rafal Piotrowski

    08/19/2019, 12:43 PM
    Hello, I have integrated Arrow with Ktor using
    Deferred
    class from
    kotlinx.coroutines
    , sample code is below. As you can see I have
    DemoService
    and
    DemoRouting
    which have no suspend method and are parametrized with type
    F
    . I define
    F
    as
    IO
    when the server is created (so on the end of the world ;)). I could use different monad (e.g.
    Try
    ) after implementing the
    Deferrable
    interface. Please let me know what you think about this approach. @Bob Glamm, this is a little bit different than using
    Async
    directly as we spoken recently, there is a separate typeclass to transform value into deffered value.
    Untitled
    s
    b
    • 3
    • 26
  • m

    miqbaldc

    08/21/2019, 7:28 AM
    is there any java alternative e.g:
    arrow-java
    ?
    p
    • 2
    • 1
  • r

    raulraja

    08/21/2019, 10:01 AM
    I'm sure there is also some meta lib for java out there we may not know about doing something similar or providing the primtives to do it with javac that isn't apt
    s
    p
    • 3
    • 7
  • l

    LeoColman

    08/21/2019, 8:21 PM
    This would be something like
    try {
      foo()
    } catch(FooException) { 
    } catch(BarException) { }
    s
    b
    • 3
    • 3
  • r

    raulraja

    08/21/2019, 10:29 PM
    Maybe you are looking for
    SequenceK
    i
    r
    • 3
    • 2
  • r

    raulraja

    08/24/2019, 12:17 PM
    If you have an opinion and agree we could propose comprehensions for Kotlin and get rid of bind in in Arrow
    👏 4
    r
    m
    p
    • 4
    • 20
  • b

    Brandon Ward

    08/26/2019, 10:08 PM
    which dependencies for arrow 0.9.0 do I need to use to get access to
    IO
    ? The docs are unclear and refer to dependencies that don't exist for this version, or don't exist at all.
    a
    r
    • 3
    • 2
  • p

    PhBastiani

    08/27/2019, 12:09 PM
    Hi, I'm discovering the new
    fx
    syntax for comprehensions... If i understand, the new impl uses coroutines under the cover ! I replaced the calls of
    bindind()
    by
    fx.monad
    Now, I have something like that :
    fx.monad {
        val vMaybe:Option<T> = ...
        vMaybe.map { mymonadfunction(...).bind() }
       ...
    Here, the call of
    bind()
    gives me an error 'Suspension functions can be called only within coroutine body'... What is the new syntax for this kind of binding ? Thx in advance....
    s
    p
    • 3
    • 4
  • b

    Bob Glamm

    08/27/2019, 12:59 PM
    fx.monad {
        val v: T = !foo(x)    // fun foo(x: Any): Option<T>; v is bound to T since ! is an alias of bind()
        !mymonadfunction(v)    // fun mymonadfunction(t: T): Option<R>; value of fx.monad {} block will be Some(R) or None
    }
    p
    r
    • 3
    • 4
  • r

    Rafal Piotrowski

    08/28/2019, 9:02 AM
    Here is a draft of my post "How to build REST API with Arrow, Ktor and requery in Kotlin": https://medium.com/@rafal.piotrowski/e5438c951418 Any feedback is welcome 🙂
    ⭐ 2
    :arrow: 8
    🙂 4
    p
    r
    +5
    • 8
    • 42
  • r

    Robert Menke

    08/28/2019, 3:34 PM
    What is the practical difference between a semigroup and a monoid? Both seem to be mechanisms for combining things together
    i
    m
    +3
    • 6
    • 40
  • s

    Sergey Akhapkin

    08/28/2019, 8:26 PM
    Hello, everyone. Could you pls help me - just started to use Arrow, so perhaps did something wrong (e.g. forgot to import something). My question is - why there is difference how Try works in Arrow and Scala ?
    import arrow.core.*
    Try.invoke { "1" }.flatMap<Int> { throw IllegalArgumentException() }
    java.lang.IllegalArgumentException
    
    scala.util.Success<String>("a").flatMap<Int> { throw IllegalArgumentException() }
    res28: scala.util.Try<kotlin.Int!>! = Failure(java.lang.IllegalArgumentException)
    or in native Scala REPL:
    System.out.println(scala.util.Try("x").flatMap{ s => throw new java.lang.IllegalArgumentException(s) })
    > Failure(java.lang.IllegalArgumentException: x)
    r
    • 2
    • 2
  • b

    Bob Glamm

    08/29/2019, 1:06 PM
    I sure wish I could make it to Cádiz. Will that presentation be available online after the conference?
    r
    • 2
    • 2
  • p

    PhBastiani

    08/29/2019, 3:48 PM
    Hi, is-it possible to have a partial lifting into an Arrow Free Monad ?
    r
    • 2
    • 6
  • p

    pakoito

    08/30/2019, 10:43 AM
    I believe this one is for the debugger, I've been able to repro but cannot dig into what happens when
    !put("A", 1)
    is called. We know it never reaches the interpreter.
    p
    • 2
    • 27
  • r

    Ryan Benasutti

    08/30/2019, 10:12 PM
    Is there already an arrow + hamkrest library out there? I find myself writing a lot of extra hamkrest matchers for arrow data types and I don't want to release my own library if there's already one I should know about
    r
    m
    +3
    • 6
    • 10
  • p

    pakoito

    08/31/2019, 8:48 PM
    Coproduct/HList
    b
    • 2
    • 5
  • r

    raulraja

    08/31/2019, 10:50 PM
    There is no need to nest this function on a Kind F.
    suspend fun String.parseDate(): Either<DateParseError, Date> =
      Either.catch({ e -> DateParseError(e) }) {
         dateFromString(this)
      }
    j
    • 2
    • 1
  • r

    raulraja

    09/01/2019, 12:06 AM
    This is more inline also with Arrow and Fx expecting side effects including things that can fail inside suspension or IO
    👍 1
    j
    • 2
    • 3
  • b

    Bob Glamm

    09/01/2019, 2:40 AM
    ugh, I think the best I can do is a typed method that yields a program that properly binds the parameters to PreparedStatement. Yuck.
    r
    • 2
    • 2
  • f

    Fred Friis

    09/02/2019, 3:39 AM
    Can someone explain the differences between
    Option.else
    vs
    Option.getOrElse
    and
    Either.filterOrElse
    vs
    Either.filterOrOther
    i
    s
    m
    • 4
    • 8
  • a

    AdrianRaFo

    09/02/2019, 8:10 AM
    @Fred Friis -
    Option.getOrElse
    returns the value inside if the
    Option
    is a
    Some
    or return the provided param if it's a None -
    Option.orElse
    returns the same
    Option
    if it's not
    None
    , otherwise returns the provided
    Option
    The difference here is that
    getOrElse
    will return the value outside the
    Option
    context but the
    orElse
    keep that context
    ☝️🏽 1
    f
    i
    s
    • 4
    • 11
  • s

    simon.vergauwen

    09/03/2019, 1:47 PM
    Applicative
    enables combining elements using
    map
    for any number of arguments 🙂
    k
    • 2
    • 6
  • r

    raulraja

    09/03/2019, 2:58 PM
    data class Data(val a: String, val b: String)
    data class Error(val msg: String)
    val data : Either<Error, Data> = Either.applicative<Error>().map("".right(), Error("oops").left(), ::Data).fix()
    //Left(Error("oops"))
    👍 1
    • 1
    • 3
Powered by Linen
Title
r

raulraja

09/03/2019, 2:58 PM
data class Data(val a: String, val b: String)
data class Error(val msg: String)
val data : Either<Error, Data> = Either.applicative<Error>().map("".right(), Error("oops").left(), ::Data).fix()
//Left(Error("oops"))
👍 1
@carbaj0 the issue is the applicative instance is incorrectly parameterised
also if you just want to gather results you can use
tupled
map
is only useful if you plan to transform them in the map function otherwise tupled is all you need
☝️ 1
View count: 4