On 05-Dec-2003, Christian Maeder <[EMAIL PROTECTED]> wrote:
> >instance Show a => Show (List a) where
> >    showsPrec _  Nil = showString "[]"
> >    showsPrec _ l =
> >    showString "[" . showsl l . showString "]"
> >        where -- showsl :: List a -> ShowS            -- for ghc
> >          -- showsl :: Show a => List a -> ShowS  -- for hugs

I think the issue here is that in ghc (with -fglasgow-exts),
the "a" here refers to the same type variable "a" in the
top of the instance declaration, which has already been
constained, and cannot be constrained again.
With Haskell 98, it is a fresh type variable, for
which the constraint is necessary.

Try renaming the type variable as "b" in the inner declaration:
the following should work both with and without -fglasgow-exts.

          showsl :: Show b => List b -> ShowS

-- 
Fergus Henderson <[EMAIL PROTECTED]>  |  "I have always known that the pursuit
The University of Melbourne         |  of excellence is a lethal habit"
WWW: <http://www.cs.mu.oz.au/~fjh>  |     -- the last words of T. S. Garp.
_______________________________________________
Haskell mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/haskell

Reply via email to