I found the mistake: compactAdd c k p <- anyToPtr k Should be: p <- anyToPtr . getCompact =<< compactAdd c k Otherwise I guess I’m not using the pointer that’s on the compact region.