Clarification of HasCallStack
A function with a HasCallStack constraint seems to always have a non-empty call stack, but the Haddock documentation for GHC.Stack in base-4.16.1.0 doesn't say anything about it specifically, and the assumptions made in the source code are inconsistent. For example, the withFrozenCallStack function assumes that the call stack is non-empty by calling the partial popCallStack function, whereas the callStack function checks if the stack is empty before calling popCallStack.
Is the only way to end up with an empty call stack to leave out the HasCallStack constraint? Or in other words, is it safe for application code to assume that the call stack is always non-empty in the presence of HasCallStack?
Could this ambiguity be resolved by representing call stacks as non-empty lists, and provide a compile error instead of an empty list if the HasCallStack constraint is missing?