roc/examples/custom-malloc/Main.roc
2021-05-23 23:46:09 -04:00

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!"