Wired-in data-constructors with UNPACKed fields

Herbert Valerio Riedel hvriedel at gmail.com
Sun Aug 17 13:16:03 UTC 2014

Hello *,

I'm a bit stuck with the wired-in type aspect of integer-gmp2 and was
hoping someone with more experience in this area could provide direction
on how to properly register the data definition

  data Integer  = SI#                Int#
                | Jp# {-# UNPACK #-} !BigNat
                | Jn# {-# UNPACK #-} !BigNat
  data BigNat = BN# ByteArray#

with compiler/prelude/TysWiredIn.lhs

Right now I'm getting the Lint-failure 

    Unfolding of sqrInteger
      <no location info>: Warning:
          In the expression: $wsqrBigNat dt
          Argument value doesn't match argument type:
          Fun type: ByteArray# -> BigNat
          Arg type: BigNat
          Arg: dt


  sqrBigNat :: BigNat -> BigNat

which seems to be caused by the UNPACK property not being handled

The full error message can be found at


and the other half of the integer-gmp2 patch can be found at


or alternatively


Thanks in advance,

More information about the ghc-devs mailing list