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

Volkan YAZICI yazicivo at ttmail.com
Sat Dec 19 08:37:45 EST 2009


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?


[1] http://pleac.sourceforge.net/pleac_perl/strings.html
[2] http://pleac.sourceforge.net/
[3] http://hpaste.org/fastcgi/hpaste.fcgi/view?id=14422

More information about the Beginners mailing list