resultToAsync works with @0.10.2, but not latest version
See original GitHub issueDescribe the bug
I am following the youtube lesson, https://youtu.be/O1Gu5b7rxbw?t=2885, resultToAsync
works for crocks@0.10.2 version, but not 0.11.0 & 0.11.1 versions.
To Reproduce Steps to reproduce the behavior:
import { readFile } from "fs";
import { Async, tryCatch, resultToAsync } from "crocks";
const e = e => console.error("rej", e);
const s = s => console.log("res", s);
const parse = tryCatch(JSON.parse);
const readFileAsync = Async.fromNode(readFile);
readFileAsync("config.json", "utf8")
.chain(resultToAsync(parse))
.fork(e, s);
Error is throw new TypeError('resultToAsync: Result returning function required
Issue Analytics
- State:
- Created 4 years ago
- Comments:7 (5 by maintainers)
Top Results From Across the Web
A practical guide to async in Rust - LogRocket Blog
If you're writing an asynchronous program in Rust or using an async library for the first time, this tutorial can help you get...
Read more >[2020-resolver] Pip downloads lots of different versions of the ...
pip does indeed try to use multiple versions of the same package. This is because of conflicting requirements in the dependency graph it's ......
Read more >aiobotocore - PyPI
Async client for amazon services using botocore and aiohttp/asyncio. This library is a mostly full featured asynchronous version of botocore.
Read more >Npm Error - No matching version found for - Stack Overflow
npm complains that there "is no matching version found", but it's clearly installed. Worked to change package.json to target `"^3.0.0" and then ...
Read more >Async/Await - Best Practices in Asynchronous Programming
It is possible to have an event handler that returns some actual type, but that doesn't work well with the language; invoking an...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Yeah so i’ve seen a similiar issue in exactly this, It is caused because JSON.parse is not a unary function. The output of any call to
tryCatch
regardless of the input is curried. This is why you need to do the extra call with JSON.parseimport
unary
as well from crocks and wrap parse with it and that will drop the need for the extramap
const parse = tryCatch(unary(JSON.parse))
Glad i could help 😄