Skip to content

implicit parameters and type synonyms

I wouldn't call this a bug. But we have various pieces of code at Galois that rely on this undocumented (AFAIK) feature of GHC:

Allow implicit parameter constraints in type synonyms and float the constraints out when the synonym is used.

So, given the following program:

{-# OPTIONS -fglasgow-exts -fimplicit-params #-}
module TestIP where

type PPEnv = Int
type Doc   = Char
    
type PPDoc = (?env :: PPEnv) => Doc

f :: Char -> PPDoc
f = succ    

In ghc 6.4.1 and 6.2.1 it compiles fine. In ghc 6.5.20060526 I get this:

src $ ghci ~/TestIP.hs 
   ___         ___ _
  / _ \ /\  /\/ __(_)
 / /_\// /_/ / /  | |      GHC Interactive, version 6.5.20060526, for Haskell 98.
/ /_\\/ __  / /___| |      http://www.haskell.org/ghc/
\____/\/ /_/\____/|_|      Type :? for help.

Loading package base-1.0 ... linking ... done.
[1 of 1] Compiling TestIP           ( /Users/tullsen/TestIP.hs, interpreted )

/Users/tullsen/TestIP.hs:10:4:
    Couldn't match expected type `PPDoc' against inferred type `Char'
    Probable cause: `succ' is applied to too many arguments
    In the expression: succ
    In the definition of `f': f = succ
Failed, modules loaded: none.
Prelude> 

So, my question is Is this a bug or the removing of an undocumented 'feature'?

Thanks,

Mark

Trac metadata
Trac field Value
Version 6.5
Type Bug
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component Compiler
Test case
Differential revisions
BlockedBy
Related
Blocking
CC
Operating system Unknown
Architecture Unknown
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information