implicit parameters, type synonyms, and $
This is related to ticket #821 (closed) (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
Trac metadata
Trac field | Value |
---|---|
Version | 6.6 |
Type | Bug |
TypeOfFailure | OtherFailure |
Priority | normal |
Resolution | Unresolved |
Component | Compiler |
Test case | |
Differential revisions | |
BlockedBy | |
Related | |
Blocking | |
CC | |
Operating system | |
Architecture | Unknown |