On Wed, 5 May 1999, Kevin Atkinson wrote:

> Normally given the class.
> 
> class Listable c b where
>  toList     :: c -> [b]
>
> to list will never be able to be resolved unless the signature is given
> when toList is called because there is no way to derive the type of b
>from the function call.  However when given an instance declaration of
> 
> instance Listable [a] a where
>   toList c = c
> 
> the compiler should be able to resolve toList [1,2,3] however it
> currently doesn't.

Is this inference valid since you might also have somewhere in your
script

instance Listable [Int] Char where
  toList xs = map chr xs

? Haskell takes the conservative view that adding new code, such as this,
to a program should never break old code (except where it is in direct
contradiction of course).

___cheers,_dave______________________________________________________
email: [EMAIL PROTECTED]       "Someday, even toasters will have
www.cs.bris.ac.uk/~tweed/pi.htm   monads in them thanks to Haskell."
work tel: (0117) 954-5253         M P Jones (allegedly)






Reply via email to