Skip to content
  • Joachim Breitner's avatar
    3417a81a
    undefined: Neater CallStack in error message · 3417a81a
    Joachim Breitner authored and Marge Bot's avatar Marge Bot committed
    Users of `undefined` don’t want to see
    ```
    files.hs: Prelude.undefined:
    CallStack (from HasCallStack):
      error, called at libraries/base/GHC/Err.hs:79:14 in base:GHC.Err
      undefined, called at file.hs:151:19 in main:Main
    ```
    but want to see
    ```
    files.hs: Prelude.undefined:
    CallStack (from HasCallStack):
      undefined, called at file.hs:151:19 in main:Main
    ```
    so let’s make that so.
    
    The function for that is `withFrozenCallStack`, but that is not usable
    here (module dependencies, and also not representation-polymorphic). And
    even if it were, it could confuse GHC’s strictness analyzer, leading to
    big regressions in some perf tests (T10421 in particular).
    
    So after shuffling modules and definitions around, I eventually noticed
    that the easiest way is to just not call `error` here.
    
    Fixes #19886
    3417a81a
    undefined: Neater CallStack in error message
    Joachim Breitner authored and Marge Bot's avatar Marge Bot committed
    Users of `undefined` don’t want to see
    ```
    files.hs: Prelude.undefined:
    CallStack (from HasCallStack):
      error, called at libraries/base/GHC/Err.hs:79:14 in base:GHC.Err
      undefined, called at file.hs:151:19 in main:Main
    ```
    but want to see
    ```
    files.hs: Prelude.undefined:
    CallStack (from HasCallStack):
      undefined, called at file.hs:151:19 in main:Main
    ```
    so let’s make that so.
    
    The function for that is `withFrozenCallStack`, but that is not usable
    here (module dependencies, and also not representation-polymorphic). And
    even if it were, it could confuse GHC’s strictness analyzer, leading to
    big regressions in some perf tests (T10421 in particular).
    
    So after shuffling modules and definitions around, I eventually noticed
    that the easiest way is to just not call `error` here.
    
    Fixes #19886
Loading