hdevtools icon indicating copy to clipboard operation
hdevtools copied to clipboard

Cabal support

Open maximkulkin opened this issue 11 years ago • 35 comments

This patch adds support of Cabal packages.

Hdevtools currently doesn't know anything about Cabal system: it can't find out source code directories, package database locations, list of packages or Haskell language extensions to use.

This patch adds support of extracting GHC options based on Cabal package description, support for Cabal sandboxes.

maximkulkin avatar Feb 20 '14 21:02 maximkulkin

Great!

davidxifeng avatar Feb 21 '14 09:02 davidxifeng

Yes please. Is this mergeable?

mrak avatar Mar 02 '14 07:03 mrak

I'm planning to work on this further to improve usability but it is pretty usable already.

maximkulkin avatar Mar 02 '14 20:03 maximkulkin

:+1: Yay!

purcell avatar Mar 08 '14 13:03 purcell

Looking forward to this :)

altschuler avatar Mar 11 '14 06:03 altschuler

:+1:

schell avatar Mar 14 '14 23:03 schell

Are cabal sandboxes working in this current branch? If so - what is the process for using sandboxes with hdevtools?

schell avatar Mar 24 '14 20:03 schell

You need to have cabal.sandbox.config next to your *.cabal file (as you normally do). Then you run hdevtools command for some file inside your cabal package and the rest is take care automatically.

maximkulkin avatar Mar 24 '14 20:03 maximkulkin

I think my problem may be that I'm running ghc7.8. hdevtools -V shows "no cabal support".

schell avatar Mar 24 '14 21:03 schell

Right. Hdevtools depends on GHC which depends on particular Cabal version (1.16 for GHC 7.6 and 1.18 for GHC 7.8). Hdevtools cabal code depends on Cabal API which has changed. I do not have GHC 7.8 available so I can't support that version. If you can point me to instructions on how to install GHC 7.8, that would help.

maximkulkin avatar Mar 24 '14 21:03 maximkulkin

