[Haskell-cafe] overloaded list literals?

Henning Thielemann lemming at henning-thielemann.de
Mon Sep 6 06:43:34 EDT 2010


On Mon, 6 Sep 2010, Johannes Waldmann wrote:

> We have overloaded numerical literals (Num.fromInteger)
> and we can overload string literals (IsString.fromString),
> so how about using list syntax ( [], : )
> for anything list-like (e.g., Data.Sequence)?

My favorite solution would be to throw away special list syntax and list 
comprehensions at all. Then lists and sets are on the same level of 
compiler support.

If find

   1:2:3:4:5:[]

a perfect way to write lists. Analogously to this we could have an 
infix operator that is overloaded with (:) for lists and Set.insert for 
sets.


> Of course some "minor details" would need to be worked out,
> like what methods should go in the hypothetical "class IsList"
> (is is Foldable?) and what to do about pattern matching
> (perhaps we don't need it?)

View patterns?

> IIRC there was a time when list comprehension
> would actually mean monad comprehension
> (when there was no "do" notation)
> but that's not what I'm getting at here. Or is it?
> Do we have a "Haskell museum" of ideas from the past?

I think the future ideas collected at the old Hawiki would serve as such 
museum. Unfortunately Hawiki is gone. I wonder whether I can easily get a 
dump of HaskellWiki in order to prevent it from the same destiny.


More information about the Haskell-Cafe mailing list