Bug--for aborting programs

In some circumstances, you may want to stop your program immediately without allowing any caller of the function to catch or handle the error. For that you can use the built in function base.bug in Unison. Unlike Optional or Either - if you call base.bug in a function, you do not need to represent the possibility of the failure in the function's signature as a data type for the caller to manage.

You can provide a term or expression of any type to base.bug and the UCM will render that value to the console.

Calling the function above with superProgram false will abort the running program with the message

💔💥

I've encountered a call to builtin.bug with the following value:

  Failure (typeLink Generic) "Fatal Issue Encountered" (Any false)

🚩 Use base.bug judiciously, as there is currently no way for a program to recover from a call to base.bug.