HasCallStack not working with RebindableSyntax
Summary
Using RebindableSyntax
to add HasCallStack
constraints does not include the source location of the overloaded literals..
Steps to reproduce
{-# LANGUAGE RebindableSyntax #-}
module Rebind where
import GHC.Stack
import Prelude (error)
fromInteger :: HasCallStack => a -> b
fromInteger = error "ERR"
good = fromInteger 42
-- *** Exception: ERR
-- CallStack (from HasCallStack):
-- error, called at Rebind.hs:7:15 in main:Rebind
-- fromInteger, called at Rebind.hs:9:8 in main:Rebind
bad = 42
-- *** Exception: ERR
-- CallStack (from HasCallStack):
-- error, called at Rebind.hs:7:15 in main:Rebind
Expected behavior
bad
should include a line for the location of 42
like in good
where fromInteger
is explicitely written.
This would improve a lot the user experience when using Haskell as a host language for embedded domain-specific languages.
Environment
- GHC version used: 9.3.20210504
Optional:
- Operating System: NixOS/Linux
- System Architecture: x86_64