[Haskell-cafe] Endian conversion

Joel Reymont joelr1 at gmail.com
Fri Oct 7 10:48:37 EDT 2005


This code hangs for me for whatever reason when I run it at the ghci  
prompt. It does not matter whether I load it from a file or type it in.

On Oct 7, 2005, at 2:50 PM, Benjamin Franksen wrote:

> You would probably want to wrap/unwrap values (using
> BigEndian/LittleEndian) just before/after calling poke/peek, like  
> this:
>
> \begin{code}
> main = do
>     ptr_x <- new (BigEndian(1::Int))
>     (BigEndian x) <- peek ptr_x
>     poke ptr_x (BigEndian 2)
>     -- poke ptr_x (LittleEndian 3)
> \end{code}

--
http://wagerlabs.com/idealab







More information about the Haskell-Cafe mailing list