[Haskell-beginners] Re: why is something different within a function when it comes out?

prad prad at towardsfreedom.com
Wed Jul 14 16:41:00 EDT 2010


On Wed, 14 Jul 2010 10:54:22 +0200
Chaddaï Fouché <chaddai.fouche at gmail.com> wrote:

> In fact xtract could be written :
> > xtract p c = (c =~ p :: [[String]]) !! 0 !! 1 
this is exactly what i was trying to do but couldn't figure out how to
write it because i couldn't get my head around the return. it seems so
simple when someone else does it. :D

thx for your explanations chaddai and you too michael.

this (as well as some crude attempts i've used earlier) work nicely on
text enclosed in single lines, but find nothing for multiple lines. in
python, there is a dotall or re.S flag so that things can be searched
for over \n in the text. i can't figure out how to do this here.

i looked at
http://hackage.haskell.org/packages/archive/regex-tdfa/1.1.3/doc/html/Text-Regex-TDFA.html
but am having difficulty figuring things out from the documentation -
and there doesn't seem to be any multiline feature.
surely there is some way to do this!

also, python had a re.sub so you can replace things using regex
searchs. how would you go about doing that in haskell?

-- 
In friendship,
prad

                                      ... with you on your journey
Towards Freedom
http://www.towardsfreedom.com (website)
Information, Inspiration, Imagination - truly a site for soaring I's


More information about the Beginners mailing list