Skip to content

`ForeignPtr` should be strict in `ForeignPtrContents`

Right now ForeignPtr is defined as

data ForeignPtr a = ForeignPtr Addr# ForeignPtrContents

data ForeignPtrContents
  = PlainForeignPtr !(IORef Finalizers)
  | MallocPtr      (MutableByteArray# RealWorld) !(IORef Finalizers)
  | PlainPtr       (MutableByteArray# RealWorld)

ForeignPtrContents is strict in all its fields, but ForeignPtr is lazy in the ForeignPtrContents. That should probably not be the case (or, if it should, we should document why).

Edited by edsko@edsko.net
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information