Advertisement
Guest User

Untitled

a guest
Apr 21st, 2019
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. type Editor = (String, String, String)
  2.  
  3. showEditor :: Editor -> String
  4. showEditor (left, "", right) = left ++ "|" ++ right
  5. showEditor (left, selection, right) = left ++ "[" ++ selection ++ "]" ++ right
  6.  
  7. main = do
  8.     let e = ("hello ", "silly", " world")
  9.     let fileName = "myeditor.txt"
  10.     writeFile fileName (show e)
  11.     contents <- readFile fileName
  12.     let e2 = read contents::Editor
  13.     putStrLn $ showEditor e2
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement