
#9943: Replace "error" with "errorWithStackTrace" from GHC.Stack in base libs -------------------------------------+------------------------------------- Reporter: spacekitteh | Owner: Type: task | spacekitteh Priority: normal | Status: new Component: Core Libraries | Milestone: 7.12.1 Resolution: | Version: Operating System: Unknown/Multiple | Keywords: Type of failure: None/Unknown | Architecture: Blocked By: | Unknown/Multiple Related Tickets: | Test Case: | Blocking: | Differential Revisions: -------------------------------------+------------------------------------- Comment (by hvr): Btw, it's not as simple as just set `error = errorWithStackTrace`; there needs to be a way to recover the string passed to `error` w/o the additional stack-trace from the `ErrorCall` exception value (which currently provides the originally passed `error`-message as its payload). {{{#!hs -- |This is thrown when the user calls 'error'. The @String@ is the -- argument given to 'error'. newtype ErrorCall = ErrorCall String deriving (Eq, Ord, Typeable) instance Exception ErrorCall instance Show ErrorCall where showsPrec _ (ErrorCall err) = showString err }}} See also this short conversation for some ideas: {{{ hvr> carter: btw, was my concern regarding modifying the payload of the ErrorCall exception ever addressed? carter> nopeee! :) carter> maybe we expose a pattern synonym as the constructor name carter> and have the real constructor have an extra field for the trace? hvr> could work carter> so show will still render the full mess carter> but everyone's old code wont break carter> because unless youre explicity catching it carter> it ends up just being showed right? carter> error "fix me" carter> hvr: pattern synonyms dont need to be eneabled in the use sites right? carter> hvr: err, the only reason for that change would be backwards compat right? hvr> carter: well, actually it's a nice property to be able to recover the exact string you pass to 'error' carter> hvr: i wasn't arguing against it :) hvr> carter: regardless of backward compat carter> ok carter> so breaking change to make it have two args? carter> or hide it with patternsyn? carter> or wait a year and try again? hvr> carter: you've got one year to figure out the perfect way :) carter> fineeeee carter> solution: break everything hvr> carter: otoh, maybe by then we may have some other facility which makes this redundant }}} -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9943#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler