#2618: Order is relevant when matching signature contexts of a mutually
recursive
group
------------------------+---------------------------------------------------
Reporter: guest | Owner:
Type: bug | Status: new
Priority: normal | Component: Compiler (Type checker)
Version: 6.8.3 | Severity: normal
Keywords: | Testcase:
Architecture: Unknown | Os: Unknown
------------------------+---------------------------------------------------
The Following code
{{{
f :: (Show a, Eq a) => a -> String
f x = show x `const` g x
g :: (Eq a,Show a) => a -> Bool
g x = x==x `const` f x
}}}
gives this error:
{{{
Couldn't match expected type `Eq a' against inferred type `Show a1'
When matching the contexts of the signatures for
f :: forall a. (Show a, Eq a) => a -> String
g :: forall a. (Eq a, Show a) => a -> Bool
The signature contexts in a mutually recursive group should all be
identical
When generalising the type(s) for f, g
Failed, modules loaded: none.
}}}
but it compiles fine if i swap Show and Eq in the context of either f or
g.
The order of typeclass constraints usually doesn't matter so it's very
surprising that it does here.
--
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/2618>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
_______________________________________________
Glasgow-haskell-bugs mailing list
Glasgow-haskell-bugs@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs