Opened 18 months ago

Closed 15 months ago

Last modified 15 months 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 Difficulty: Unknown
Test Case: Blocked By:
Blocking: Related Tickets:

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
        Control.Applicative.pure
          @ ((->) Main.Memory)
          $dApplicative_a1b4
          @ GHC.Integer.Type.Integer
          i_ayo
*** Offending Program ***
....

However HEAD compiles it just fine.

Sjoerd Visser found that you can avoid the error by replacing

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

with

  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 18 months ago.
Offending program

Download all attachments as: .zip

Change History (4)

Changed 18 months ago by simonpj

Offending program

comment:1 Changed 18 months 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.

Simon

comment:2 Changed 15 months ago by monoidal

  • Resolution set to fixed
  • Status changed from new to closed

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 15 months ago by simonpj

Thanks for checking, monoidal

Simon

Note: See TracTickets for help on using tickets.