I\'m doing low-level IO (for library bindings) in Haskell and am experiencing a segfault. I would like to use GHCi\'s :break to figure out what\'s going on, but
Stack has some support for this. Running stack ghci --load-local-deps $TARGET
will load your project and any dependencies that are in the packages
field of stack.yaml
, including if they're marked as extra-dep
s. Breakpoints will work then. You can debug a dependency in GHCi by running stack unpack $PACKAGE
and adding it to packages
in stack.yaml
.
This is not a panacea however. If the packages have conflicting package-global language extensions (or other dynamic flags) or module name clashes it won't work. For example, if your top-level package has default-extensions: NoImplicitPrelude
and your dependencies don't, they won't have a prelude imported and will almost certainly not load. See this GHC bug.