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

    Sagar Suri

    01/18/2020, 2:23 AM
    Beginner’s question: If I have a function that returns a
    boolean
    . Should I wrap the return type with
    Either
    or what will be a better return type?
    m
    r
    k
    • 4
    • 15
  • c

    Christian Maus

    01/18/2020, 7:20 PM
    Is there a reason why the typeclass Traverse is only implemented for Tuple2, but not for Tuples of higher arity?
    j
    r
    • 3
    • 5
  • t

    than_

    01/20/2020, 3:00 PM
    hi. does IO support
    continueOn(NonCancellable)
    ? this snippet prints only STARTED :/
    import <http://arrow.fx.IO|arrow.fx.IO>
    import arrow.fx.extensions.fx
    import kotlinx.coroutines.NonCancellable
    import kotlinx.coroutines.delay
    
    val io = IO.fx {
        continueOn(NonCancellable)
        effect { println("STARTED") }.bind()
        effect { delay(10000) }.bind()
        effect { println("FINISHED") }.bind()
    }
    
    val disposable = io.unsafeRunAsyncCancellable {  }
    disposable()
    s
    • 2
    • 8
  • f

    Fabian

    01/20/2020, 3:07 PM
    Hello, are there any examples on
    monad-comprehensins
    on
    StateMonad
    ? I'm having some code that when implemented with
    flatMap
    s compiles and run without issues BUT with monad-comprehensions throws
    java.lang.NoSuchMethodError: arrow.typeclasses.Monad.getFx()Larrow/typeclasses/MonadFx
    So I wanted to check for a reference example
    b
    p
    • 3
    • 7
  • j

    Jannis

    01/20/2020, 8:27 PM
    I am not sure I understand
    raceN
    correctly:
    IO.fx {
            dispatchers().io().raceN(timer().sleep(10.seconds).followedBy(effect { println("Hello") }), effect { println("Hello world") })
                .fork().bind().join().bind()
    }.suspended()
    This code fails with a cancellation exception after one of the effects has occured. The same code without the extra fiber does not.
    suspended()
    or not also changes nothing, unsafeRunSync will also fail.
    s
    • 2
    • 7
  • k

    kyleg

    01/21/2020, 6:44 PM
    I’ve been working on one of the issues, updating documentation that advises on using
    Try
    so that it does not advise this anymore (
    Try
    is deprecated). In a Prism documentation that uses
    Try
    , there is an example that uses
    pTrySuccess
    , which allegedly lives in
    arrow.optics
    . However, I have cloned the Arrow repo and have searched the entire codebase for this string. It only appears in
    arrow-optics/prism/README.me
    but in no actual code. I can’t find it in the git history for
    Optics.kt
    either. Does anyone remember what this function was supposed to do? If I’m already replacing
    Try
    with
    Either
    in many places, I need to get this code working so I can make sure my new documentation is functional code.
    s
    • 2
    • 2
  • a

    addamsson

    01/21/2020, 6:59 PM
    Hi guys, I know I've asked before, but there was no clear path towards a solution...I'd like to use Arrow in my MPP project. Is there a way to get it working? I'm mostly interested in the core datatypes only. 99% of my codebase is in Kotlin common code and I have JVM/JS targets. Little hint?
    r
    s
    r
    • 4
    • 8
  • d

    dnowak

    01/21/2020, 10:42 PM
    I do not like the intermediate result that is again wrapped inside
    EitherT
    to perform
    mapLeft
    .
    r
    • 2
    • 2
  • h

    Hiosdra

    01/22/2020, 11:50 AM
    I'm thinking about writing own Retrofit - Arrow IO adapter. Just to clarify - noone written it before?
    d
    • 2
    • 4
  • m

    Mark Fisher

    01/22/2020, 12:36 PM
    Hi all, I'm trying to follow the Rx2 Docs at https://arrow-kt.io/docs/integrations/rx2/# but am having trouble. The docs setup a function as follows:
    fun <F> getSongUrlAsync(MS: MonadDefer<F>) =
      MS { getSongUrl() }
    but this doesn't compile for me, i'm getting (on a similar function) - see below What am I doing wrong, or are the docs wrong? I'm a bit lost tbh The type import for MonadDefer is
    arrow.fx.typeclasses.MonadDefer
    a
    r
    • 3
    • 9
  • j

    Jannis

    01/22/2020, 2:21 PM
    Hi, over the last few days I've been working on improving the prettyprinter I've written a while back (https://github.com/1Jajen1/kotlin-pretty). It is now pretty much stable and comes with documentation! (https://1jajen1.github.io/kotlin-pretty/docs/). For those not familiar with prettyprinters: A prettyprinter allows you to define dynamic (or static) text in a layout agnostic way which can then later be rendered to string with optimal newlines for the specified width constraints. Check out the readme or the doc page to learn more! The project is written with arrow and mainly makes use of
    Eval
    for stacksafety and optimization and provides primitives to render Documents with applicative effects (for rendering straight to e.g. an output stream). The docs currently include a landing page, a getting started guide and a full api reference. Everything else in the docs is wip, so if you have any questions feel free to ask directly ask me (or open issues). Feedback is much appreciated!
    👏 7
    :arrow: 6
    p
    • 2
    • 7
  • m

    Mark Fisher

    01/22/2020, 3:02 PM
    A follow up to my earlier question on Rx with Arrow. I'm trying to write a comprehension that combines calls to functions that return Rx Single objects. For example:
    class ArrowRxTests {
        @Test
        fun `comprehension with arrow and rx`() {
            val x = SingleK.fx {
                val (count) = getCountSingle       // this is an async call using a SingleK.monadDefer
                val newCount = increment(count)    // this is an async call returning Single<Int>.... how do i use it here?
                newCount
            }.value()
    
            assertThat(x.blockingGet()).isEqualTo(2)
        }
    
        private fun getCount() = 1
        private fun <F> getCountAsync(MS: MonadDefer<F>) = MS.later { getCount() }
        private val getCountSingle: SingleKOf<Int> = getCountAsync(SingleK.monadDefer())
    
        private fun increment(i: Int): Single<Int> = Single.just(i + 1)
    }
    This works if
    increment
    just returns an int, but how do I use increment() in the comprehension when it already returns a Single? I want to somehow keep the flow of the code inside
    SingleK.fx {}
    but using functions that return Rx types
    s
    j
    • 3
    • 18
  • k

    kyleg

    01/22/2020, 5:52 PM
    Since
    Try
    is deprecated, is the preferred replacement for (non-suspending)
    Try { … }
    : 1. an explicit
    try { Either.right(…) } catch(e) { Either.left(…) }
    or 2.
    runBlocking { Either.catch { … } }
    (which is a suspend fun)
    p
    s
    a
    • 4
    • 9
  • a

    Attila Domokos

    01/22/2020, 6:14 PM
    I created an example app for my upcoming Arrow talks leveraging
    EitherT<ForIO>
    extensively. I really like the code I have, however, some people are lost with monad transformers. I tried to dummy down the example to use
    IO<Either<A, B>
    , however, the code is not very attractive. Check out the functions
    run
    using EitherT and
    run2
    using IO<Either> types. Why do I need to call
    unsafeRunSync
    in function
    run2
    to call that code? Does
    flatMap
    invalidate the
    fx
    context? https://github.com/adomokos/kotlin-sandbox/blob/ad/io-either/src/main/kotlin/sandbox/explorer/App.kt#L65-L98
    s
    j
    r
    • 4
    • 9
  • l

    Luke Rohde

    01/22/2020, 7:41 PM
    does arrow provide any facilities for typeclass instance derivation, a la scala shapeless macros?
    p
    r
    • 3
    • 5
  • m

    Mark Fisher

    01/23/2020, 10:48 AM
    Hi All, Continuing my understanding of arrow and concurrency, how do I write a comprehension that makes concurrent calls within it. My naive first attempt is this, but the "network" calls happen sequentially.
    @Test
        fun `concurrent arrow and rx`() {
    
            val x = SingleK.fx {
                val requiredValue = !getCountSingle
                println("network call A")
                val networkCallAValue = !pauseAndIncrement(requiredValue).k()
                println("network call B")
                val networkCallBValue = !pauseAndIncrement(requiredValue).k()
    
                networkCallAValue + networkCallBValue
            }.value()
    
            assertThat(x.blockingGet()).isEqualTo(4)
        }
    
        private fun pauseAndIncrement(i: Int): Single<Int> {
            println("Entering pause...")
            Thread.sleep(2000)
            println("... returning single")
            return Single.just(i + 1)
        }
    getCountSingle
    in this context should block the subsequent assignments until it is available (this is fine) but its value should be usable by the 2 subsequent calls which I'd like to happen concurrently as they are independent, and I just need to block on the result of them both. Is there a nice way of doing this without it becoming spagetti code?
    r
    s
    • 3
    • 24
  • s

    Satyam Agarwal

    01/23/2020, 2:15 PM
    Hi. I am in the process of moving from Try to IO in my web app. but the whole stack is built upon that. Basically Try wraps my network requests. Since its a big project moving to IO will not be easy. So I want to do it in steps, And thinking this is how I will do the migration. 1. Replace
    Try { … }.toEither()
    with
    IO { … }.attempt().unsafeRunSync()
    in the clients/repositories 2. Start Replacing Either from services with IO and remove
    unsafeRunSync()
    and bring it to services. 3. Eventually remove
    unsafeRunSync()
    and bring them finally to controllers. 4. And finally get rid of springboot ❤️ I have worked with
    unsafeRunSync
    before in production for very small things (mostly one time things like migrations, imports/exports where I couldn’t do without springboot 💢), so I am comfortable and have not seen any problems, but with above, my apis can get affected, consequently my user-base. I am basically wondering about this line from doc
    **NOTE** this function is intended for testing, it should never appear in your mainline production code!
    Can you guys help me with deciding if this makes sense and is sane thing to do, and what kind of problems I can see with this approach.
    s
    • 2
    • 8
  • a

    aballano

    01/24/2020, 11:22 AM
    Hi there folks, I'm looking into a ticket for Arrow to try to reduce the duplicated extension functions projected over types (e.g. ListK has around ~5 map functions). One question I'm wondering, does it make sense to provide instances of different typeclasses when they're related? Example: ListK provides an instance for Monad (which has map defined) and another for Applicative (which also has map), but Monad is already an Applicative, so shouldn't be sufficient by providing the former?
    ☝️ 1
    j
    r
    • 3
    • 20
  • a

    Attila Domokos

    01/24/2020, 5:24 PM
    This sentence in the Arrow guides is misleading: "Complementing the Kotlin Coroutines library, Arrow Fx adds an extra layer of safety to concurrent and asynchronous programming so you’re well aware of where effects are localized in your apps." TIL - Arrow is not using JetBrain's coroutine library (https://github.com/Kotlin/kotlinx.coroutines), the wording should be "Competing" or "As an alternative to the Kotlin Coroutines library". Thoughts? (Thanks to @simon.vergauwen for chatting with me about it.)
    s
    r
    • 3
    • 6
  • b

    Bruno

    01/24/2020, 9:20 PM
    I want to translate something from F# to Arrow: F#
    [1..10]
    |> List.map (add 2)
    |> List.map (mult 3)
    My attempts: #1
    (1..10)
        .pipe { it.map { add(2) } }
        .pipe { it.map { mult(3) } }
    #2
    (1..10)
        .map { add(2) }
        .map { mult(3) }
    What am I missing? I'd expect a list like:
    [9,12,15,18,21,24,27,30,33,36]
    , but instead get a
    List<(Int) -> Int>
    b
    s
    • 3
    • 12
  • m

    mbrandonw

    01/27/2020, 2:25 PM
    It seems that it is impossible to use
    @optics
    to generate optics for generic data classes and sealed classes. The generated code has compiler errors. 1) is this right? and 2) are there alternatives to this besides writing the optics by hand?
    👍 1
    p
    s
    • 3
    • 10
  • p

    pakoito

    01/27/2020, 4:46 PM
    // TODO which we need to have access to the implementation of map in Option
    yes! it's also a fun exercise not to call
    fix()
    and see a stackoverflow exception because the function calls itself
    😂 1
    j
    b
    • 3
    • 11
  • s

    Satyam Agarwal

    01/27/2020, 6:11 PM
    So this program fills up ~8G and does not print anything, after some time it either throws error for thread starvation or exits due to heap space unavailable (Because I am providing 8G of heap). But this shouldn’t take this much. Can you guys help me on what am I doing wrong here. Actual use case could be, I want to make 100000 network request and semaphore limit is my http client pool connections, say 10. Using 0.10.4 version
    Untitled
    k
    j
    +2
    • 5
    • 68
  • k

    kyleg

    01/27/2020, 7:56 PM
    Has anyone given any decent thought about implementing an Android app using MVI architecture, but using Arrow/FP? I have been using an app I wrote as a personal project in MVVM style to learn other things, and first I learned MVI by refactoring it that way, and now I’ve been thinking about how one might use Arrow thoroughly. (my thoughts in thread)
    s
    a
    • 3
    • 13
  • b

    Bruno

    01/28/2020, 9:27 AM
    Hello everyone, I got a simple console program, that reads to numbers from console and prints the sum. I have learned that the FP way of effects is not to use IO<Unit> for everything, because that does not give us control of which types of effects we want to allow for certain parts of our code. Thus I want to allow only console reading and printing or console IO for this program, how would I do that with arrow-fx?
    fun add(a: Int, b: Int): Int = a + b
    
    suspend fun main1(args: Array<String>) =
        IO.fx {
    
            val sc = Scanner(System.`in`)
    
            val nextInt = effect { sc.nextInt() }
    
            val added = IO.applicative()
                .map(nextInt, nextInt) { (a, b) -> add(a, b) }.bind()
    
            effect { println(added) }.bind()
    
        }.run { suspended() }
    p
    p
    • 3
    • 7
  • a

    aeruhxi

    01/29/2020, 8:52 AM
    Either.fx() {
      val (x) = someLeftValue()
      10
    } // Left propagates
    
    Either.fx() {
      someLeftValue()
      10
    } // Either.Right(10)
    j
    k
    r
    • 4
    • 14
  • r

    rcd27

    01/29/2020, 10:47 AM
    Hello, mates. Learning Scala, correct me if I'm not right: if
    Kotlin
    compiler had such feature like
    implicit
    in
    Scala
    , there would be less work for people who do
    Arrow Meta
    ? This
    Scala
    feature looks very useful.
    a
    • 2
    • 3
  • h

    Hiosdra

    01/29/2020, 8:38 PM
    Hi, in arrow 0.11.0-snapshot (testing it, because of BIO) in this code:
    fun validatePhotoMatch(login: Login, photo: ByteArray): IO<Error, Unit> =
        IO.monad<Error>().fx.monad {
          val user = !userService.getUserByLogin(login)
          val modelVectors = !extractFaceVectors(user)
          val unknownVectors = !recognitionService.calculatePhoto(photo)
          val resultDto = !recognitionService.calculateDifference(unknownVectors, modelVectors)
          !failureOrUnit(resultDto.result)
        }.fix()
    I cannot make second line: as
    IO.fx {
    . Idea cannot decide if it should be:
    IO.Companion.fx(c: suspend IOSyntax<E>.() -> A): IO<E, A>
    Or:
    IO.Companion.fx(c: suspend ConcurrentSyntax<IOPartialOf<Nothing>>.() -> A): IO<Nothing, A>
    Is it some kind of bug with new IO being BIO? Or I do something bad? Type inference should see that there is Error on left side, not Nothing. (I use my own Error class in ADT) Every method used in for-comprehension is returning
    IO<Error, x>
    Arrow Gradle deps are:
    val arrowVersion = "0.11.0-SNAPSHOT"
    	implementation("io.arrow-kt:arrow-fx:$arrowVersion")
    	implementation("io.arrow-kt:arrow-fx-reactor:$arrowVersion")
    	implementation("io.arrow-kt:arrow-mtl:$arrowVersion")
    	implementation("io.arrow-kt:arrow-mtl-data:$arrowVersion")
    	implementation("io.arrow-kt:arrow-syntax:$arrowVersion")
    	implementation("io.arrow-kt:arrow-integration-retrofit-adapter:$arrowVersion")
    	kapt("io.arrow-kt:arrow-meta:$arrowVersion")
    And second: Maybe add function
    Either<E, A>.toIO<E, A>()
    ? There are already functions that map left side of Either to “below” side of IO, but I couldn’t see any mapping Either left to IO left. In BIO it would be very easy. I have written it for my own purpose and can push pull-request to 0.11.0 branch ;)
    a
    • 2
    • 2
  • p

    pakoito

    01/29/2020, 8:54 PM
    IO.monad<Error>().fx.monad {
    don’t use this, use just
    IO.fx<MyError> { ... }
    h
    • 2
    • 2
  • p

    pakoito

    01/29/2020, 8:59 PM
    should it be raiseException or raiseError? cc @aballano and @simon.vergauwen for opinion
    h
    a
    • 3
    • 14
Powered by Linen
Title
p

pakoito

01/29/2020, 8:59 PM
should it be raiseException or raiseError? cc @aballano and @simon.vergauwen for opinion
h

Hiosdra

01/29/2020, 9:04 PM
For that, I meant version with raiseError. I have seen that there is already with raiseException 😉
p

pakoito

01/29/2020, 9:07 PM
ye I imagined 😄
a

aballano

01/30/2020, 10:34 AM
I guess Simon knows better, but from my understanding it should be raiseError without the mapping 🤔
p

pakoito

01/30/2020, 11:37 AM
toIO
and
toIOException
to distiguish
IO<Throwable, A>
and
IO<Nothing, A>
for example
👌 1
@Hiosdra you could make a PR for that
h

Hiosdra

01/30/2020, 12:12 PM
@pakoito Thank you, I will be glad to do this today evening. You mean to rename actual:
fun <A> Either<Throwable, A>.toIO(): IO<Nothing, A>
to
toIOException
Also to create and test:
fun <E, A> Either<E, A>.toIO(): IO<E, A> =
  fold({ IO.raiseError(it) }, { IO.just(it) })
p

pakoito

01/30/2020, 12:12 PM
correct!
so there should be 3 in the end:
oh nevermind, just 2
the third one can be made by using map or mapLeft first
h

Hiosdra

01/30/2020, 12:15 PM
Ok, I will make pull request after my work 😉
p

pakoito

01/30/2020, 12:15 PM
fun <E, A> Either<Throwable, A>.toIO(f: (Throwable) -> E): IO<E, A>
cool, thanks 😄
h

Hiosdra

01/30/2020, 10:12 PM
@pakoito https://github.com/arrow-kt/arrow/pull/2003 Can you look at it?
View count: 2