greet.tri (554B)
1 !import 2d23be85d277457fd36c84f5eaa227e94e1c4efec281ff73017aaee109096f49 as IO 2 !export main 3 4 -- A conversation built from the IO library's actions and explicit bind operator. 5 -- Evaluate main in Browser IO mode, then answer in the terminal input. 6 -- The returned name is also displayed as Text. Try changing the greeting. 7 -- Importing IO does not grant filesystem or network access in the browser. 8 main = (IO.io (do IO.bind 9 IO.putStr "What is your name?\n" 10 name <- IO.getLine 11 IO.putStr "Hello, " 12 IO.putStr name 13 IO.putStr "!\n" 14 IO.pure name))