[Haskell-beginners] Review request
C K Kashyap
ckkashyap at gmail.com
Sun Jul 15 14:08:29 CEST 2012
I've written a small haskell program to extract a section from a file
between start and end markers. For example, if I have a file such as below
I'd like to extract the contents between <bug> and </bug> (including the
startTag = "<bug>"endTag = "</bug>"
process = unlines . specialTakeWhile (f endTag) . dropWhile (f
startTag) . lines
where f t x = not (x =~ t)
specialTakeWhile :: (a -> Bool) -> [a] -> [a]
specialTakeWhile ff  = 
specialTakeWhile ff (x:xs) = if ff x then
x:(specialTakeWhile ff xs) else [x]
It'll be great if I could get some feedback on this.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Beginners