Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inserting a map stops propagation of IOLocal #3103

Open
SystemFw opened this issue Jan 9, 2023 · 1 comment
Open

Inserting a map stops propagation of IOLocal #3103

SystemFw opened this issue Jan 9, 2023 · 1 comment
Labels

Comments

@SystemFw
Copy link
Collaborator

SystemFw commented Jan 9, 2023

Originally reported by @kamilkloch , I've done some minimisation. Reproduced in fs2 3.4.0, it seemed to work correctly on 3.0.2 (which I happened to have at hand). @Jasper-M points to #2572 as the probable change.

def no =
    IOLocal(false).flatMap { local =>
      Stream
        .eval(local.set(true))
        .evalMap(_ => local.get)
        .map(x => x)
        .compile
        .toVector
    }
     .unsafeRunSync() // Vector(false)
     

  def yes =
    IOLocal(false).flatMap { local =>
      Stream
        .eval(local.set(true))
        .evalMap(_ => local.get)
        .compile
        .toVector
    }
     .unsafeRunSync() // Vector(true)

  def yes2 =
    IOLocal(false).flatMap { local =>
      Stream
        .eval(local.set(true) >> local.get)
        .compile
        .toVector
    }
     .unsafeRunSync() // Vector(true)

  def yes3 =
    IOLocal(false).flatMap { local =>
      (Stream.exec(local.set(true)) ++ Stream.eval(local.get))
        .compile
        .toVector
    }
     .unsafeRunSync() // Vector(true)

  def no2 =
    IOLocal(false).flatMap { local =>
      (Stream.exec(local.set(true)) ++ Stream.eval(local.get))
        .map(x => x)
        .compile
        .toVector
    }
     .unsafeRunSync() // Vector(false)
@SystemFw SystemFw added the bug label Jan 9, 2023
@armanbilge
Copy link
Member

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants