Files
exercism-workspace/treasure-chest/src/treasure_chest.gleam
Alexander Heldt 5fb5492306 tresure-chest
2025-11-02 16:11:11 +01:00

22 lines
371 B
Gleam

pub type TreasureChest(a) {
TreasureChest(String, a)
}
pub type UnlockResult(a) {
Unlocked(a)
WrongPassword
}
pub fn get_treasure(
chest: TreasureChest(treasure),
password: String,
) -> UnlockResult(treasure) {
case chest {
TreasureChest(pass, a) ->
case pass == password {
False -> WrongPassword
True -> Unlocked(a)
}
}
}