Skip to content

Raises and Handles aliases on Scala 3? #666

@armanbilge

Description

@armanbilge

Just wanted to jot this idea down, someone feel free to turn it into a PR :) miraculously, this syntax seems to compile/auto-infer in Scastie. LOL, I lied, it was a "miracle". Well, maybe someone can workshop this 😅

abstract class IO[+A]
trait Raise[F[_], E]
trait MyError

type Raises[F[_], E] = [A] => Raise[F, E] ?=> F[A]

type Rtn = IO[String] Raises MyError

The idea is this allows to write:

def foo(bar: Bar): IO[Baz] Raises Qux

instead of

def foo(bar: Bar)(using Raise[IO, Qux]): IO[Baz]

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