
20 Feb
2018
20 Feb
'18
10:56 p.m.
On Sun, Feb 11, 2018 at 5:14 AM, David Feuer
Can I use reallyUnsafePtrEquality# reliably to identify whether a value is a nullary constructor of a particular type? For example, if I have
data Foo = Foo
Can I write
isFoo :: a -> Bool isFoo !a = isTrue# (reallyUnsafePtrEquality# a Foo)
You mean like this? https://github.com/gregorycollins/hashtables/blob/master/src/Data/HashTable/... My experience is that this works, except when doing coverage, where the compiler adds instrumentation code that breaks the technique. I #ifdef'd my way around the problem, swapping out a slower impl when I was doing code coverage. Greg