question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

resultToAsync works with @0.10.2, but not latest version

See original GitHub issue

Describe 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:closed
  • Created 4 years ago
  • Comments:7 (5 by maintainers)

github_iconTop GitHub Comments

2reactions
dalefrancis88commented, Jun 20, 2019

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.parse

import unary as well from crocks and wrap parse with it and that will drop the need for the extra map

const parse = tryCatch(unary(JSON.parse))

0reactions
dalefrancis88commented, Jun 20, 2019

Glad i could help 😄

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found