Or for a bit of variety:
selectPlus s = [cs | ('+':cs) <- lines s]
--Ben
On 4 Sep 2009, at 20:40, Martijn van Steenbergen wrote:
Hi Serge,
Serge LE HUITOUZE wrote:
I'm asking some advice on a small piece of code representing a
simplified version of a treatment I need to perform.
I have a line-oriented string/file, from which I want to extract
only a substring of those lines starting with char '+' (the detail
of the extraction is irrelevant here, I'll just return what follows
the '+').
This isn't really answering your question, but I thought I'd share
anyway: why use Parsec to retrieve those lines? It seems a simple
function is a lot easier:
selectPlus :: String -> [String]
selectPlus = map tail . filter ((== '+') . head) . lines
I hope this helps you.
Martijn.
_______________________________________________
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