mirror of
https://github.com/roc-lang/roc.git
synced 2025-08-08 14:18:03 +00:00
24 lines
530 B
Text
24 lines
530 B
Text
app [main!] { pf: platform "../test-platform-effects-zig/main.roc" }
|
|
|
|
import pf.Effect
|
|
|
|
main! : {} => {}
|
|
main! = \{} ->
|
|
_ =
|
|
authenticate!({})
|
|
|> Result.on_err!(\BadPass ->
|
|
Effect.put_line!("LOG: Failed login attempt")
|
|
Ok("Bad password"))
|
|
|
|
{}
|
|
|
|
authenticate! : {} => Result Str [BadPass]
|
|
authenticate! = \{} ->
|
|
Effect.put_line!("Enter your password:")
|
|
|
|
password = Effect.get_line!({})
|
|
|
|
if password == "password" then
|
|
Ok("You are in")
|
|
else
|
|
Err(BadPass)
|