[Haskell-cafe] TypeFamillies and UndecidableInstances - why?

Brandon S. Allbery KF8NH allbery at ece.cmu.edu
Tue Jun 22 21:51:23 EDT 2010


On Jun 22, 2010, at 21:41 , Maciej Piechotka wrote:
> test.hs:11:0:
>    Constraint is no smaller than the instance head
>      in the constraint: Functor (TestMonad a)
>    (Use -XUndecidableInstances to permit this)
>    In the instance declaration for `Functor (Testable a)'
> 
> What is undecidable? a is bound so TestMonad a should be bound so
> Functor (TestMonad a) should be valid.

I *think* the point of the error message is that Functor (TestMonad a) is a tautology, so including it doesn't actually constrain the instance (which in GHC-ese is "Constraint is no smaller than the instance head").  In short, GHC thinks you're being tricky in a way it can't understand, because otherwise there's no point in including the constraint, so it's telling you that being tricky requires UndecidableInstances.

-- 
brandon s. allbery [solaris,freebsd,perl,pugs,haskell] allbery at kf8nh.com
system administrator [openafs,heimdal,too many hats] allbery at ece.cmu.edu
electrical and computer engineering, carnegie mellon university    KF8NH




More information about the Haskell-Cafe mailing list