Several subtle IODriver bug fixes
This commit is contained in:
25
demos/interactionTrees/getLineAsync.tri
Normal file
25
demos/interactionTrees/getLineAsync.tri
Normal file
@@ -0,0 +1,25 @@
|
||||
-- Manual test for async getLine
|
||||
--
|
||||
-- Run with:
|
||||
-- nix run .# -- eval -f demos/async-getline-test.tri --io
|
||||
--
|
||||
-- Expected behaviour:
|
||||
-- 1. You immediately see:
|
||||
-- Please enter your first name:
|
||||
-- (this printed before you typed anything)
|
||||
-- (this second line also printed before you typed anything)
|
||||
-- 2. You type your name and press Enter.
|
||||
-- 3. You see:
|
||||
-- Hello, <name>!
|
||||
|
||||
!import "../lib/io.tri" !Local
|
||||
|
||||
main = io <|
|
||||
bind (fork getLine) (h :
|
||||
bind (putStr "Please enter your first name: ") (_ :
|
||||
bind (putStr "\n(this printed before you typed anything)\n") (_ :
|
||||
bind (putStr "\n(this second line also printed before you typed anything)\n") (_ :
|
||||
bind (await h) (name :
|
||||
bind (putStr "Hello, ") (_ :
|
||||
bind (putStr name) (_ :
|
||||
putStr "!\n")))))))
|
||||
Reference in New Issue
Block a user