
Hi, I need to parse a string to a list of integer, like this: "12 32\n15...." to [12,32,15...] f :: String -> [Int] What I´ve found is the function "words" which does words :: String -> [String] it is in the Prelude.hs then if I have something like "12 32\n15..." with words I get ["12","32","15"...] which is cool but not exactly what I need. Would you help me? Thanks J. ------------------------------------ Porque la única lucha que se pierde, es la que se abandona, ¡Ni un paso atrás!

"Juan" == Juan M Duran
writes:
Juan> then if I have something like "12 32\n15..." with words I get Juan> ["12","32","15"...] Juan> which is cool but not exactly what I need. Would you help me? just compose it with (map read). Function read takes a string and converts it to the target type, presumed this type belongs to the type class Read and the string is a correct printing of an element of this type. -- Christoph

Hi, I'm writting a small parser in Haskell and, when it is all done, I get the following problem: Type Binding. The thing is, I have 3 main functions: 1) Read the file, its type is: [Char] ->IO [Char] (see InputOutput.hs) 2) Parse a string (using words and readDec), its type is: Integral a => [Char] -> [a] (see Parse.hs) 3) Parse a list of integer, its type is: [Float] -> [[Float]] (Functions.hs) Now the problem is that I cannot run the first function, then use its results as an input of the second function and, finally, its results as the input of the third function. How can I fix this without modifing all my functions because they, independly, works fine. Juan ------------------------------------ Porque la única lucha que se pierde, es la que se abandona, ¡Ni un paso atrás!
participants (2)
-
Ch. A. Herrmann
-
Juan M. Duran