
#13772: Cannot put HasCallStack on instances -------------------------------------+------------------------------------- Reporter: augustss | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.0.1 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 Iceland_jack): I am not very familiar with `HasCallStack` but it is possible to go from `ImplicitParams` to kmett's reflection library, I don't know where you would call [https://hackage.haskell.org/package/reflection-2.1.2/docs /Data-Reflection.html#v:reify reify] but it may help: {{{#!hs import Data.Proxy import GHC.Stack import Data.Reflection import Data.Monoid hiding ((<>)) import Data.Semigroup newtype WithClassStack s a = WCS a instance Semigroup a => Semigroup (WithClassStack s a) where WCS a <> WCS b = WCS (a <> b) instance (Semigroup a, Reifies s CallStack) => Monoid (WithClassStack s a) where mempty = error "No mempty!" where ?callStack = reflect (Proxy @s) mappend = (<>) }}} -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/13772#comment:5 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler