robotlolita on v4.x
robotlolita on 2.1.0
robotlolita on deferred-message
robotlolita on union-constructors
robotlolita on typescript
robotlolita on gh-pages
robotlolita on logo
robotlolita on v2.3.2
robotlolita on master
Updates changelog, version to 2… More stylistic fixes (compare)
@s0kil you can refer to this
@sankemax version 1 is deprecated, and version 2 should be production-ready (with the exception of APIs marked as "experimental", which don't have a particularly solid foundation and haven't been as well-tested as I wish they had been). It's maintained in the sense that I'll still fix bugs if people report them on GitHub (i generally don't get notifications for gitter stuff), but since moving to another country has been a lot more work than predicted I haven't had time to work on any new stuff yet (which means the new version with TypeScript support is still going to take a while to be released)
task
and it's great, but I'm wondering how to adapt a pattern I have been using with the old-style Task
..fork(reject, success)
call
Error
s thrown to .catch()
right?
.orElse(rejectionsHandler).run().promise().catch(handleUnforseenErrors)
@borodinalive maybe use a kind of a thin broker like
// _unstableFilterMaybe.js
export default pred => m => m.filter(pred)
// your code
import _filterMaybe from '_unstableFilterMaybe.js'
_filterMaybe( x => !!x)(someMaybe)
At least this way, even if you used the experimental filter
and if one day it changed implementation, you only have one file, namely _unstableFilterMaybe.js, to change to accommodate your own code.
Hi, new(ish) user of Folktale, its great thanks!
I have a, probably basic, problem which I cannot figure out. I have two Task
objects, each of which will resolve to an array, e.g.:
const t1 = Task.of([49]);
const t2 = Task.of(['john', 'paul']); // In reality, these tasks are being created from promises which are fetching data
I want to merge the arrays such that I get each unique combination, e.g. if I had just arrays I might do:
a1.map(resourceId => a2.map(name => ({ name, resourceId }))) // [{ name: 'john', resourceId : 49}, { name: 'paul', resourceId: 49}]
I can't figure out the best way to do this from Tasks - any help appreciated!
@JamesRamm Hi James, I think you can do that through something called list comprehension. So I am using a library that does List monoid immutable-ext
to achieve the result:
import { task, of, waitAll } from 'folktale/concurrency/task';
import { List } from 'immutable-ext';
const ids = of([49, 51])
const names = of(['joh', 'paul', 'francis'])
const comprehend = id => name => ({id, name})
let res = {};
waitAll([ids, names])
.run()
.listen({onResolved: ([ids, names]) =>
{
res = {value: List.of(comprehend).ap(List(ids)).ap(List(names)).toArray()}
}
})
Here's the link to the code sandbox https://codesandbox.io/s/competent-river-mqx2u?file=/src/App.tsx
{
"value": [
{
"id": 49,
"name": "joh"
},
{
"id": 49,
"name": "paul"
},
{
"id": 49,
"name": "francis"
},
{
"id": 51,
"name": "joh"
},
{
"id": 51,
"name": "paul"
},
{
"id": 51,
"name": "francis"
}
]
}