[Haskell-cafe] Re: Problem with result-type context restrictions in typeclasses.

2009-09-29 Thread DNM
Correction by the author: It seems that ghc doesn't like the fact that I am saying 'foo' must return a class 'b' of typeclass 'Bar', while providing a function that returns a concrete data instance of 'Bar' (viz., FU or FI) later on when I implement 'foo' in each type classes. Should read:

Re: [Haskell-cafe] Re: Problem with result-type context restrictions in typeclasses.

2009-09-29 Thread Daniel Peebles
In your class, you have: class Cls c where foo :: (Bar b) = c - b There's an implicit forall for b, meaning that the caller of the method gets to choose what it wants for b (as long as it's an instance of Bar). For you to be able to write such a method you'd need to write functions that can