[GHC] #4347: Asymmetry of (impredicative) instantiation/higher rank types
GHC
cvs-ghc at haskell.org
Mon May 2 21:32:17 CEST 2011
#4347: Asymmetry of (impredicative) instantiation/higher rank types
----------------------------------------+-----------------------------------
Reporter: dolio | Owner:
Type: bug | Status: new
Priority: normal | Milestone: 7.4.1
Component: Compiler (Type checker) | Version: 7.1
Keywords: | Testcase:
Blockedby: | Difficulty:
Os: Linux | Blocking:
Architecture: x86_64 (amd64) | Failure: GHC rejects valid program
----------------------------------------+-----------------------------------
Comment(by carlhowells):
The thing that gets to me is this:
{{{
DumbTrick.hs:11:12:
Couldn't match expected type `forall a.
Random a =>
(forall g. RandomGen g => g -> (a, g))
-> IO a'
with actual type `(forall g'. RandomGen g' => g' -> (b0,
g'))
-> IO b0'
In the first argument of `return', namely `apply'
In the expression: return apply
In the expression:
do { gen <- newMVar =<< newStdGen;
let apply ::
forall b. Random b =>
(forall g'. RandomGen g' => g' -> (b, g')) -> IO b
apply f = modifyMVar gen $ (\ (a, b) -> ...) . f;
return apply }
}}}
It's telling me that it can't unify two types, there the only difference
between the reported types is whether the rank-1 polymorphism is implicit
or explicit. (I'm ignoring the lack of reporting on the class constraint
because I'm pretty sure that's not relevant.)
Furthermore, it does that even when I explicitly quantify the value it's
telling me is implicitly quantified.
Between those two factors, this feels like a bug, rather a decision to
remove a little-used (if awesome) feature.
--
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/4347#comment:7>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the Glasgow-haskell-bugs
mailing list