4 ms·
I think List plays a much more integral role in Haskell than it would in a strict language like this. In Haskell, list is irreplaceable because it can correspo
by sixbrx 12y ago
I think List plays a much more integral role in Haskell than it would in a strict language like this. In Haskell, list is irreplaceable because it can correspond to a value and a thunk for the rest of a result stream, so it's a very special data structure because of the relationship to the language's laziness.
In a strict language though, the list is just a list - nothing special, and users may want to replace it with library variants with different performance tradeoffs (this even happens in Haskell of course for some problem areas). Since this is the case, a uniform treatment may be preferred, where the type name is just like any other type name, construction is just as any other type's construction, and the type is in fact just supplied by a library not the compiler. I don't know if this was the developers' thinking (I'm not involved), but uniformity has its advantages.
Also, I don't think it's really clear that [] is easier to read, especially when it's surrounded by other syntax like parens and braces - it doesn't stand out much, which can be good or bad depending on personal preferrences and the surroundings. Rust recently moved from [] -> Vec for vectors and I think it's easier to read that way, personally.