Opened 7 years ago

Closed 7 years ago

Last modified 7 years ago

#2473 closed bug (fixed)

Data.Array.IO.Internals hidden in GHC6.8 for no good reason

Reported by: ryani Owned by: igloo
Priority: normal Milestone:
Component: libraries (other) Version: 6.8.3
Keywords: Cc:
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: Test Case:
Blocked By: Blocking:
Related Tickets: Differential Rev(s):
Wiki Page:


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.


{-# 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


#include "HsFFI.h"

void clear_bitmap(void* p, HsWord32 color, HsWord32 size);

Change History (5)

comment:1 Changed 7 years ago by igloo

  • difficulty set to Unknown
  • Owner set to igloo

It was hidden by:

Sat Nov 11 11:32:48 GMT 2006  Ross Paterson <[email protected]>
  * hide Data.Array.IO.Internals
  It's hidden from haddock, and everything it exports is re-exported by

which isn't quite accurate, as Data.Array.IO re-exports IOArray and IOUArray abstractly.

I think that .Internal modules aren't really part of the API, so I'll just re-expose it.

comment:2 Changed 7 years ago by ryani


comment:3 Changed 7 years ago by igloo

  • Resolution set to fixed
  • Status changed from new to closed


comment:4 Changed 7 years ago by simonmar

  • Architecture changed from Unknown to Unknown/Multiple

comment:5 Changed 7 years ago by simonmar

  • Operating System changed from Unknown to Unknown/Multiple
Note: See TracTickets for help on using tickets.