mirror of
https://github.com/roc-lang/roc.git
synced 2024-11-11 05:34:11 +03:00
24 lines
640 B
Plaintext
24 lines
640 B
Plaintext
app "test-base64"
|
|
packages { pf: "platform" }
|
|
imports [ pf.Task, Base64 ]
|
|
provides [ main ] to pf
|
|
|
|
IO a : Task.Task a []
|
|
|
|
main : IO {}
|
|
main =
|
|
when Base64.fromBytes (Str.toUtf8 "Hello World") is
|
|
Err _ ->
|
|
Task.putLine "sadness"
|
|
|
|
Ok encoded ->
|
|
Task.after
|
|
(Task.putLine (Str.concat "encoded: " encoded))
|
|
\_ ->
|
|
when Base64.toStr encoded is
|
|
Ok decoded ->
|
|
Task.putLine (Str.concat "decoded: " decoded)
|
|
|
|
Err _ ->
|
|
Task.putLine "sadness"
|