Getting debugging going in ghci -- is there no mercy?

According to the Haskell wiki, "The trace function is located in the base package", which encouraged me to think it should just work by starting ghci. No such luck. So then I tried "stack gchi --package debug". No such luck. I added packages to stack.yaml as suggested. And here's where I am now. Of course, I'd like cookbook instructions, but I'm also including all this error output to give people an idea of how incredibly demoralizing the experience of being a newbie can be. As a newbie, it's easy to get confused about what Haskell is actually doing. So you'd naturally like a way to inspect intermediate results. Which means you'd like tracing and debugging. Why is it so hard to get there? ----------- C:\Users\Michael Turner\aug\aug.cabal was modified manually. Ignoring C:\Users\Michael Turner\aug\package.yaml in favor of the cabal file. If you want to use the package.yaml file instead of the cabal file, then please delete the cabal file. Using main module: 1. Package `aug' component aug:exe:aug-exe with main-is file: C:\Users\Michael Turner\aug\app\Main.hs WARNING: Ignoring transformers-compat's bounds on transformers (>=0.3 && ==0.2.*); using transformers-0.5.6.2. Reason: allow-newer enabled. Error: While constructing the build plan, the following exceptions were encountered: In the dependencies for Hoed-0.5.1: QuickCheck needed, but the stack configuration has no specified version (latest matching version is 2.14.2) cereal needed, but the stack configuration has no specified version (latest matching version is 0.5.8.1) cereal-text needed, but the stack configuration has no specified version (latest matching version is 0.1.0.2) cereal-vector needed, but the stack configuration has no specified version (latest matching version is 0.2.0.1) primitive needed, but the stack configuration has no specified version (latest matching version is 0.7.1.0) regex-tdfa needed, but the stack configuration has no specified version (latest matching version is 1.3.1.0) regex-tdfa-text needed, but the stack configuration has no specified version (latest matching version is 1.0.0.3) semigroups needed, but the stack configuration has no specified version (latest matching version is 0.19.1) strict needed, but the stack configuration has no specified version (latest matching version is 0.4.0.1) terminal-size needed, but the stack configuration has no specified version (latest matching version is 0.3.2.1) vector-th-unbox needed, but the stack configuration has no specified version (latest matching version is 0.2.1.9) needed due to debug-0.1.1 -> Hoed-0.5.1 In the dependencies for aeson-1.5.6.0: attoparsec must match >=0.13.2.2 && <0.15, but the stack configuration has no specified version (latest matching version is 0.14.1) base-compat-batteries must match >=0.10.0 && <0.12, but the stack configuration has no specified version (latest matching version is 0.11.2) data-fix must match >=0.3 && <0.4, but the stack configuration has no specified version (latest matching version is 0.3.1) dlist must match >=0.8.0.4 && <1.1, but the stack configuration has no specified version (latest matching version is 1.0) primitive must match >=0.7.0.1 && <0.8, but the stack configuration has no specified version (latest matching version is 0.7.1.0) scientific must match >=0.3.6.2 && <0.4, but the stack configuration has no specified version (latest matching version is 0.3.6.2) strict must match >=0.4 && <0.5, but the stack configuration has no specified version (latest matching version is 0.4.0.1) tagged must match >=0.8.6 && <0.9, but the stack configuration has no specified version (latest matching version is 0.8.6.1) th-abstraction must match >=0.2.8.0 && <0.5, but the stack configuration has no specified version (latest matching version is 0.4.2.0) these must match >=1.1 && <1.2, but the stack configuration has no specified version (latest matching version is 1.1.1.1) time-compat must match >=1.9.4 && <1.10, but the stack configuration has no specified version (latest matching version is 1.9.5) uuid-types must match >=1.0.3 && <1.1, but the stack configuration has no specified version (latest matching version is 1.0.5) needed due to debug-0.1.1 -> aeson-1.5.6.0 In the dependencies for libgraph-1.14: monads-tf needed, but the stack configuration has no specified version (latest matching version is 0.1.0.3) union-find must match >=0.2, but the stack configuration has no specified version (latest matching version is 0.2) needed due to debug-0.1.1 -> libgraph-1.14 In the dependencies for prettyprinter-compat-ansi-wl-pprint-1.0.1: prettyprinter-ansi-terminal must match >=1.1 && <1.2, but the stack configuration has no specified version (latest matching version is 1.1.2) needed due to debug-0.1.1 -> prettyprinter-compat-ansi-wl-pprint-1.0.1 In the dependencies for uniplate-1.6.13: syb needed, but the stack configuration has no specified version (latest matching version is 0.7.2.1) needed due to debug-0.1.1 -> uniplate-1.6.13 In the dependencies for vector-0.12.3.0: primitive must match >=0.6.4.0 && <0.8, but the stack configuration has no specified version (latest matching version is 0.7.1.0) needed due to debug-0.1.1 -> vector-0.12.3.0 In the dependencies for yaml-0.11.5.0: attoparsec must match >=0.11.3.0, but the stack configuration has no specified version (latest matching version is 0.14.1) conduit must match >=1.2.8 && <1.4, but the stack configuration has no specified version (latest matching version is 1.3.4.1) libyaml must match >=0.1 && <0.2, but the stack configuration has no specified version (latest matching version is 0.1.2) resourcet must match >=0.3 && <1.3, but the stack configuration has no specified version (latest matching version is 1.2.4.2) scientific must match >=0.3, but the stack configuration has no specified version (latest matching version is 0.3.6.2) needed due to debug-0.1.1 -> yaml-0.11.5.0 Some different approaches to resolving this: * Recommended action: try adding the following to your extra-deps in C:\Users\Michael Turner\aug\stack.yaml: - QuickCheck-2.14.2@sha256:4ce29211223d5e6620ebceba34a3ca9ccf1c10c0cf387d48aea45599222ee5aa,7736 - attoparsec-0.14.1@sha256:5a11f0339fb7e65429683e8a36d44adca3fd8cd40704525969c691e359c48fa0,5966 - base-compat-batteries-0.11.2@sha256:eb3b976007754ddc16e8d4afacdd1e575ae746edb57dcd0a1a728ccd4b372a69,8804 - cereal-0.5.8.1@sha256:37cb7a78c84412e94592a658768320c41f015f2b8707a433de835afb8ebc18d7,2767 - cereal-text-0.1.0.2@sha256:dc10e00d9e5047d16a129682aac42c95da188d22e9f85856add051b9ace539c3,1349 - cereal-vector-0.2.0.1@sha256:26d8e359f4c0de6dc06bf29f1cc2805847cdd8576d9f1598ecb263a1ca372bec,1116 - conduit-1.3.4.1@sha256:eeabaf3f822e3e15317995766f50ef4a20371bdc3bb4721a7541e37228018dcf,5129 - data-fix-0.3.1@sha256:7aee2c0633632479cef93c8000befd5bc950ba7c329d69e918ca520944164e27,1645 - dlist-1.0@sha256:124cb3aa1decebd5171b46601b1f74cca6cfae12d266ace3799b86dd05ef7cb4,3560 - libyaml-0.1.2@sha256:7f14f69ceb14659699974e8e47e1ea6f226ea21ff42a802db03e721c319d201d,2125 - monads-tf-0.1.0.3@sha256:25b5d97af98adf7eca709c57f159c6c24c773cbb30e153abaeb156d81a451195,1427 - prettyprinter-ansi-terminal-1.1.2@sha256:90b3b7650bc5b9f0e58da43621d23c817acfc0cf5ce71244b9bd11b8c9f95e3a,2653 - primitive-0.7.1.0@sha256:29de6bfd0cf8ba023ceb806203dfbec0e51e3524e75ffe41056f70b4229c6f0f,2728 - regex-tdfa-1.3.1.0@sha256:eb8d0f007cf45faca8574f56f0d19c9b02bc529ef1688d8f8a9751ce7dc36cc3,6483 - regex-tdfa-text-1.0.0.3@sha256:fb72123627eadf43dd5ca74a2896940d50aac291e61f62177960f0563f7d5c03,1180 - resourcet-1.2.4.2@sha256:d57516781d1721f70aa0b9ec8ea9200ab02bf76349cb76d73ad57729302289cc,1730 - scientific-0.3.6.2@sha256:dd49abc76bd8e2b57e7a057dc2bb742a00527b4bf9350f9374be03b5934e55d8,4679 - semigroups-0.19.1@sha256:ecae129621e0d2f77bef2f01e4458c2e0567ab6e1f39579c61d7cec8058ebb0e,6262 - strict-0.4.0.1@sha256:08cf72ad570fddfe3b3424117bf20a303a1fb21047b40c1d6c8004c0e3e02a0b,4124 - syb-0.7.2.1@sha256:bf42655a213402215299e435c52f799e76cbec0b984cd7153d6b9af8a1c0803f,3815 - tagged-0.8.6.1@sha256:5ddf1e324c3cd644f097a48bf490f0bedf467f723fd240afb3ab3b750577f8e7,2874 - terminal-size-0.3.2.1@sha256:7b2d8e0475a46961d07ddfb91dee618de70eff55d9ba0402ebeac1f9dcf9b18b,1259 - th-abstraction-0.4.2.0@sha256:6ba7b201931f614173755f060fdf98f02095df68c1f7bc3e2691cf9d443e81f9,2194 - these-1.1.1.1@sha256:e981c65228db5ae77a043631f74a1e4a4b770f7213866f584e3476b52512f1af,2631 - time-compat-1.9.5@sha256:a586bd5a59b47ea0c9eafc55c6936ede11126f4a6e619d6d7aeefee73c43d9b8,4954 - union-find-0.2@sha256:22e97cd9aeb8c96bf7cd8d359d4eda635dc0e0a6cd91b9a07e5a203b00949c8d,1232 - uuid-types-1.0.5@sha256:5031383749d57cb95877d7e56f0300be66652b6e57f5ba6681dcc6e4f78d046d,2541 - vector-th-unbox-0.2.1.9@sha256:5723d9c8a8a941dfeeb59dc42b84b924e4548ab6b5a4afe5b62b39f54667c2dd,1520 Error: Plan construction failed. Warning: Build failed, but trying to launch GHCi anyway The following GHC options are incompatible with GHCi and have not been passed to it: -threaded Configuring GHCi with the following packages: aug * * * * * * * * Warning: Multiple files use the same module name: * Paths_aug found at the following paths * C:\Users\Michael Turner\aug\.stack-work\dist\e626a42b\build\aug-exe\autogen\Paths_aug.hs (aug:exe:aug-exe) * C:\Users\Michael Turner\aug\.stack-work\dist\e626a42b\build\autogen\Paths_aug.hs (aug:lib) * * * * * * * * GHCi, version 8.6.5: http://www.haskell.org/ghc/ :? for help <command line>: cannot satisfy -package debug (use -v for more information) Regards, Michael Turner Executive Director Project Persephone 1-25-33 Takadanobaba Shinjuku-ku Tokyo 169-0075 Mobile: +81 (90) 5203-8682 turner@projectpersephone.org Understand - http://www.projectpersephone.org/ Join - http://www.facebook.com/groups/ProjectPersephone/ Donate - http://www.patreon.com/ProjectPersephone Volunteer - https://github.com/ProjectPersephone "Love does not consist in gazing at each other, but in looking outward together in the same direction." -- Antoine de Saint-Exupéry

Il 19 maggio 2021 alle 21:10 Michael Turner ha scritto:
According to the Haskell wiki, "The trace function is located in the base package", which encouraged me to think it should just work by starting ghci. No such luck. So then I tried "stack gchi --package debug". No such luck. I added packages to stack.yaml as suggested. And here's where I am now.
λ> :m +Debug.Trace λ> :t +d trace "prova" 234 trace "prova" 234 :: Integer λ> trace "prova" 234 prova 234 `debug` is an — excellent! — debug package by Neil Mitchell, but not related to `Debug.Trace`.
participants (2)
-
Francesco Ariis
-
Michael Turner