summaryrefslogtreecommitdiff
path: root/libraries/base/GHC/ExecutionStack.hs
diff options
context:
space:
mode:
authorBen Gamari <ben@smart-cactus.org>2015-11-26 12:12:32 +0100
committerBen Gamari <ben@smart-cactus.org>2015-11-26 14:48:51 +0100
commitba14f04dae398c102209e3374bea882ebf823257 (patch)
treec0eafcf10be09af7c1159279b2baaafdc19a1627 /libraries/base/GHC/ExecutionStack.hs
parent1712a9ed333dfa2fc9ce7d55acab08a8d278fb5b (diff)
downloadhaskell-ba14f04dae398c102209e3374bea882ebf823257.tar.gz
Libdw: Handle failure to grab session for location lookup
This one slipped through testing.
Diffstat (limited to 'libraries/base/GHC/ExecutionStack.hs')
-rw-r--r--libraries/base/GHC/ExecutionStack.hs5
1 files changed, 3 insertions, 2 deletions
diff --git a/libraries/base/GHC/ExecutionStack.hs b/libraries/base/GHC/ExecutionStack.hs
index 245b996467..11f8c9e50a 100644
--- a/libraries/base/GHC/ExecutionStack.hs
+++ b/libraries/base/GHC/ExecutionStack.hs
@@ -36,14 +36,15 @@ module GHC.ExecutionStack (
, showStackTrace
) where
+import Control.Monad (join)
import GHC.ExecutionStack.Internal
-- | Get a trace of the current execution stack state.
--
-- Returns @Nothing@ if stack trace support isn't available on host machine.
getStackTrace :: IO (Maybe [Location])
-getStackTrace = fmap stackFrames `fmap` collectStackTrace
+getStackTrace = (join . fmap stackFrames) `fmap` collectStackTrace
-- | Get a string representation of the current execution stack state.
showStackTrace :: IO (Maybe String)
-showStackTrace = fmap (flip showStackFrames "") `fmap` getStackTrace
+showStackTrace = fmap (\st -> showStackFrames st "") `fmap` getStackTrace