Sed implementation in Haskell