mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-26 21:39:07 +00:00
make echo example work (with loop, not yet with forever)
This commit is contained in:
parent
7e28d557ec
commit
d3b51ea8ea
1 changed files with 4 additions and 2 deletions
|
@ -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
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue