On Mon, 21 Jul 2008 06:51:27 +0200, Felipe Lessa <felipe.lessa@gmail.com>
wrote:
On Sun, Jul 20, 2008 at 10:30 PM, Rafael Gustavo da Cunha Pereira
Pinto <rafaelgcpp@gmail.com> wrote:
convert :: String -> [Int]
convert = map read . words
read :: FilePath -> IO [[Int]]
read fp = (map convert . lines) `fmap` readFile fp
If a single list of Ints is OK, the code can be much simpler:
read' :: FilePath -> IO [Int]
read' fp = (map read . words) `fmap` readFile fp
--
Met vriendelijke groet,
Henk-Jan van Tuyl
--
http://functor.bamikanarie.com
http://Van.Tuyl.eu/
--
_______________________________________________
Beginners mailing list
Beginners@haskell.org
http://www.haskell.org/mailman/listinfo/beginners