GHC.Types consturctors with #

Daniel Fischer at
Mon Nov 1 14:25:17 EDT 2010

On Monday 01 November 2010 18:40:00, Larry Evans wrote:
> contains:
> data Int = I# Int#
> What does I# Int# mean?  I've tried a simple interpretation:
>   Prelude GHC.Types> I# 5#
>   <interactive>:1:5: parse error (possibly incorrect indentation)
>   Prelude GHC.Types>
> but obviously that failed :(


ghci> :set -XMagicHash

then it will print 5.

GHC uses the magic hash to denote unboxed raw types and data constructors 
using those.

The point is, I think, making them stand out and avoiding accidental use 
(most of the time you're fine using the regular boxed things and letting 
GHC unbox them, but for when that's not good enough, you can use the low-
level stuff directly).

> TIA.
> -Larry

More information about the Glasgow-haskell-users mailing list