incompatible signatur syntax within instance definition
Fergus Henderson
fjh at cs.mu.OZ.AU
Mon Dec 8 15:19:13 EST 2003
On 05-Dec-2003, Christian Maeder <maeder at tzi.de> 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 <fjh at cs.mu.oz.au> | "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.
More information about the Haskell
mailing list