Opened 5 years ago

Closed 5 years ago

Last modified 5 years ago

#7372 closed bug (fixed)

Lint failure in GHC 7.6.1

Reported by: simonpj Owned by:
Priority: normal Milestone: 7.8.1
Component: Compiler Version: 7.6.1
Keywords: Cc: j.romildo@…, sjoerd@…
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: None/Unknown Test Case:
Blocked By: Blocking:
Related Tickets: Differential Rev(s):
Wiki Page:

Description (last modified by simonpj)

José Romildo Malaquias reports that the attached file (requires parsec unfortunately) makes GHC 7.6.1 give a Lint error:

bash-3.1$ c:/fp/ghc-7.6.1/bin/ghc -c applicative-eval.hs  -dcore-lint -fforce-recomp
*** Core Lint errors : in result of Desugar (after optimization) ***
<no location info>: Warning:
    In a case alternative: (Main.Cte i_ayo :: GHC.Integer.Type.Integer)
    Type of case alternatives not the same as the annotation on case:
        Main.Memory -> GHC.Integer.Type.Integer
        (->) Main.Memory GHC.Integer.Type.Integer
          @ ((->) Main.Memory)
          @ GHC.Integer.Type.Integer
*** Offending Program ***

However HEAD compiles it just fine.

Sjoerd Visser found that you can avoid the error by replacing

  eval :: Exp -> (->) Memory Integer


  eval :: Exp -> Memory -> Integer

which should be the same, but apparently isn't internally in GHC.

Attachments (1)

applicative-eval.hs (1.6 KB) - added by simonpj 5 years ago.
Offending program

Download all attachments as: .zip

Change History (4)

Changed 5 years ago by simonpj

Attachment: applicative-eval.hs added

Offending program

comment:1 Changed 5 years ago by simonpj

Description: modified (diff)

I'm guessing that this is another manifestation of #7312, which is fixed and which should be in 7.6.2. But it would be good if someone could check.


comment:2 Changed 5 years ago by monoidal

Resolution: fixed
Status: newclosed

I checked it. TL;DR: the same cause as in #7312, fixed in HEAD and STABLE.

Here's a small version:

module Main where

data Exp = Cte Integer
         | Let Exp

eval :: Exp -> (->) a Integer
eval (Cte i) = return i                -- (1)
eval (Let b) = \m -> eval b m          -- (2)

main = undefined

Under GHC 7.6.1, there are two problems. Both are fixed by changing (->) a Integer to a -> Integer. Line (1) compiles but fails dcore-lint. In fact

c :: (->) a a
c = id

already fails dcore-lint, saying that the types (->) a a and a -> a do not match. Line (2) gives panic identical to #7312. The code works fine after the fix in #7312.

comment:3 Changed 5 years ago by simonpj

Thanks for checking, monoidal


Note: See TracTickets for help on using tickets.