[Haskell-cafe] GHC.Ptr, Foreign.Storable, Data.Storable.Endian, looking for good examples of usage

Daniel Fischer daniel.is.fischer at googlemail.com
Mon Jan 10 17:13:02 CET 2011


On Monday 10 January 2011 16:45:36, Aaron Gray wrote:
>
> This is interesting, what does the following line do :-
>
>     data Int24 = I24# Int# deriving (Eq, Ord)
>
> regarding the I24# and Int#, are these inbuilt ?

Int# is the raw machine int (4 or 8 bytes) and I24# is the constructor. GHC 
uses the magic hash '#' to denote raw unboxed types (and the constructors 
making ordinary boxed Haskell types from these, e.g. there's

data Int = I# Int#
data Word = W# Word#
data Double = D# Double#

and more defined in base [GHC.Types, GHC.Word]).

>
> Thanks,
>
> Aaron




More information about the Haskell-Cafe mailing list