I'm also working on a patch, though I'm working beyond my skill level :(.

Here's the rc2 release http://www.well-typed.com/blog/87/ which links to a list of binary distributions. Each has a README (and I think an INSTALL). Installing is a simple ./configure, sudo make install.

schell avatar Mar 24 '14 22:03 schell

@maximkulkin I've made a pull request to your branch that adds support for ghc 7.8. https://github.com/maximkulkin/hdevtools/pull/1

schell avatar Mar 24 '14 23:03 schell

+1

jstasiak avatar Apr 06 '14 20:04 jstasiak

@maximkulkin yep, installing GHC 7.8 is really easy (as schell suggests) and works cleanly alongside whatever other versions of GHC you have installed (the only thing that might be overwritten is the symlinks e.g. /usr/bin/ghc, at least for me on Debian).

For Debian x86 I do this (but see here for other options):

$ wget https://www.haskell.org/ghc/dist/7.8.2/ghc-7.8.2-i386-unknown-linux-deb7.tar.xz
$ tar xf ghc-7.8.2-i386-unknown-linux-deb7.tar.xz
$ cd ghc-7.8.2
$ ./configure && sudo make install

I'm also very keen on using this with 7.8; thanks for your work.

jberryman avatar Apr 15 '14 22:04 jberryman

Will this automatically take into account the extensions defined in the .cabal file?

darthdeus avatar May 17 '14 13:05 darthdeus

I'm asking this because I just tried this on a Yesod scaffold project, which defines TemplateHaskell in the .cabal file, but when I hdevtools check Model.hs, which uses TemplateHaskell, I'll get an error

Parse error: naked expression at top level
Perhaps you intended to use TemplateHaskell

darthdeus avatar May 17 '14 13:05 darthdeus

Yes, this patch takes default language extensions defined in .cabal file into account.

maximkulkin avatar May 17 '14 18:05 maximkulkin

@maximkulkin In that case something probably isn't working properly. At least QuasiQuotes aren't being recognized in a scaffolded Yesod project.

Settings.hs:41:24: parse error on input ‘{’

Here's the specific file, I've pushed the whole project so that we can more easily reproduce it https://github.com/darthdeus/hdevtools-pikachu/blob/master/Settings.hs

It might be because I'm trying this on GHC 7.8.2. I tested this by merging your branch with #28, here's the final version for reference https://github.com/darthdeus/hdevtools/tree/ghc7.7

darthdeus avatar May 17 '14 20:05 darthdeus

@darthdeus Yes, this patch doesn't support GHC 7.8 yet. You might see "no cabal support" in output of "hdevtools --version". I plan to work on this in near future.

maximkulkin avatar May 18 '14 07:05 maximkulkin

@maximkulkin, @darthdeus - I've been using my branch that added support for GHC 7.8 and it seems to be working well :)

https://github.com/maximkulkin/hdevtools/pull/1

schell avatar May 20 '14 15:05 schell

@schell I hope it gets merged soon then :(

darthdeus avatar Jun 09 '14 11:06 darthdeus

Hi folks, just checking on this: is this still open? Any chance of merging into the mainline soon? (And if so will it work for 1.20?) Thanks!

ranjitjhala avatar Jun 12 '15 17:06 ranjitjhala

This is merged in my fork. I don't have collaboration rights to this repo but I do have access to the hdevtools hackage, so my fork (https://github.com/schell/hdevtools) is what is currently on hackage. @bitc can you make me a collaborator with admin privileges so we can sync hdevtools work? I can also manage the tickets here.

schell avatar Jun 12 '15 17:06 schell

A side note: I would strongly advise moving to GHC 7.10. GHC before 7.10 had a dependency on particular Cabal version which made using hdevtools with support for newer Cabal versions a problem. Starting from GHC 7.10 there is no such dependency and you can build hdevtools against Cabal version that you have. This is in theory: I haven't chance to play with GHC 7.10 and update this pull request yet.

maximkulkin avatar Jun 12 '15 17:06 maximkulkin

Super! So the version I have after cabal installing (1.0.9) should have it right?

On Jun 12, 2015, at 10:38 AM, Schell Carl Scivally [email protected] wrote:

This is merged in my fork. I don't have collaboration rights to this repo but I do have access to the hdevtools hackage, so my fork (https://github.com/schell/hdevtools) is what is currently on hackage. @bitc can you make me a collaborator with admin privileges so we can sync hdevtools work? I can also manage the tickets here.

— Reply to this email directly or view it on GitHub.

ranjitjhala avatar Jun 12 '15 17:06 ranjitjhala

Yes - cabal should install the newest version just fine on GHC 7.8.3 and even GHC 7.10.1.

On Jun 12, 2015, at 10:43 AM, Ranjit Jhala [email protected] wrote:

Super! So the version I have after cabal installing (1.0.9) should have it right?

On Jun 12, 2015, at 10:38 AM, Schell Carl Scivally [email protected] wrote:

This is merged in my fork. I don't have collaboration rights to this repo but I do have access to the hdevtools hackage, so my fork (https://github.com/schell/hdevtools) is what is currently on hackage. @bitc can you make me a collaborator with admin privileges so we can sync hdevtools work? I can also manage the tickets here.

— Reply to this email directly or view it on GitHub.

— Reply to this email directly or view it on GitHub https://github.com/bitc/hdevtools/pull/30#issuecomment-111571191.

schell avatar Jun 12 '15 18:06 schell

hmm. I get this odd error:

hdevtools: <socket: 4>: hGetLine: end of file

Any idea? (I thought it might be some difficulty with parsing a new cabal format)

On Fri, Jun 12, 2015 at 11:06 AM, Schell Carl Scivally < [email protected]> wrote:

Yes - cabal should install the newest version just fine on GHC 7.8.3 and even GHC 7.10.1.

On Jun 12, 2015, at 10:43 AM, Ranjit Jhala [email protected] wrote:

Super! So the version I have after cabal installing (1.0.9) should have it right?

On Jun 12, 2015, at 10:38 AM, Schell Carl Scivally < [email protected]> wrote:

This is merged in my fork. I don't have collaboration rights to this repo but I do have access to the hdevtools hackage, so my fork ( https://github.com/schell/hdevtools) is what is currently on hackage. @bitc can you make me a collaborator with admin privileges so we can sync hdevtools work? I can also manage the tickets here.

— Reply to this email directly or view it on GitHub.

— Reply to this email directly or view it on GitHub < https://github.com/bitc/hdevtools/pull/30#issuecomment-111571191>.

— Reply to this email directly or view it on GitHub https://github.com/bitc/hdevtools/pull/30#issuecomment-111577105.

Ranjit.

ranjitjhala avatar Jun 12 '15 18:06 ranjitjhala

What command are you running? On which project (if you can tell me)? And what is the output of hdevtools —version?

On Jun 12, 2015, at 11:11 AM, Ranjit Jhala [email protected] wrote:

hmm. I get this odd error:

hdevtools: <socket: 4>: hGetLine: end of file

Any idea? (I thought it might be some difficulty with parsing a new cabal format)

On Fri, Jun 12, 2015 at 11:06 AM, Schell Carl Scivally < [email protected]> wrote:

Yes - cabal should install the newest version just fine on GHC 7.8.3 and even GHC 7.10.1.

On Jun 12, 2015, at 10:43 AM, Ranjit Jhala [email protected] wrote:

Super! So the version I have after cabal installing (1.0.9) should have it right?

On Jun 12, 2015, at 10:38 AM, Schell Carl Scivally < [email protected]> wrote:

This is merged in my fork. I don't have collaboration rights to this repo but I do have access to the hdevtools hackage, so my fork ( https://github.com/schell/hdevtools) is what is currently on hackage. @bitc can you make me a collaborator with admin privileges so we can sync hdevtools work? I can also manage the tickets here.

— Reply to this email directly or view it on GitHub.

— Reply to this email directly or view it on GitHub < https://github.com/bitc/hdevtools/pull/30#issuecomment-111571191>.

— Reply to this email directly or view it on GitHub https://github.com/bitc/hdevtools/pull/30#issuecomment-111577105.

Ranjit. — Reply to this email directly or view it on GitHub https://github.com/bitc/hdevtools/pull/30#issuecomment-111578183.

schell avatar Jun 12 '15 18:06 schell

​Here's the info:

rjhala@borscht ~/r/l/p/liquid-fixpoint (cutsolver)> hdevtools

--numeric-version 0.1.0.9 rjhala@borscht ~/r/l/p/liquid-fixpoint (cutsolver)> hdevtools --version hdevtools: version 0.1.0.9 (ghc-7.8.3-x86_64-darwin, cabal-1.18.1.3) ​

I am running it from the command line like this:

rjhala@borscht ~/r/l/p/liquid-fixpoint (cutsolver)> hdevtools check

Fixpoint.hs hdevtools: <socket: 4>: hGetLine: end of file

​I am also using flycheck-hdevtools which underlines various missing imports (which are to be obtained from the cabal file, hence I thought .cabal and cabal-sandbox support was missing?)

The source for the above (Fixpoint.hs) is:

https://github.com/ucsd-progsys/liquid-fixpoint/blob/master/Fixpoint.hs

and the corresponding .cabal file is:

https://github.com/ucsd-progsys/liquid-fixpoint/blob/master/liquid-fixpoint.cabal

(my hunch is its hitting some parse error on the cabal file?)

On Fri, Jun 12, 2015 at 11:13 AM, Schell Carl Scivally < [email protected]> wrote:

What command are you running? On which project (if you can tell me)? And what is the output of hdevtools —version?

On Jun 12, 2015, at 11:11 AM, Ranjit Jhala [email protected] wrote:

hmm. I get this odd error:

hdevtools: <socket: 4>: hGetLine: end of file

Any idea? (I thought it might be some difficulty with parsing a new cabal format)

On Fri, Jun 12, 2015 at 11:06 AM, Schell Carl Scivally < [email protected]> wrote:

Yes - cabal should install the newest version just fine on GHC 7.8.3 and even GHC 7.10.1.

On Jun 12, 2015, at 10:43 AM, Ranjit Jhala <[email protected]

wrote:

Super! So the version I have after cabal installing (1.0.9) should have it right?

On Jun 12, 2015, at 10:38 AM, Schell Carl Scivally < [email protected]> wrote:

This is merged in my fork. I don't have collaboration rights to this repo but I do have access to the hdevtools hackage, so my fork ( https://github.com/schell/hdevtools) is what is currently on hackage. @bitc can you make me a collaborator with admin privileges so we can sync hdevtools work? I can also manage the tickets here.

— Reply to this email directly or view it on GitHub.

— Reply to this email directly or view it on GitHub < https://github.com/bitc/hdevtools/pull/30#issuecomment-111571191>.

— Reply to this email directly or view it on GitHub https://github.com/bitc/hdevtools/pull/30#issuecomment-111577105.

Ranjit. — Reply to this email directly or view it on GitHub < https://github.com/bitc/hdevtools/pull/30#issuecomment-111578183>.

— Reply to this email directly or view it on GitHub https://github.com/bitc/hdevtools/pull/30#issuecomment-111578546.

Ranjit.

ranjitjhala avatar Jun 12 '15 18:06 ranjitjhala

Sorry @ranjitjhala - I actually wanted the output of hdevtools --version so I can see (also) what compiler version and cabal version you're using ;)

schell avatar Jun 12 '15 18:06 schell

Ah, I pasted that too above, did you get it? Else:

rjhala@borscht ~/r/l/p/liquid-fixpoint (cutsolver)> hdevtools --version
hdevtools: version 0.1.0.9 (ghc-7.8.3-x86_64-darwin, cabal-1.18.1.3)

ranjitjhala avatar Jun 12 '15 18:06 ranjitjhala

Shoot! No! I read right past it :/ Sorry! Thanks :+1:

schell avatar Jun 12 '15 18:06 schell

Yeah, it very well could be hitting a parse error - and it could also be related to https://github.com/bitc/hdevtools/issues/40. I'll have to debug this further after I get off work. Thanks!

In the meantime if you feel like updating to the latest cabal you can test to see if that's the weak link.

schell avatar Jun 12 '15 18:06 schell

thanks! I will update to ghc-7.10 and cabal 1.22 and see if that sorts it out! ​

ranjitjhala avatar Jun 12 '15 18:06 ranjitjhala

May the force be with you ;)

schell avatar Jun 12 '15 18:06 schell