Data.Array.IO.Internals hidden in GHC6.8 for no good reason
I had some fast array modification code in C to modify the contents of an IOUArray, because I couldn't get my Haskell performance up to snuff. Now that module is hidden in the array package and it doesn't seem possible to unhide it.
The code compiled & worked quite well in GHC6.6. I understand that by going into the internals I may have to update the code as the internals change, but it doesn't seem to be possible to do so at all at this point. The only workaround I can think of is to figure out the internal type from the source, re-declare it locally, and use unsafeCoerce# shenanigans to extract the data. That seems terrible, since future changes to the internals could cause the code to start crashing without any compile-time warning at all.
Bitmap.hs:
{-# OPTIONS_GHC -fffi -fglasgow-exts #-}
{-# INCLUDE "bitmap_operations.h" #-}
module Bitmap(clearBitmap) where
import Data.Array.Base
import Data.Array.IO.Internals
import GHC.Exts
import Data.Word
foreign import ccall unsafe clear_bitmap
:: MutableByteArray# RealWorld -> Word32 -> Word32 -> IO ()
{-# INLINE unsafeGetMutableArray# #-}
unsafeGetMutableArray# :: IOUArray Int Word32 -> MutableByteArray# RealWorld
unsafeGetMutableArray# (IOUArray (STUArray _ _ array#)) = array#
clearBitmap :: IOUArray Int Word32 -> Word32 -> Word32 -> IO ()
clearBitmap a c sz = clear_bitmap (unsafeGetMutableArray# a) c sz
bitmap_operations.h:
#include "HsFFI.h"
void clear_bitmap(void* p, HsWord32 color, HsWord32 size);
Trac metadata
Trac field | Value |
---|---|
Version | 6.8.3 |
Type | Bug |
TypeOfFailure | OtherFailure |
Priority | normal |
Resolution | Unresolved |
Component | libraries (other) |
Test case | |
Differential revisions | |
BlockedBy | |
Related | |
Blocking | |
CC | |
Operating system | Unknown |
Architecture | Unknown |