unboxed arrays for nhc/jhc

Bulat Ziganshin bulat.ziganshin at gmail.com
Wed Mar 8 08:45:52 EST 2006


Hello Malcolm,

Wednesday, March 8, 2006, 3:00:21 PM, you wrote:

>> if nhc don't supports ST/unsafeIOtoST, then i plan to use the
>> following ST monad emulation:
>> 
>> type ST a = IO a

MW> What happened to the other type parameter?

MW>   type ST s a = ...

well, "type ST s a = IO a". it's very close to trick used in Hugs to
implement ByteArrays in ST monad

>> unsafeIOtoST = id
>> runST = unsafePerformIO
>> 
>> is this can work?

MW> You will also need to define aliases for ST-bound datatypes like
MW>     type STRef s a = IORef a

this lib by itself don't require such things. emulation of ST monad
required just to implement Array/UArray. i will write algorithms in
terms of runST, but really unsafePerformIO will be used in nhc and
other compilers not supporting ST monad

the second question - is this (adding NHC support to Data.Array.*
libraries) really required?

-- 
Best regards,
 Bulat                            mailto:Bulat.Ziganshin at gmail.com



More information about the Libraries mailing list