[GHC] #9049: Expose srcLoc from the assertion architecture to allow better error messages

GHC ghc-devs at haskell.org
Wed Nov 12 22:14:25 UTC 2014


#9049: Expose srcLoc from the assertion architecture to allow better error
messages
-------------------------------------+-------------------------------------
              Reporter:  nh2         |            Owner:
                  Type:  feature     |           Status:  new
  request                            |        Milestone:
              Priority:  normal      |          Version:  7.8.2
             Component:  Compiler    |         Keywords:
            Resolution:              |     Architecture:  Unknown/Multiple
      Operating System:              |       Difficulty:  Unknown
  Unknown/Multiple                   |       Blocked By:
       Type of failure:              |  Related Tickets:
  None/Unknown                       |
             Test Case:              |
              Blocking:              |
Differential Revisions:              |
-------------------------------------+-------------------------------------

Comment (by rodlogic):

 I read the wiki:ExplicitCallStack/ImplicitLocations, and the general
 approach makes sense. The notion of a stack of source locations startes to
 loose me, though. Could you give a more explicit example?

 Does it basically mean that {{{show (?location :: Location)}}} below will
 render g's location and g's caller location? Or am I misunderstanding
 this?
 {{{
 h :: [a] -> Int
 h as = f as

 g :: (?location :: Location) => [a] -> Int
 g as = f as

 f :: (?location :: Location) => [a] -> Int
 f []     = error ("Failure at " ++ show (?location :: Location))
 f (x:xs) = ...
 }}}

 Could you point me to:
 1. In what module should Location be created?
 2. Where in the type checker should a Location be created?
 3. Where should Locations be pushed?

 I can then take a closer look and come back with additional questions.

 @nh2 I am not sure how far along you are with this, so ping me if this is
 basically done already ;-)

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


More information about the ghc-tickets mailing list