Ambiguous types
Janis Voigtlaender
voigt@orchid.inf.tu-dresden.de
Mon, 21 Jan 2002 11:01:20 +0100
Ashley Yakeley wrote:
>
> At 2002-01-21 00:25, Janis Voigtlaender wrote:
>
> >Hope that helps and doesn't just make the story more obscure ;-)
>
> I'm not convinced. Here's a simplified case...
>
> This compiles fine:
>
> emptyList :: [a]
> emptyList = []
>
> isempty :: Bool
> isempty = null emptyList
>
> But this gives an error:
>
> emptyList :: (Ord a) => [a]
> emptyList = []
>
> isempty :: Bool
> isempty = null emptyList
>
> ...
Ok, it seems that the type error in Daniel's program occured for a
simpler reason than I suspected. But my objection to the program
persists: to have a polymorphic (==) that compares lists with the same
element types is different from having a (==) that compares polymorphic
lists.
--
Janis Voigtlaender
http://wwwtcs.inf.tu-dresden.de/~voigt/
mailto:voigt@tcs.inf.tu-dresden.de