~repos /plum

#treesitter#compiler#wasm

git clone https://pyrossh.dev/repos/plum.git

A statically typed, imperative programming language inspired by rust, python



libs/std/bool.plum



module std
type Int
add<Int>(b: Int) -> Int = this + b
sub<Int>(b: Int) -> Int = this - b
enum Bool =
| True
| False
parseBool<Str>() -> Result(Bool, Err) =
if s == "true"
True
else if s == "false"
False
else
Err("could not parse bool from '{s}'")
and<Bool>(o: Bool) -> Bool =
match this, o
True, True => True
True, False => False
False, True => False
False, False => False
or<Bool>(o: Bool) -> Bool =
match this, o
True, True => True
True, False => True
False, True => True
False, False => False
toStr<Bool>() -> Str =
match this
True => "True"
False => "False"