
Am Freitag, den 30.09.2011, 19:28 +0200 schrieb George Giorgidze:
Basically the idea is to treat list literals like:
[1,2,3]
as
fromList [1,2,3]
where
class IsList l where type Item l fromList :: [Item l] -> l
Could we *please* not have classes whose names start with “Is”? We don’t have classes IsNum, IsEq, or IsOrd, so why should we have IsList and IsString? I know that the identifier String is already taken, but please don’t tie an identifier like IsString or IsList to a language feature, so that it’ll be difficult to change it later. Let’s search for a better solution.
In the following I give useful instances of the IsList class.
[…]
instance (Ord a) => IsList (Set a) where type Item (Set a) = a fromList = Set.fromList
As a set is definitely not a list, the class should better be named differently anyway, shouldn’t it? Don’t know if these issues have already been pointed out, since I didn’t read through the complete thread. Sorry, if they have already. Best wishes, Wolfgang