[Haskell-cafe] Re: Detecting system endianness

Maurí­cio briqueabraque at yahoo.com
Fri Dec 19 09:49:37 EST 2008

But why would you want that? I understand the only
situation when talking about number of bytes
makes sense is when you are using Foreign and
Ptr. Besides that, you can only guess the amount
of memory you need to deal with your data (taking
laziness, GC etc. into account).


> In a similar vein, is there already a function available to give the 
> size of Word in bytes? Or should I write the usual Ptr conversion tricks 
> to figure it out?
> Holger Siegel wrote:
>> On Thursday 18 December 2008 13:40:47 Ryan Ingram wrote:
>>> Actually, this is probably safer:
>>> import Foreign.Marshal.Alloc
>>> import Foreign.Ptr
>>> import Foreign.Storable
>>> import Data.Word
>>> import System.IO.Unsafe

More information about the Haskell-Cafe mailing list