[Haskell-cafe] overloaded list literals?

2010-09-06 Thread Johannes Waldmann
I think left-biased (= singly linked) lists are much overrated in Haskell coding (and teaching). The language (syntax and Prelude) makes it just too easy to use them, and old habits (from LISP) die hard. Sure, lists serve a purpose: * they model (infinite, lazy) streams, used in the

Re: [Haskell-cafe] overloaded list literals?

2010-09-06 Thread Henning Thielemann
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

Re: [Haskell-cafe] overloaded list literals?

2010-09-06 Thread Neil Brown
On 06/09/10 11:23, 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)? I would have thought you have two obvious

Re: [Haskell-cafe] overloaded list literals?

2010-09-06 Thread Bulat Ziganshin
Hello Johannes, Monday, September 6, 2010, 2:23:35 PM, you wrote: i had such idea several years ago and proposed to name class ListLike. this class was finally implemented by John Goerzen and it does everything we can w/o changing language the main thing about literals is that they need to be

Re: [Haskell-cafe] overloaded list literals?

2010-09-06 Thread Sebastian Fischer
On Sep 6, 2010, at 12:23 PM, 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)? As lists of some type A represent

Re: [Haskell-cafe] overloaded list literals?

2010-09-06 Thread Wolfgang Jeltsch
Am Montag, den 06.09.2010, 11:47 +0100 schrieb Neil Brown: I would have thought you have two obvious choices for the type-class (things like folding are irrelevant to overloading list literals): class IsList f where fromList :: [a] - f a or: class IsList f where cons :: a - f a

Re: [Haskell-cafe] overloaded list literals?

2010-09-06 Thread Stefan Holdermans
Wolfgang, We should definitely get rid of these Is* class identifiers like IsString and IsList. We also don’t have IsNum, IsMonad, etc. I see your point. For strings, however, there was of course never the possibility to dub the class String as that name is already taken by the type synonym.

Re: [Haskell-cafe] overloaded list literals?

2010-09-06 Thread Henning Thielemann
On Mon, 6 Sep 2010, Stefan Holdermans wrote: Wolfgang, We should definitely get rid of these Is* class identifiers like IsString and IsList. We also don’t have IsNum, IsMonad, etc. I see your point. For strings, however, there was of course never the possibility to dub the class String as

Re: [Haskell-cafe] overloaded list literals?

2010-09-06 Thread Sebastian Fischer
On Sep 6, 2010, at 1:47 PM, Stefan Holdermans wrote: In general, it is kind of unfortunate that type classes and type constructors share a namespace, even though there is no way to ever mix them up. Class and type names mix in im- and export lists. IIRC, this is the reason for putting

Re[2]: [Haskell-cafe] overloaded list literals?

2010-09-06 Thread Bulat Ziganshin
Hello Stefan, Monday, September 6, 2010, 3:47:11 PM, you wrote: In general, it is kind of unfortunate that type classes and type constructors share a namespace, even though there is no way to ever mix them up. btw, i also had proposal to automatically convert typeclasses used in type

Re: [Haskell-cafe] overloaded list literals?

2010-09-06 Thread Bulat Ziganshin
Hello Johannes, Monday, September 6, 2010, 2:23:35 PM, you wrote: so how about using list syntax ( [], : ) for anything list-like (e.g., Data.Sequence)? i'vwe found my own proposal of such type: http://www.mail-archive.com/haskell-cafe@haskell.org/msg15656.html -- Best regards, Bulat

Re: [Haskell-cafe] overloaded list literals?

2010-09-06 Thread Serguey Zefirov
2010/9/6 Bulat Ziganshin bulat.zigans...@gmail.com: Hello Johannes, Monday, September 6, 2010, 2:23:35 PM, you wrote: so how about using list syntax ( [], : ) for anything list-like (e.g., Data.Sequence)? i'vwe found my own proposal of such type:

Re[2]: [Haskell-cafe] overloaded list literals?

2010-09-06 Thread Bulat Ziganshin
Hello Serguey, Monday, September 6, 2010, 7:57:46 PM, you wrote: http://www.mail-archive.com/haskell-cafe@haskell.org/msg15656.html Will Data.Map with its' empty, insert, findMin, etc, methods conform to your proposed type? but Data.Map isn't sequential container. instead, it maps arbitrary

Re[4]: [Haskell-cafe] overloaded list literals?

2010-09-06 Thread Bulat Ziganshin
Hello Serguey, Monday, September 6, 2010, 8:16:03 PM, you wrote: Basically, you - and others, - propose to add another class isomorphic to already present lists. I think, most benefits of that class can be achieved by using list conversion and RULE pragma. what i propose should allow to

Re: [Haskell-cafe] overloaded list literals?

2010-09-06 Thread Gábor Lehel
On Mon, Sep 6, 2010 at 12:47 PM, Neil Brown nc...@kent.ac.uk wrote: On 06/09/10 11:23, 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

Re: Re[2]: [Haskell-cafe] overloaded list literals?

2010-09-06 Thread Stefan Holdermans
Bulat, btw, i also had proposal to automatically convert typeclasses used in type declarations into constraints, [...] Together with proposals i mentioned previously, it will allow to treat existing code dealing with lists/strings as generic code working with any sequential container type

Re: Re[4]: [Haskell-cafe] overloaded list literals?

2010-09-06 Thread Serguey Zefirov
2010/9/6 Bulat Ziganshin bulat.zigans...@gmail.com: Hello Serguey, Monday, September 6, 2010, 8:16:03 PM, you wrote: Basically, you - and others, - propose to add another class isomorphic to already present lists. I think, most benefits of that class can be achieved by using list conversion

Re: Re[2]: [Haskell-cafe] overloaded list literals?

2010-09-06 Thread Wolfgang Jeltsch
Am Montag, den 06.09.2010, 19:38 +0400 schrieb Bulat Ziganshin: btw, i also had proposal to automatically convert typeclasses used in type declarations into constraints, so that: putStr :: StringLike - IO () treated as putStr :: StringLike s = s - IO () This blurs the distinction between