[GHC] #981: implicit parameters, type synonyms, and $

GHC trac at galois.com
Thu Nov 2 14:37:11 EST 2006


#981: implicit parameters, type synonyms, and $
--------------------------------+-------------------------------------------
    Reporter:  jefb at galois.com  |       Owner:         
        Type:  bug              |      Status:  new    
    Priority:  normal           |   Milestone:         
   Component:  Compiler         |     Version:  6.6    
    Severity:  normal           |    Keywords:         
  Difficulty:  Unknown          |    Testcase:         
Architecture:  Unknown          |          Os:  MacOS X
--------------------------------+-------------------------------------------
This is related to ticket #821 (which is indeed fixed in 6.6).

 We make extensive use of an (undocumented?) feature of GHC: type synonyms
 can include implicit parameter constraints such that when the type is
 used, the constraint 'floats to the top'.  This appears to be broken in
 some cases in 6.6.

 Here's an example module:

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

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

 f :: Char -> PPDoc
 f c = g $ c

 g :: PPDoc -> PPDoc
 g d = d
 }}}

 when loaded in ghci 6.6, this yields:

 {{{
 /Users/jefb/Test.hs:7:10:
     Couldn't match expected type `PPDoc' against inferred type `Char'
     Probable cause: `c' is applied to too many arguments
     In the second argument of `($)', namely `c'
     In the expression: g $ c
 }}}

 If `g $ c` is changed to `g c` the module compiles.

 The example compiles in 6.4.1 (I don't have handy access to other versions
 right now).

 Thanks!
 Jef

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


More information about the Glasgow-haskell-bugs mailing list