mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-12 06:46:19 +00:00
48 lines
1.1 KiB
Text
48 lines
1.1 KiB
Text
app [main] { pf: platform "platform/main.roc" }
|
|
|
|
# see https://github.com/roc-lang/roc/issues/985
|
|
main : Task {} []
|
|
main = closure1 {}
|
|
# |> Task.after (\_ -> closure2 {})
|
|
# |> Task.after (\_ -> closure3 {})
|
|
# |> Task.after (\_ -> closure4 {})
|
|
# ---
|
|
closure1 : {} -> Task {} []
|
|
closure1 = \_ ->
|
|
Task.ok (foo toUnitBorrowed "a long string such that it's malloced")
|
|
|> Task.map \_ -> {}
|
|
|
|
toUnitBorrowed = \x -> Str.countUtf8Bytes x
|
|
|
|
foo = \f, x -> f x
|
|
|
|
# ---
|
|
# closure2 : {} -> Task.Task {} []
|
|
# closure2 = \_ ->
|
|
# x : Str
|
|
# x = "a long string such that it's malloced"
|
|
#
|
|
# Task.succeed {}
|
|
# |> Task.map (\_ -> x)
|
|
# |> Task.map toUnit
|
|
#
|
|
# toUnit = \_ -> {}
|
|
#
|
|
# # ---
|
|
# closure3 : {} -> Task.Task {} []
|
|
# closure3 = \_ ->
|
|
# x : Str
|
|
# x = "a long string such that it's malloced"
|
|
#
|
|
# Task.succeed {}
|
|
# |> Task.after (\_ -> Task.succeed x |> Task.map (\_ -> {}))
|
|
#
|
|
# # ---
|
|
# closure4 : {} -> Task.Task {} []
|
|
# closure4 = \_ ->
|
|
# x : Str
|
|
# x = "a long string such that it's malloced"
|
|
#
|
|
# Task.succeed {}
|
|
# |> Task.after (\_ -> Task.succeed x)
|
|
# |> Task.map (\_ -> {})
|