Opened 6 years ago

Closed 6 years ago

#5325 closed bug (fixed)

The -dsuppress-type-signatures flag behaves wrongly on RULES

Reported by: reinerp Owned by: igloo
Priority: normal Milestone: 7.4.1
Component: Compiler Version: 7.0.3
Keywords: Cc:
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: None/Unknown Test Case:
Blocked By: Blocking:
Related Tickets: Differential Rev(s):
Wiki Page:


Given this module:

module M where

f :: Num a => a -> a
f x = x + 1

{-# SPECIALISE f :: Int -> Int #-}

if we compile with

ghc -dsuppress-type-signatures -O -ddump-simpl M.hs

we see that the SPECIALISE pragma has become the following:

"SPEC M.f" [ALWAYS] forall {} M.f @ GHC.Types.Int $dNum_anE = M.f_f

It looks dNum_anE is a free variable in this rule, but it's actually a bound variable, as we can see when we compile without -dsuppress-type-signatures:

    forall {$dNum_anE :: GHC.Num.Num GHC.Types.Int}
      M.f @ GHC.Types.Int $dNum_anE
      = M.f_f

I think GHC should produce the following output with -dsuppress-type-signatures:

"SPEC M.f" [ALWAYS] forall {$dNum_anE} M.f @ GHC.Types.Int $dNum_anE = M.f_f

This is with GHC 7.1.20110629.

Change History (4)

comment:1 Changed 6 years ago by igloo

Milestone: 7.4.1
Owner: set to igloo

comment:2 Changed 6 years ago by simonpj@…

commit 0ebc4424a528fcda666f0b1444871dd83ef73a83
Author: Simon Peyton Jones <>
Date:   Fri Jul 15 12:08:43 2011 +0100

    Improve pretty printing of Core (fixes #5325)

comment:3 Changed 6 years ago by simonpj

Status: newmerge

Right. -dsuppress-type-signatures is only supposed to affect separate type signatures on value bindings, not the types on lamabda-ish variables such as those in RULES. Thanks.

comment:4 Changed 6 years ago by igloo

Resolution: fixed
Status: mergeclosed
Note: See TracTickets for help on using tickets.