On 04-Nov-1998, Claus Reinke <[EMAIL PROTECTED]> wrote:
> 
> >seems like another reason to advocate ad hoc polymorphism
> >(allow a name to denote several things, as long as they have
> >different types). 
> 
> How much ``ad hoc'' would you like? Hugs 1.3c [March 1998 p1]
> accepts the following without complaints:
> 
>   class AdHoc t where
>     function :: t
> 
>   instance AdHoc (Bool -> Bool) where
>     function = not
> 
>   instance Num a => AdHoc (a -> a -> a) where
>     function = (+)

That's not really what I'd call ``ad hoc'' -- you have to define a class.
That doesn't solve the problem of accidental collision between
field names or constructor names.  In those cases, the compiler
often has enough information to resolve the ambiguity without
even needing any explicit type declarations or type qualifications,
but Haskell doesn't allow it.

-- 
Fergus Henderson <[EMAIL PROTECTED]>  |  "I have always known that the pursuit
WWW: <http://www.cs.mu.oz.au/~fjh>  |  of excellence is a lethal habit"
PGP: finger [EMAIL PROTECTED]        |     -- the last words of T. S. Garp.


Reply via email to