monomorphism/hugs98/ghc-5.02.3

Jay Cox sqrtofone@yahoo.com
Thu, 30 May 2002 22:49:47 -0700 (PDT)


--- Matt Fairtlough <m.fairtlough@dcs.shef.ac.uk>
wrote:
> instance (Eq a, Testit a) => Super (Test a) where
>     sup1 (Test{f1=x, f2=y}) = Just Test{f1=x, f2=y}
>     where
>     y' = top y
>     x' = top x
>     top :: [a] -> a
>     top (s:st) = s
> 
> is it possible to compile this program in
> ghc-5.02.3?

Maybe if 

top:: [a] -> a 

became

top:: [b] -> b


See your /user-guide/scoped-type-variables.html
and you will find the sentence (or something like it)

"The type variables in the head of a class or instance
declaration scope over the methods defined in the
where part."

So, you are not the only one to have had this
confusion with the differences of behavior in ghc vs
hugs!  see

http://haskell.org/pipermail/glasgow-haskell-bugs/2002-April/002308.html

Jay Cox


__________________________________________________
Do You Yahoo!?
Yahoo! - Official partner of 2002 FIFA World Cup
http://fifaworldcup.yahoo.com