If a program is run and crashes with the message "Divide by zero", what is the best way to identify where in the code this error was generated?
How to generate a stack trace upon division by zero with ghc 7.10.3?
573 Views Asked by kostmo At
1
There are 1 best solutions below
Related Questions in HASKELL
- Typeclass projections as inheritance
- How to generate all possible matrices given a number n in Haskell
- Is there a way to get `cabal` to detect changes to non-Haskell source files?
- How to have fixed options using Option.Applicative in haskell?
- How can I create a thread in Haskell that will restart if it gets killed due to any reason?
- Automatic Jacobian matrix in Haskell
- Haskell writing to named pipe unexpectedly fails with `openFile: does not exist (No such device or address)`
- Why does Enum require to implement toEnum and fromEnum, if that's not enough for types larger than Int?
- Non-exhaustive patterns in function compress
- How to get terms names of GADT in Template Haskell?
- Implementing eval() function with Happy parser generator
- How to count the occurences of every element in a list in Haskell fast?
- In Haskell, what does `Con Int` mean?
- Extract a Maybe from a heterogeneous collection
- Haskell, Stack, importing module shows error "Module not found"
Related Questions in STACK-TRACE
- Angular - NG SERVE doesnt work outta nowhere / node:internal/errors:563 ErrorCaptureStackTrace(err);
- Stack Tracing Considering the ARM assembly language version mentioned below
- Why "current_thread" identifier is not in "_current_frames" dictionary?
- Rails 7.1.3 how to view stack traces in a production environment
- Azure calls waiting a long time
- Looking for a tool to monitor process exceptions with stack traces in real-time
- C++23 std::stacktrace in segmentation fault
- VSCode Extension Development: Rejected Promise Error When Running "sonarqube-scanner-npm"
- Extracting function name from boost stacktrace
- In internal testing, application crashed on start with Fatal Exception: java.lang.VerifyError
- Get stacktrace including child class method call when exception is raised from parent classmethod
- Print stacktrace of a function from a goroutine
- Parsing multiline python logs in fluentbit issue
- How to interpret the stack trace of an obfuscated app
- How to create stack trace for other process(out of process) when it crashes in google breakpad?
Related Questions in PARTIAL-FUNCTIONS
- Why using a variable makes a partial function less partial?
- Factoring out common cases in pattern matching with partial function
- Can any partial function be converted to a total version in Haskell?
- WxPython PyPubSub, using curried function not working
- PartialFunction in Scala
- http4s route matching for GET requests with params on root host
- Why Scala PartialFunction works without defining isDefinedAt?
- What exactly is meant by "partial function" in functional programming?
- partial functions vs input verification
- Scala function composition totalFn(partialFn(totalFn(x)))
- Is scanl1 really partial?
- PartialFunction implicit parameters
- How to getOrElse with another Option in Scala
- Scala's Partial Functions in Haskell
- Partial function explanation in the Odersky book
Trending Questions
- UIImageView Frame Doesn't Reflect Constraints
- Is it possible to use adb commands to click on a view by finding its ID?
- How to create a new web character symbol recognizable by html/javascript?
- Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
- Heap Gives Page Fault
- Connect ffmpeg to Visual Studio 2008
- Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
- How to avoid default initialization of objects in std::vector?
- second argument of the command line arguments in a format other than char** argv or char* argv[]
- How to improve efficiency of algorithm which generates next lexicographic permutation?
- Navigating to the another actvity app getting crash in android
- How to read the particular message format in android and store in sqlite database?
- Resetting inventory status after order is cancelled
- Efficiently compute powers of X in SSE/AVX
- Insert into an external database using ajax and php : POST 500 (Internal Server Error)
Popular # Hahtags
Popular Questions
- How do I undo the most recent local commits in Git?
- How can I remove a specific item from an array in JavaScript?
- How do I delete a Git branch locally and remotely?
- Find all files containing a specific text (string) on Linux?
- How do I revert a Git repository to a previous commit?
- How do I create an HTML button that acts like a link?
- How do I check out a remote Git branch?
- How do I force "git pull" to overwrite local files?
- How do I list all files of a directory?
- How to check whether a string contains a substring in JavaScript?
- How do I redirect to another webpage?
- How can I iterate over rows in a Pandas DataFrame?
- How do I convert a String to an int in Java?
- Does Python have a string 'contains' substring method?
- How do I check if a string contains a specific word?
GHC doesn't support stack traces as such because there isn't a call stack. The best you can do is to use the simulated stack trace machinery in the base module
GHC.Stack.Starting with GHC 7.8, and thus available in 7.10.3,
GHC.Stackexposeswhich acts like
erroron normal builds but uses the SCC annotations (e.g., from--fprof-auto) to construct an approximate stack trace on profiled builds. You will need to recompile with profiling enabled to support this. If you are using cabal, you can runand rebuild.
Starting with GHC 8.0,
errorWithStackTraceis deprecated and support for call-site generation is provided by theHasCallStackmachinery.Quoting now from the
GHC.Stackdocumentation,(I'm guessing
msg ++ "\n"was meant, but"n"is what is written.)While you can get some very limited stack trace support with GHC 7.8 and on, I would recommend upgrading to GHC 8 if possible for significantly better support. Either way, it won't be what you are used to from other languages, but it's better than nothing.