make echo example work (with loop, not yet with forever)

This commit is contained in:
Folkert 2022-01-22 15:09:28 +01:00 committed by Jan Van Bruggen
parent 7e28d557ec
commit d3b51ea8ea

View file

@ -3,11 +3,13 @@ app "echo"
imports [ pf.Stdin, pf.Stdout, pf.Task ] imports [ pf.Stdin, pf.Stdout, pf.Task ]
provides [ main ] to pf provides [ main ] to pf
main : Task.Task {} * main : Task.Task {} []
main = main =
_ <- Task.await (Stdout.line "Shout into this cave and hear the echo!") _ <- Task.await (Stdout.line "Shout into this cave and hear the echo!")
Task.forever tick Task.loop {} (\{} -> Task.map tick Step)
# Task.forever tick # still does not work; loops for a while, then stack overflows for me
tick : Task.Task {} []
tick = tick =
shout <- Task.await Stdin.line shout <- Task.await Stdin.line
Stdout.line shout Stdout.line shout