typelevel / typelevel/cats-effect

Move SyncIO to std / separate module

Open
#1,861 1 comment 2 reactions 1 assignee View on GitHub

@vasilmkd is already working on this.

Since May 5, 2021.

Dominant language
Scala
Stars
2.2k
Forks
576
Avg merge
2d 11h
Merged PRs (30d)
18

Description

fs2 uses SyncIO to implement pure streams, and since that's part of the core, it drags IO and related things with it. Given quite foundational position of fs2, that makes the idea of "not having c.e.IO on the classpath if you don't want it" that was advertised in several talks go out of the window very quickly.

Generally it seems that SyncIO has been most useful in scenarios where:

  • you want a fast, stack-safe Defer/Sync/MonadCancel that you can unsafeRun without exposing, for pure/exceptional computations, maybe with local side-effects, so Eval alone doesn't fit, and stacking stuff on top of it is leaky, ugly and slow;
  • you want to cheat with dual-effect constructors while keeping the second effect type abstract, e.g. Deferred.in[SyncIO, F].unsafeRunSync();
  • you want less powerful type than IO but don't want to use typeclasses for some reason,

all of which are quite different from the scenarios for IO (which is to be the main effect type for your app).

I know @SystemFw and @mpilquist think that IO shouldn't have been separated out in the first place, posting it more for the official response™ 😄

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.