I can't think of a language that lets you do this; that is, allow you to input a list of any type as text.
Some languages effectively encode the types in the parsing, for example in LISP, you know that 'foo is a symbol. It has a very limited set of data types and new types are described entirely in terms of those simple types, which makes parsing simple. But lets say you have > data Color = Red | Green | Blue deriving (Read,Show,Eq,Ord) Now you suddenly expect "readLn" to detect the word "Green" and interpret it differently from "1.0", restricting the type at runtime? Do you realize how difficult this is? What if Green is also used in a type in another module? You need to specify the type to read, or provide a parser that works for every type you care about. -- ryan On Fri, Oct 17, 2008 at 2:21 PM, leledumbo <[EMAIL PROTECTED]> wrote: > > So, what's the solution? This one: > > (l::[Ord]) <- readLn > > doesn't work (because Ord isn't a type constructor). It doesn't even comply > to Haskell 98 standard. I want to be able to read any list of ordered > elements. > -- > View this message in context: > http://www.nabble.com/List-as-input-tp19987726p20033244.html > Sent from the Haskell - Haskell-Cafe mailing list archive at Nabble.com. > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe@haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe > _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe