mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-29 14:54:47 +00:00
15 lines
441 B
Text
15 lines
441 B
Text
app "task-example"
|
|
packages { base: "platform" }
|
|
imports [ base.Task.{ Task }, base.File, base.Path ]
|
|
provides [ main ] to base
|
|
|
|
main : Task.Task {} (File.FileReadErr [BadUtf8])
|
|
main =
|
|
when Path.fromStr "Cargo.toml" is
|
|
Ok path ->
|
|
{} <- Task.await (Task.putLine "Our Cargo.toml:")
|
|
|
|
line <- Task.await (File.readUtf8 path)
|
|
|
|
Task.putLine line
|
|
_ -> Task.putLine "invalid path"
|