Data.Set and instance Read (Set a)
Christian Maeder
maeder at tzi.de
Thu Jun 21 04:40:36 EDT 2007
Otakar Smrz schrieb:
> The conflict arises when I define my own instance for reading a
> non-polymorphic list, like in:
>
> instance Read [SomeType]
1.) This is not haskell98
2.) should not readList be defined rather than readsPrec?
instance Read SomeType where
readList ...
> Fortunately, I do not need the Data.Set library, and can prevent the
> problem by an explicit empty import:
>
> import Data.Set ()
Can't you omit the whole line (if sets are not involved)?
> However, a simple fix for it might be welcome by others as well:
>
> instance (Read a, Read [a], Ord a) => Read (Set a) where ...
"Illegal Haskell 98 class constraint in instance declaration"
There is an instance:
instance Read a => Read [a]
so the given "instance (Read a, Ord a) => Read (Set a)" would overlap.
(Per type only one instance can be used.)
I hope I did not completely missunderstood you
Christian
More information about the Libraries
mailing list