{- continuing discussion from beginners@ -}

I have code such as

class Foo f where
    foo :: a -> f a

data Bar f a = Foo f => Bar {bar :: f a}

instance Foo (Bar f) where
    foo a = Bar $ foo a

GHC insists that I put Foo f => on the instance declaration, even though the 
constructor for Bar implies this.

Is there any reason why GHC cannot infer this constraint from the Bar constructor? One issue raised in the beginners thread is that
undefined :: Bar f a
is not Foo f, but as undefined cannot be evaluated, this would not appear to be 
a problem.


_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to