flycheck-haskell icon indicating copy to clipboard operation
flycheck-haskell copied to clipboard

IO mzero error when reading cabal configuration

Open jlavelle opened this issue 5 years ago • 2 comments

Every time I try to run flycheck-haskell-setup I get an error:

Reading Haskell configuration failed with exit code 1 and ouput:
get-cabal-configuration.hs: user error (mzero)

That is the error generated by the MonadPlus instance of IO when mzero is evaluated, it seems it must be coming from an imported function that is partial.

I'm trying to use this package through a Nix shell so that's probably part of the problem, but it is difficult to figure out what is going wrong without knowing where that error is coming from.

jlavelle avatar Oct 24 '20 15:10 jlavelle

Yeah it looks like it will take some time to figure out which partial function lead to this error. Since I don't use Nix, I cannot even start guessing about common pitfalls you may have encountered.

To my mind only 3 possible ways to go forward with this come up:

  • Debug it yourself (via print statements for better or worse) and provide your observations here. You can run the get-cabal-configuration.hs script in project root via runghc and experiment with it
  • Make up reproducible example that I can debug (via print statements). May or may not work depending on how complicated Nix setup will be required
  • Avoid flycheck-haskell. You have 2 options:
    • for simple use cases a baseline flycheck may be enough as this project only provides configuration for checkers there
    • consider alternative checkers provided by other projects - the errors will still be presented via flycheck framework, just the checking machinery will differ. That's what I ultimately did and personally I would recommend https://github.com/jyp/dante as it's pretty reliable in my experience and provides some nice features over vanilla flycheck, e.g. get type at point. Cannot comment on how well it works under Nix since I haven't tried it, but there is definitely some default configuration for Nix.

sergv avatar Oct 24 '20 18:10 sergv

Thanks for the quick response! I'll look into dante as an alternative.

jlavelle avatar Oct 24 '20 20:10 jlavelle