Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Box helper to wrap types where WHNF = NF #5

@bennofs

Description

@bennofs

I'd like a type that can be used to wrap values for which I want WHNF = NF. This is useful for satisfying NFData constraints with criterion for example.

newtype WHNF a = WHNF a
instance NFData (WHNF a) where rnf (WHNF a) = seq a ()

Of course, this data type should be given a better name. Maybe data instead of newtype would also be useful for even more laziness?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions