
#9794: Additional assert function: assert :: Bool -> String -> a -> a -------------------------------------+------------------------------------- Reporter: rodlogic | Owner: Type: feature | Status: closed request | Milestone: Priority: normal | Version: 7.8.3 Component: Compiler | Keywords: (Type checker) | Architecture: Unknown/Multiple Resolution: duplicate | Difficulty: Unknown Operating System: | Blocked By: Unknown/Multiple | Related Tickets: Type of failure: | None/Unknown | Test Case: | Blocking: | Differential Revisions: | -------------------------------------+------------------------------------- Changes (by rodlogic): * status: new => closed * resolution: => duplicate Comment: Replying to [comment:1 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
I now understand the basic problem and what you mean by 'abstractable': we can't just change the existing {{{GHC.Base.assert}}} function to include a message parameter and create a wrapper function to keep it backwards compatible. And introducing a new assertStr would require a second hard- coded wiring into the compiler to make it just like assert. I am new to GHC, but would be willing to give it a shot if you can give me a few pointers. For now, I will close this ticket as a duplicate of #9049 to keep things centralized and add a reference back here. Moving to #9049 ... -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9794#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler