unison/unison-src/transcripts/todo-bug-builtins.md
2024-06-25 11:11:07 -07:00

690 B

The todo and bug builtin

scratch/main> builtins.merge

todo and bug have type a -> b. They take a message or a value of type a and crash during runtime displaying a in ucm.

> todo "implement me later"
> bug "there's a bug in my code"

Todo

todo is useful if you want to come back to a piece of code later but you want your project to compile.

complicatedMathStuff x = todo "Come back and to something with x here"

Bug

bug is used to indicate that a particular branch is not expected to execute.

test = match true with
    true -> "Yay"
    false -> bug "Wow, that's unexpected"