mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-29 14:54:47 +00:00
18 lines
531 B
Text
18 lines
531 B
Text
app "custom-malloc-example"
|
|
packages { base: "platform" }
|
|
imports [ base.Task.{ Task } ]
|
|
provides [ main ] to base
|
|
|
|
main : Task.Task {} []
|
|
main =
|
|
_ <- Task.await (Task.putLine "About to allocate a list!")
|
|
|
|
# This is the only allocation in this Roc code!
|
|
# (The strings all get stored in the application
|
|
# binary, and are never allocated on the heap.)
|
|
list = [ 1, 2, 3, 4 ]
|
|
|
|
if List.len list > 100 then
|
|
Task.putLine "The list was big!"
|
|
else
|
|
Task.putLine "The list was small!"
|