[GHC] #11035: Add implicit call-stacks to partial functions in base

GHC ghc-devs at haskell.org
Sun Nov 1 20:03:55 UTC 2015


#11035: Add implicit call-stacks to partial functions in base
-------------------------------------+-------------------------------------
        Reporter:  gridaphobe        |                Owner:
            Type:  feature request   |               Status:  new
        Priority:  normal            |            Milestone:
       Component:  Compiler          |              Version:  7.10.2
      Resolution:                    |             Keywords:
Operating System:  Unknown/Multiple  |         Architecture:
                                     |  Unknown/Multiple
 Type of failure:  None/Unknown      |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:                    |  Differential Rev(s):
       Wiki Page:                    |
-------------------------------------+-------------------------------------

Comment (by gridaphobe):

 Replying to [comment:10 goldfire]:
 > Replying to [comment:5 nomeata]:
 > > In fact, what I do not like about
 > > {{{
 > > ghci> minimumBy compare []
 > > *** Exception: Prelude.foldr1: empty list
 > > CallStack:
 > >   error, called at libraries/base/GHC/List.hs:999:3 in
 base-4.8.2.0:GHC.List
 > > }}}
 > > is that it leaks implementation details. This is great in your own
 code, but a polished library should _not_ leak a call stack about its
 details; it should either print plain exception or the call stack that
 finishes at the library’s API. At least for “expected exceptions” like
 `"empty list"`.
 >
 > I disagree with this push toward perfection. I understand what you're
 getting at here, and I agree in principle. But I think this issue (which
 does seem to be independent from the original ticket) is not terribly
 important to solve. In other languages, I've seen standard libraries spill
 their implementation details all over the place in stack traces.

 I'm generally inclined to agree that there's no harm in spilling
 implementation details in the stack trace, I can't think of a single
 language that lets you do what Joachim is suggesting. That being said, it
 sounds like it could be a very lightweight extension of the existing
 machinery, so it might be interesting to experiment with. But it probably
 should be a separate ticket :)

--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/11035#comment:14>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the ghc-tickets mailing list