Skip to content

Instances for IORef/TVar/MVar and other mutable containers #6

Closed
@bennofs

Description

@bennofs

I'd like to propose the following instances:

instance NFData (IORef a) where rnf x = seq x ()
instance NFData (TVar a) where rnf x = seq x ()
instance NFData (MVar a) where rnf x = seq x ()

I think forcing a mutable container should not force the contained value, since that is not really "part" of the data type, it is just referenced. The instances are nevertheless useful when working with APIs that expect NFData types, for example criterion.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions