mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-26 13:29:12 +00:00
24 lines
518 B
Text
24 lines
518 B
Text
app [main!] { pf: platform "../test-platform-effects-zig/main.roc" }
|
|
|
|
import pf.Effect
|
|
|
|
main! : {} => {}
|
|
main! = \{} ->
|
|
_ =
|
|
authenticate! {}
|
|
|> Result.onErr! \BadPass ->
|
|
Effect.putLine! "LOG: Failed login attempt"
|
|
Ok "Bad password"
|
|
|
|
{}
|
|
|
|
authenticate! : {} => Result Str [BadPass]
|
|
authenticate! = \{} ->
|
|
Effect.putLine! "Enter your password:"
|
|
|
|
password = Effect.getLine! {}
|
|
|
|
if password == "password" then
|
|
Ok "You are in"
|
|
else
|
|
Err BadPass
|