[Haskell-cafe] csv one-liner
Ketil Malde
ketil at malde.org
Wed Oct 1 16:59:55 EDT 2008
Andrew Coppin <andrewcoppin at btinternet.com> writes:
>> (writeFile "output.csv") =<< (liftM printCSV $ liftM (map
>> updateLine) $ parseCSVFromFile "input.csv")
> Um... Does anybody else find it interesting that we are "showing the
> beauty of Haskell" by attempting to construct the most terse, cryptic,
> unmaintainable tangle of point-free code
I don't agree at all! How could a pipeline like this possibly be more
clearly expressed than by the pattern:
readInputFile "input" >>= mungeStuff >>= writeOutputFile "output"
? The OP asks for improvements, which got rid of a couple of
gratuitous liftMs and such, but otherwise I think it's a pretty
straightforward idiom.
-k
--
If I haven't seen further, it is by standing in the footprints of giants
More information about the Haskell-Cafe
mailing list