Skip to content

Surfacing submarines #660

@durban

Description

@durban

(This might already be obvious to all involved, in which case let's make this a documentation issue.)

It is trivially easy to surface a submarine exception:

  def foo[F[_]](implicit F: Concurrent[F]): F[Unit] = {
    Handle.allowF[F, String] { handle =>
      F.start(handle.raise("foo"))
    }.rescue(_ => F.never).flatMap[Unit] { fib =>
      F.widen(fib.joinWithNever)
    }
  }

The idea is that we can use the Handle in a completely different fiber, while allowF/rescue is lexical.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions