haskell / alex

A lexical analyser generator for Haskell
https://hackage.haskell.org/package/alex
BSD 3-Clause "New" or "Revised" License
298 stars 82 forks source link

Building Alex fails on GHC 7.7 due to wrong primps #30

Closed christiaanb closed 11 years ago

christiaanb commented 11 years ago

It seems the new primops are only used when bootstrapping GHC-7.7 from GHC-7.6, not when building alex with GHC-7.7. Here are the errors that I get:

[20 of 22] Compiling Scan             ( dist/build/alex/alex-tmp/Scan.hs, dist/build/alex/alex-tmp/Scan.o )

dist/build/alex/alex-tmp/Scan.hs:349:29:
    Couldn't match expected type ‛Bool’ with actual type ‛Int#’
    In the first argument of ‛(&&)’, namely ‛(offset >=# 0#)’
    In the expression: (offset >=# 0#) && (check ==# ord_c)
    In the expression:
      if (offset >=# 0#) && (check ==# ord_c) then
          alexIndexInt16OffAddr alex_table offset
      else
          alexIndexInt16OffAddr alex_deflt s

dist/build/alex/alex-tmp/Scan.hs:349:48:
    Couldn't match expected type ‛Bool’ with actual type ‛Int#’
    In the second argument of ‛(&&)’, namely ‛(check ==# ord_c)’
    In the expression: (offset >=# 0#) && (check ==# ord_c)
    In the expression:
      if (offset >=# 0#) && (check ==# ord_c) then
          alexIndexInt16OffAddr alex_table offset
      else
          alexIndexInt16OffAddr alex_deflt s

src/Scan.x:152:2:
    No instance for (Num a0) arising from a use of ‛go’
    The type variable ‛a0’ is ambiguous
    Note: there are several potential instances:
      instance Num Double -- Defined in ‛GHC.Float’
      instance Num Float -- Defined in ‛GHC.Float’
      instance Integral a => Num (GHC.Real.Ratio a)
        -- Defined in ‛GHC.Real’
      ...plus 37 others
    In a stmt of a 'do' block: go inp 1 ""
    In the expression:
      do { inp <- getInput;
           go inp 1 "" }
    In an equation for ‛code’:
        code (p, _, inp) len
          = do { inp <- getInput;
                 go inp 1 "" }
          where
              go inp 0 cs
                = do { setInput inp;
                       .... }
              go inp n cs = do { ... }
              go_char inp n (c1 : c2 : cs)
                | isAlphaNum c2 = go inp n (c1 : c2 : cs)
              go_char inp n cs = go_str inp n cs '\''
              go_str inp n cs end = do { ... }
              err inp
                = do { setInput inp;
                       .... }
schell commented 11 years ago

I'm having this problem as well. Do these all seem related? https://github.com/simonmar/happy/issues/10 https://github.com/haskell-suite/haskell-src-exts/issues/60

simonmar commented 11 years ago

I need to re-roll the package to fix this, but my Hackage account is currently disabled for some reason. Fix coming soon, I hope.

simonmar commented 11 years ago

Now fixed.