[GHC] #9794: Additional assert function: assert :: Bool -> String -> a -> a

GHC ghc-devs at haskell.org
Wed Nov 12 15:36:08 UTC 2014


#9794: Additional assert function:  assert :: Bool -> String -> a -> a
-------------------------------------+-------------------------------------
              Reporter:  rodlogic    |            Owner:
                  Type:  feature     |           Status:  new
  request                            |        Milestone:
              Priority:  normal      |          Version:  7.8.3
             Component:  Compiler    |         Keywords:
  (Type checker)                     |     Architecture:  Unknown/Multiple
            Resolution:              |       Difficulty:  Unknown
      Operating System:              |       Blocked By:
  Unknown/Multiple                   |  Related Tickets:
       Type of failure:              |
  None/Unknown                       |
             Test Case:              |
              Blocking:              |
Differential Revisions:              |
-------------------------------------+-------------------------------------

Comment (by simonpj):

 The difficulty here is that these functions are not ''abstractable''.  For
 example, in GHC we'd want a function
 {{{
 assertGHC :: Bool -> SDoc -> a -> a
 }}}
 where the second argument is an `SDoc` not a string.  We could define it
 in a library module, in terms your `assertStr`, thue:
 {{{
 assertGHC b doc x = assertStr b (showSDoc doc) x
 }}}
 but now the location reported would be in the library module.

 How to make this abstractable?  See #9049, esp
 [wiki:ExplicitCallStack/ImplicitLocations]

 I'm reluctant make the present thing a tiny bit better; I'd rather do
 something more thorough.  I'd be happy if someone made progress on #9049.

 Simon

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


More information about the ghc-tickets mailing list