mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-26 21:39:07 +00:00
18 lines
420 B
Text
18 lines
420 B
Text
app "test"
|
|
imports [TotallyNotJson]
|
|
provides [main] to "./platform"
|
|
|
|
HelloWorld := {} implements [Encoding {toEncoder}]
|
|
|
|
toEncoder = \@HelloWorld {} ->
|
|
Encode.custom \bytes, fmt ->
|
|
bytes
|
|
|> Encode.appendWith (Encode.string "Hello, World!\n") fmt
|
|
|
|
f =
|
|
when Str.fromUtf8 (Encode.toBytes (@HelloWorld {}) TotallyNotJson.json) is
|
|
Ok s -> s
|
|
_ -> "<bad>"
|
|
|
|
main = f
|
|
# ^ Str
|