Skip to content

Int64# is exported on 64-bit systems (probably unintentionally), but you can't do anything with it

The Int64# prim type is not declared by primops.txt.pp on 64-bit platforms (there's a CPP guard only enabled on 32-bit). However it's still exported from GHC.Prim:

~ $ ghc-stage2 --interactive -XMagicHash
GHCi, version 8.9.0.20191017: https://www.haskell.org/ghc/  :? for help
Loaded GHCi configuration from /home/omer/rcbackup/.ghci
λ:1> import GHC.Prim
λ:2> :info Int64#
type Int64# :: TYPE 'GHC.Types.Int64Rep
data Int64#
        -- Defined in ‘GHC.Prim’

However this type is pretty much useless on 64-bit: there isn't any primops that work on it, and Int64 holds an Int# (instead of Int64#) so you can't even get an Int64 from it:

λ:5> import Data.Int
λ:6> :info Int64
type Int64 :: *
data Int64 = GHC.Int.I64# Int#
        -- Defined in ‘GHC.Int’

The conversion functions in GHC.IntWord64 are also only defined on 32-bit.

Really the only thing that can be done with it on 64-bit is to unsafeCoerce# it to Int#, but that will be difficult to do after !1869 (closed).

I think the reason why this type is visible on 64-bit (even though it's explicitly disabled in primops.txt.pp) is because the wired-in int64PrimTyCon which is also in exposedPrimTyCons.

See also: #16964 (closed)

To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information