ghc-heap-view icon indicating copy to clipboard operation
ghc-heap-view copied to clipboard

assertNF crashed with unsafe head operation on empty list

Open hjarvi opened this issue 7 years ago • 1 comments

It was difficult to diagnose a problem, because the thing just spewed that head was applied to an empty list, and there was no clue, whether it was my code, or some library. I was able to hunt it down eventually, that the unsafe head operation was done in ghc-heap-view 0.5.9 src/GHC/HeapView.hs: getClosureData

    t | t == MUT_VAR_CLEAN || t == MUT_VAR_DIRTY ->
        return $ MutVarClosure itbl (head ptrs)

Unfortunately I do not have the original closure at hand to reproduce it. But in any case if I would hit this problem again, it would be very useful for debugging to get a more informative error message.

hjarvi avatar May 03 '17 08:05 hjarvi

I guess that’s true. Patch is welcome :-)

nomeata avatar May 03 '17 12:05 nomeata