Type of callstacks constructed automatically from
callStackto get the current callstack, and use
getCallStackto deconstruct the
- type HasCallStack
= IP “callStack” CallStack
CallStack. Use this as a constraint in type signatures in order to get nicer callstacks for error and debug messages.
For example, instead of declaring the following type signature:
myFunction : Int -> Update ()
You can declare a type signature with the
myFunction : HasCallStack => Int -> Update ()
myFunctionwill still be called the same way, but it will also show up as an entry in the current callstack, which you can obtain with
Note that only functions with the
HasCallStackconstraint will be added to the current callstack, and if any function does not have the
HasCallStackconstraint, the callstack will be reset within that function.