1. dafis
  2. arithmoi
Issue #4 resolved

equality primop type error under base-4.7

Brent Yorgey
created an issue

I tried compiling arithmoi under base-4.7 and get the following error:

Math/NumberTheory/Utils.hs:84:11:
    Couldn't match expected type ‛Bool’ with actual type ‛Int#’
    In the expression: z# ==# 0#
    In a stmt of a pattern guard for
                   a case alternative:
      z# ==# 0#
    In a case alternative:
        (# z#, w# #)
          | z# ==# 0# -> (0, n)
          | otherwise -> (I# z#, S# (word2Int# w#))

Apparently the return type of ==# changed from Bool to Int#. If I have some time soon I will try to look into this more and see what the recommended solution is.

Comments (12)

  1. Carter Schonwald

    Ok. I'll take a whack at it tomorrow. I think I have a nice way to factor out the design. Mind you there's actually two ways to do the design so I may have to try both and benchmark em

  2. dafis repo owner

    Thanks everyone. I went with Daniel Bergeys use of thoughtpolice's compat package, though as that is not yet on hackage, I made the dependence on that conditional for the moment.

  3. dafis repo owner

    I depend on the package if impl(ghc >= 7.8), and conditionally import either GHC.Base or GHC.Exts.Compat depending on the value of __GLASGOW_HASKELL__. Ugly, but that way it can be built and cabal-installed with 7.6.* and earlier while ghc-prim-compat is not yet on hackage. If that is uploaded before I make my upload, I'll make it unconditional.

  4. Log in to comment