hw-polysemy-0.2.14.12: core/HaskellWorks/Polysemy/Stack.hs
module HaskellWorks.Polysemy.Stack
( callerModuleName,
) where
import GHC.Stack (callStack, getCallStack,
srcLocModule)
import HaskellWorks.Polysemy.Prelude
-- | Get the module name of the caller.
callerModuleName :: HasCallStack => String
callerModuleName = maybe "<no-module>" (srcLocModule . snd) (listToMaybe (getCallStack callStack))