I guess I missed the controversy over at ICFP, but I would like to know why overloading of lists is being eliminated. Arguments for Overloading: 1. Generality/Re-use is good The big point of Hughes "Why Functional Progamming Matters" is that functional programming enables much more high level notions of re-use and that is a good thing. If you eliminate overloading of the ++ operator then it is much less straightforward to replace code which uses Lists as a collection type with code that uses Trees as its collection type. Now that you are adding MPTC, the argument in favor or retaining ++ as an overloaded operator is even stronger. It would be a pity to have to go through that code, find every instance of ++ and replace it with mplus. It makes more sense to encourage programmers to use reusable constructs from day 1. The most reusable constructs are the overloaded operators. 2. Provide a path for beginners to learn the generalization The overloading constructs provide a path for a newby (like me) to learn how to generalize concepts like e.g. Lists to arbitrary monads (still working on this one). Eliminating overloading makes it that much harder for someone who has learned Haskell basics to move from understanding ++ as the concatentation operator to understanding that xs ++ ys really means "the content of xs" orelse "the content of ys". This generality allows me to go from understanding ++ as list concatenation to understanding ++ as collection type combination to understanding ++ as describing a certain type of computation (the backtracking monad). -- >From the discussion of Integer vs. Int, it seems like the best objection to overloading is that error messages are hard for beginners to understand. This doesn't strike me as an argument against overloading but rather an argument in favor of a better error reporting mechanism. I am not sure how it would work, but I think that one could construct an error reporting mechanism with special purpose errors for special purpose uses that are common. E.g. a type error involving use of lists and ++ might generate a different error message from the same type error involving a less common type. -Alex- ___________________________________________________________________ S. Alexander Jacobson i2x Media 1-212-697-0184 voice 1-212-697-1427 fax
Re: Haskell 98 -- Overloading
S. Alexander Jacobson Fri, 16 Oct 1998 11:25:54 -0400 (Eastern Daylight Time)