[GHC] #821: implicit parameters and type synonyms

GHC trac at galois.com
Fri Jul 7 21:10:52 EDT 2006


#821: implicit parameters and type synonyms
-----------------------------------+----------------------------------------
    Reporter:  tullsen at galois.com  |        Owner:         
        Type:  support request     |       Status:  new    
    Priority:  normal              |    Milestone:         
   Component:  Compiler            |      Version:  6.5    
    Severity:  normal              |     Keywords:         
          Os:  Unknown             |   Difficulty:  Unknown
Architecture:  Unknown             |  
-----------------------------------+----------------------------------------
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

-- 
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/821>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the Glasgow-haskell-bugs mailing list