Skip to content

Purpose of newTVarIO #141

@tomjaguarpaw

Description

@tomjaguarpaw

The Haddock for newTVarIO says:

IO version of newTVar. This is useful for creating top-level TVars using unsafePerformIO, because using atomically inside unsafePerformIO isn't possible.

But the Haddock for atomically says:

Using atomically inside an unsafePerformIO ... subverts some of guarantees that STM provides ... If a nested transaction is attempted, an exception is thrown by the runtime. It is possible to safely use atomically inside unsafePerformIO

So maybe it is possible, but you can't then run atomically on top again?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions