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

where

  sqrBigNat :: BigNat -> BigNat

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



The full error message can be found at

  http://git.haskell.org/ghc.git/commitdiff/13cb42bc8b6b26d3893d4ddcc22eeab36d39a0c7

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

  http://git.haskell.org/ghc.git/commitdiff/b5ed2f277e551dcaade5837568e4cbb7dd811c04

or alternatively

  https://phabricator.haskell.org/D82


Thanks in advance,
  hvr


More information about the ghc-devs mailing list