Skip to content

Behavior of try/finally #226

Description

@alexandru

What are your thoughts on this sample:

//> using scala "3.5.1"
//> using dep "org.typelevel::cats-effect:3.5.4"
//> using dep "org.typelevel::cats-effect-cps:0.4.0"

import cats.effect.*
import cats.effect.cps.*

object Main extends IOApp.Simple:
    def run = async[IO]:
        try 
            IO.canceled.await
        finally 
            println("Finalizing!") 

The finalizer doesn't get invoked, and unfortunately, I find the sample counter-intuitive.

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