Skip to content

Instantly share code, notes, and snippets.

@xintron
Created January 13, 2014 19:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save xintron/8406660 to your computer and use it in GitHub Desktop.
Save xintron/8406660 to your computer and use it in GitHub Desktop.
import qualified Data.Text.Lazy as T (Text, lines, unlines)
import qualified Data.Text.Lazy.IO as TIO (interact)
data Command = Next
| Print
sed :: T.Text -> T.Text
sed t = T.unlines $ concat $ map (runCommands [Print]) $ T.lines t
runCommands :: [Command] -> T.Text -> [T.Text]
runCommands cs xs = map (runCommand xs) cs
runCommand :: T.Text -> Command -> T.Text
runCommand t Print = t
runCommand t Next = undefined
main :: IO ()
main = TIO.interact sed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment