Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use with hsenv #2

Open
mmcclintock opened this issue Sep 6, 2012 · 11 comments
Open

use with hsenv #2

mmcclintock opened this issue Sep 6, 2012 · 11 comments

Comments

@mmcclintock
Copy link

I'm not sure if this is even an issue. But I had trouble with vim-hdevtools not finding sandboxed packages in
hsenv.

I used this in my vimrc to fix it

if isdirectory($HSENV)
  let g:hdevtools_options = '-g-package-conf$HSENV/.hsenv_$HSENV_NAME/ghc_pkg_db'
endif

Otherwise it works great. Thanks

@bitc
Copy link
Owner

bitc commented Dec 17, 2012

What if you do cabal install hdevtools inside of your hsenv environment? The new hdevtools binary that is installed into your hsenv environment should inherit the package paths from the GHC that it was compiled with, and then your manual setting of the package path above shouldn't be necessary. Please let me know if this works for you.

@jwiegley
Copy link

@bitc The problem is that the ghc wasn't compiled inside the hsenv environment, and so it doesn't know anything about the package databases. These are stored, for ghc-mod for example, in the environment variable PACKAGE_DB_FOR_GHC_MOD. Maybe this means additional support is needed on both sides.

@bitc
Copy link
Owner

bitc commented Jun 15, 2013

what about when running hdevtools with the hsenv activated?

@jwiegley
Copy link

Still, it doesn't know where the package database is.

@bitc
Copy link
Owner

bitc commented Jul 4, 2013

This is related to bitc/hdevtools#12

@jwiegley
Copy link

jwiegley commented Jul 5, 2013

It actually appears to be working now, although I'm not sure what I did to fix it.

@adinapoli
Copy link

@jwiegley is not working on my side, what have you done to make it work?

@jwiegley
Copy link

I wish I remembered. Here is my invocation:

/data/Home/Contracts/FPComplete/Projects/fpco/.hsenvs/ghc-7.4.2.9/.hsenv/cabal/bin/hdevtools check -g -Wall -g -XBangPatterns -g -XCPP -g -XConstraintKinds -g -XDefaultSignatures -g -XDeriveDataTypeable -g -XDeriveFoldable -g -XDeriveFunctor -g -XDeriveGeneric -g -XDeriveTraversable -g -XEmptyDataDecls -g -XFlexibleContexts -g -XFlexibleInstances -g -XFunctionalDependencies -g -XGADTs -g -XGeneralizedNewtypeDeriving -g -XImplicitParams -g -XMonadComprehensions -g -XMultiParamTypeClasses -g -XNamedFieldPuns -g -XNoMonomorphismRestriction -g -XOverloadedStrings -g -XPackageImports -g -XParallelListComp -g -XPatternGuards -g -XRankNTypes -g -XRecordWildCards -g -XScopedTypeVariables -g -XStandaloneDeriving -g -XTemplateHaskell -g -XTupleSections -g -XTypeFamilies -g -XViewPatterns /Volumes/Data/Home/fpco/gitlib/gitlib-libgit2/Git/flyparse-Libgit2.hs

@jwiegley
Copy link

So, nothing special there that might actually fix it. Another thing that I changed recently is that my global GHC is no longer the same compiler as my hsenv's GHC (7.6.3 vs. a modified 7.4.2). Maybe having that stark separation helped?

@adinapoli
Copy link

I actually fixed it. What I was forgetting was that hdevtools is a "service" which start as a server and remains there. So I was actually calling the "wrong" hdevtools, the one outside .hsenv. To make my life easier, I created this simple function:

(defun hsenv-jack-in ()
  (interactive)
  (shell-command "killall hdevtools")
  (hsenv-activate)
  (flycheck-buffer))

So, even if I forget to call "hsenv-activate" I can amend later on and see flycheck correctly checking my code :)
The checker is nothing special:

(flycheck-define-checker haskell-hdevtools
  "A Haskell syntax and type checker using hdevtools.
  See URL `https://github.com/bitc/hdevtools'."
  :command ("hdevtools" "check" "-g" "-Wall" source-inplace)
  :error-patterns
  ((warning line-start (file-name) ":" line ":" column ":"
            (or " " "\n    ") "Warning:" (optional "\n")
            (one-or-more " ")
            (message (one-or-more not-newline)
                     (zero-or-more "\n"
                                   (one-or-more " ")
                                   (one-or-more not-newline)))
            line-end)
   (error line-start (file-name) ":" line ":" column ":"
          (or (message (one-or-more not-newline))
              (and "\n" (one-or-more " ")
                   (message (one-or-more not-newline)
                            (zero-or-more "\n"
                                          (one-or-more " ")
                                          (one-or-more not-newline)))))
          line-end))
  :modes haskell-mode
  :next-checkers (haskell-hlint))
(push 'haskell-hdevtools flycheck-checkers)

@jwiegley
Copy link

Yep, I have a killall command happen every time I type C-c C (which manually rechecks the current file).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants