Comments (7)
FOr 0.10, using fold
getConfiguration().fold(
{ /* error handling */},
{ getMovies(it) }
)
In 0.11, use IO<E, A>
, which should come with them: arrow-kt/arrow-fx#145
from arrow-core.
This is only possible exploiting the inline trick in fold since any of those functions would need to have a continuation and map, flatMap, etc can capture the lambda context which would escape the continuation.
from arrow-core.
Not necessarily fold
, just using when
works too. It cannot be part of the regular hierarchy because some Functors
are not like that, i.e. Function1
from arrow-core.
If we would like to include this as part of Async then fine for me, but otherwise I would raise a "What would be the benefit for devs regarding this?" Since I'm unsure because right now I have troubles explaining the Either.catch
to myself or how to use it properly, despite the fact that BIO will have this kind of API already.
from arrow-core.
Async already has this https://github.com/arrow-kt/arrow-fx/blob/043c0eccc7f3748fcbf469ad77c326048ad02cb3/arrow-fx/src/main/kotlin/arrow/fx/typeclasses/Async.kt#L343 effectMap
from arrow-core.
How can I currently in the simplest way chain suspending functions returning Either
?
suspend fun getConfiguration(): Either<Exception, Config>
suspend fun getMovies(config: Config): Either<Exception, List<Movie>>
GlobalScope.launch {
getConfiguration()
.flatMap { config -> getMovies(config) }
.fold { /* ... */ }
}
from arrow-core.
AFAIK we can use crossinline
to restrict non-local returns, so this shouldn't be a problem. Closing in favour of #115
from arrow-core.
Related Issues (20)
- BUILD: error when integrating 'Deprecate @higherkind & @extension for TupleN (#292)' with the rest of Arrow libraries
- BUILD: error when integrating 'Deprecate extension methods for NonEmptyList (#304)' with the rest of Arrow libraries
- BUILD: error when merging 'Deprecate extensions methods for Set and SetK (#299)' on master branch
- DOC: error when integrating 'Fix incorrect package new instances (#306)' with the rest of Arrow libraries
- BUILD: error when integrating 'CU-cew8k0 Remove Deprecated `Id<A>` data type. (#291)' with the rest of Arrow libraries
- BUILD: error when merging 'CU-cn28ya Deprecate @higherkind & @extension for Ior (#317)' on master branch
- BUILD: error when integrating 'Deprecates Kind and its associated type class types. (#281)' with the rest of Arrow libraries
- BUILD: error when integrating 'Deprecates Kind and its associated type class types. (#281)' with the rest of Arrow libraries
- BUILD: error when integrating 'Deprecate Show (#321)' with the rest of Arrow libraries
- BUILD: error when merging 'Deprecate Eq (#322)' on master branch HOT 1
- BUILD: error when integrating 'CU-cn24b4 Remove extension and higherkind annotations for Const (#315)' with the rest of Arrow libraries
- BUILD: error when integrating 'CU-cn24b4 Remove extension and higherkind annotations for Const (#315)' with the rest of Arrow libraries
- BUILD: error when integrating 'Fix typo in deprecation messages (#335)' with the rest of Arrow libraries
- BUILD: error when merging 'Unify syntax for extracting inner values (#338)' on master branch
- BUILD: error when integrating 'Deprecate Hash (#337)' with the rest of Arrow libraries
- DOC: error when merging 'Make memoization compatible with MPP (#331)' on master branch HOT 1
- BUILD: error when merging 'Make memoization compatible with MPP (#331)' on master branch HOT 2
- BUILD: error when merging 'Make memoization compatible with MPP (#331)' on master branch
- BUILD: error when merging 'Make memoization compatible with MPP (#331)' on master branch HOT 2
- BUILD: error when integrating 'Publication: disable checksums for maven-metadata.xml (#354)' with the rest of Arrow libraries HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from arrow-core.