Skip to content

Unhandled resource exception on pure IO action #401

@bolt12

Description

@bolt12

This issue was found whilst using tasty-bench, please refer to Bodigrim/tasty-bench#52 for more details.

Essentially I was able to reproduce this with the following minimal code:

bug :: String -> TestTree
bug title = withResource
              (pure ((), ()) >>= evaluate . force)
              (pure (pure ()))
              ((\(x,y) -> testCase title (unBenchmarkable (nf id (x,y)) maxBound)) . unsafePerformIO)

When I try to run this function I get Unhandled resource. Probably a bug in the runner you're using. This seems to be a bug since my test case does not depend on anything from the environment. I think what makes this fail is the fact I am pattern matching on the tuple, because if I rewrite my function to: (\x -> testCase title (unBenchmarkable (nf id x) maxBound) everything works.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions