24 Sep
2012
24 Sep
'12
11:50 a.m.
Michael Snoyman wrote:
The simplest example I can think of is allowing easier usage of Vector:
[1, 2, 3] :: Vector Int
In order to allow this, we could use a typeclass approach similar to how OverloadedStrings works:
class IsList a where fromList :: [b] -> a b instance IsList Vector where fromList = V.fromList foo :: Vector Int foo = fromList [1, 2, 3]
I remember a similar discussion a few years ago. The question of whether or not overloading list literals a good idea notwithstanding, the problem with this is that fromList for vectors is highly inefficient. So if something like this gets implemented and if vector/array literals are one of the main motivations then I really hope there will be no lists involved. Roman