[Haskell-beginners] Re: Pure Regex.PCRE Possible? (PLEAC, Fix Style)

Volkan YAZICI yazicivo at ttmail.com
Sun Dec 20 09:34:11 EST 2009


On Sat, 19 Dec 2009, Volkan YAZICI <yazicivo at ttmail.com> writes:
> I'm trying to implement FixStyle[1] program of PLEAC[2] for Haskell.
> (It's missing in the Haskell version of PLEAC.) For this purpose, I
> needed regular expressions. (Now, I have two problems!)  Despite, my
> code is, IMHO, quite purely functional, Regex.PCRE.String functions
> totally mess up the design with impure functions they introduce even for
> really simple string matching stuff.
>
> If you'd check out the sources[3], you'll see below impure functions.
>
>   transDictRegex :: IO PCRE.Regex
>   matchRegex :: String -> IO (String, String, String)
>   translate :: String -> IO String
>
> However, if I'm not mistaken, above functions _should_ be absolutely
> pure. Is it possible to encapsulate impure PCRE functions into their
> pure equivalents?
>
> BTW, why are PCRE functions impure?

OTH, I'm looking at my "translate" and it fails on infinite strings. Is
it because of something lacking in my implementation, or a limitation of
Regex.PCRE?


Regards.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: FixStyle.hs
Type: text/x-haskell
Size: 2113 bytes
Desc: not available
Url : http://www.haskell.org/pipermail/beginners/attachments/20091220/f30cf389/FixStyle.bin


More information about the Beginners mailing list