Существует ли API высокого уровня для выполнения поиска и замены с помощью регулярных выражений в Haskell? В частности, я смотрю пакеты Text.Regex.TDFA
или Text.Regex.Posix
. Мне бы очень хотелось что-то типа:
f :: Regex -> (ResultInfo -> m String) -> String -> m String
так, например, чтобы заменить "собаку" на "кошку", вы могли бы написать
runIdentity . f "dog" (return . const "cat") -- :: String -> String
или делать более продвинутые вещи с монадой, например, подсчеты и т.д.
Документация Haskell для этого довольно не хватает. Некоторые низкоуровневые примечания API здесь.