HVM
HVM copied to clipboard
Add a builtin for panic/crash
Opening this issue based on Discord discussion.
I'd like to have a way to crash at runtime. For example, Elm programs have Debug.todo which is sometimes useful.
I've tried to use the "cloning non-affine functions" method, but it doesn't work when you're using currying:
type Unit = Unit
panic _ =
let nonaffine = @a (a,a)
let boom = (nonaffine,nonaffine)
(panic (Unit/Unit)) # doesn't work when we use `panic a = let ...; (panic a)`
# successfully crashes (ERROR: attempt to clone a non-affine global reference.)
Basics/append a b = (panic (Unit/Unit))
# doesn't work, hangs CPU
Basics/append = (panic (Unit/Unit))
main = (Basics/append "a" "b")