Hi, There is some discussion about the different design choices relevant for Haskell's class system in the following paper: "Type classes: exploring the design space" Simon Peyton Jones, Mark Jones, Erik Meijer Presented at the 1997 Haskell Workshop. Section 4.5 discusses options related to the restrictions on the instance heads.
-Iavor On Tue, Oct 14, 2008 at 7:32 PM, Derek Elkins <[EMAIL PROTECTED]> wrote: > On Tue, 2008-10-14 at 19:20 -0700, George Pollard wrote: >> I'm a little confused. Why is this allowed: >> >> > data Blah = Blah >> > >> > instance Eq Blah where >> > x == y = True >> >> But not this: >> >> > class Stringable a where >> > toString :: a -> String >> > >> > instance Stringable [Char] where >> > toString = id >> >> (Resulting in:) >> >> > Illegal instance declaration for `Stringable [Char]' >> > (All instance types must be of the form (T a1 ... an) >> > where a1 ... an are distinct type *variables* >> > Use -XFlexibleInstances if you want to disable this.) >> > In the instance declaration for `Stringable [Char]' >> >> 'Blah' isn't a type variable, is it? Is my brain just not working right >> today? > > Blah = T > > for [Char], T = [] and a1 = Char where it should be a variable. > > Why this is an error is basically because the Report says so. > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe@haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe > _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe