#2102: Typeclass membership doesn't bring coercion superclass requirements into
scope
------------------------+---------------------------------------------------
Reporter: ryani | Owner:
Type: bug | Status: new
Priority: normal | Component: Compiler
Version: 6.8.2 | Severity: normal
Keywords: | Testcase:
Architecture: Unknown | Os: Unknown
------------------------+---------------------------------------------------
{{{
-- This works:
class C1 a where c1 :: a -> Int
class C1 a => C2 a where c2 :: a -> Int
test :: C2 a => a -> Int
test a = c1 a + c2 a
-- This doesn't work:
class (a ~ b) => E a b
cast :: E a b => a -> b
cast a = a
{- error:
tyfam.hs:36:9:
Couldn't match expected type `b' against inferred type `a'
`b' is a rigid type variable bound by
the type signature for `cast' at tyfam.hs:35:14
`a' is a rigid type variable bound by
the type signature for `cast' at tyfam.hs:35:12
In the expression: a
In the definition of `cast': cast a = a
-}
}}}
I would expect that the requirement of membership in {{{E a b}}} would
bring {{{(a ~ b)}}} into scope and allow {{{cast}}} to typecheck.
--
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/2102>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler_______________________________________________
Glasgow-haskell-bugs mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs