Documentation stale: implicit-parameter constraints seem to be allowed in instance declarations now.
You can't have an implicit parameter in the context of a class or instance declaration. For example, both these declarations are illegal:
class (?x::Int) => C a where ...
instance (?x::a) => Foo [a] where ...
However, ghc 7.6.3 seems to accept this now:
{-# LANGUAGE ImplicitParams #-}
class C a where
toInt :: a -> Int
instance (?imp :: Int) => C [a] where
toInt _ = ?imp
test :: Int
test = let ?imp = 5 in toInt "Hello, world"
test evaluates to 5.
Trac metadata
| Trac field | Value |
|---|---|
| Version | 7.6.3 |
| Type | Bug |
| TypeOfFailure | OtherFailure |
| Priority | normal |
| Resolution | Unresolved |
| Component | Documentation |
| Test case | |
| Differential revisions | |
| BlockedBy | |
| Related | |
| Blocking | |
| CC | |
| Operating system | |
| Architecture |