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

Using dash-haskell with stack #14

Open
bts opened this issue Jul 17, 2015 · 10 comments
Open

Using dash-haskell with stack #14

bts opened this issue Jul 17, 2015 · 10 comments
Assignees
Labels

Comments

@bts
Copy link

bts commented Jul 17, 2015

Hi there,

I'm trying to use dash-haskell with stack:

$ stack exec -- dash-haskell -c foo.cabal --db /Users/bts/.stack/snapshots/x86_64-osx/nightly-2015-07-15/7.10.1/pkgdb
using package db stack:
 > ghc distribution (global db)
 > system user
 > db directory: /Users/bts/.stack/snapshots/x86_64-osx/nightly-2015-07-15/7.10.1/pkgdb

dash-haskell: ./cabal.sandbox.config: openFile: does not exist (No such file or directory)

Does dash-haskell currently require the use of sandboxes to function, or is there a command line option I should supply to prevent the attempt to read ./cabal.sandbox.config?

Thanks!

@jfeltz
Copy link
Owner

jfeltz commented Jul 18, 2015

It shouldn't require a sandbox to function. This is a huge bug. Thanks for reporting.

@jfeltz jfeltz added the bug label Jul 18, 2015
@jfeltz jfeltz self-assigned this Jul 18, 2015
jfeltz added a commit that referenced this issue Jul 18, 2015
@jfeltz
Copy link
Owner

jfeltz commented Jul 18, 2015

Let me know if the latest commit works for you.

@jfeltz jfeltz closed this as completed Jul 18, 2015
@bts
Copy link
Author

bts commented Jul 20, 2015

Thanks John!

I'm using the 2015-07-19 stackage nightly, so I think I am using the latest commit when I now get the following error:

% stack exec -- dash-haskell -c foo.cabal --db /Users/bts/.stack/snapshots/x86_64-osx/nightly-2015-07-19/7.10.1/pkgdb
using package db stack:
 > ghc distribution (global db)
 > system user
 > db directory: /Users/bts/.stack/snapshots/x86_64-osx/nightly-2015-07-19/7.10.1/pkgdb

dash-haskell: user error (Use of GHC's environment variable GHC_PACKAGE_PATH is incompatible with Cabal. Use the flag --package-db to specify a package database (it can be used multiple times).)

FWIW I don't have the environment variable GHC_PACKAGE_PATH set.

I've tried playing around with the --ordering flag to get it to only use the supplied package DB (without a global or user DB), but I'm not having much luck.

Thanks again!
Brian

@bts
Copy link
Author

bts commented Jul 20, 2015

Ah it seems like stack exec is probably setting GHC_PACKAGE_PATH?

@jfeltz
Copy link
Owner

jfeltz commented Jul 20, 2015

Possibly. Right now dash-haskell uses cabal as its back-end for looking up databases, and I'm now considering putting in a fallback to a custom indexer similar to that used in 1.0.0.5. Try also dash-haskell-1.0.0.5 where this is the case (it doesn't use cabal).

@jfeltz jfeltz reopened this Jul 20, 2015
@mohanzhang
Copy link

@bts Were you ever able to get it working?

@drwebb
Copy link

drwebb commented Sep 11, 2015

@mohazhang The current behavior is unchanged, if dash-haskell is still using cabal as a backend GHC_PACKAGE_PATH cannot be set, which is how stack selects its pkgdb for a build.

@mohanzhang
Copy link

@drwebb Ok, so if I understand you correctly, you are saying that there is a fundamental reason why dash-haskell can't work with stack, and that this reason is because cabal doesn't like the way stack selects its pkgdb? I took this interpretation and ended up using https://github.com/philopon/haddocset instead.

For anyone reading this, don't let your Dash dreams be... dashed! :) haddocset works great, but operates on a slightly different model. The idea is that you create a basic docset generated from your global pkgdb. If you are using stack, this should be a very small set of docs (for me it was 25 packages). You also have to build your application with haddocks in order for the packages to have documentation. The end result is something like:

# in your app's directory, e.g. your yesod app
mkdir dash
stack exec -- haddocset -t dash/output create
# ... looks a lot like the README for haddocset, so far so good
stack build --haddock
# ... takes a while to build all the docs, then
stack exec -- haddocset -t dash/output add /Users/mohanzhang/.stack/snapshots/x86_64-osx/lts-3.2/7.10.2/pkgdb/*.conf
# figure out your pkgdb path with `stack path`
# ... takes a while, and you can get errors for missing docs, but that's ok,
# because not everything inside your stack pkgdb has docs (only those that
# you built with stack haddock at some point or other)

You can then add the docset in Dash preferences. You may also want to edit dash/output.docset/Contents/Info.plist so that it has a nicer bundle name, like "My App's Docs" or something.

/cc @philopon Did I get this right? I seem to have a pretty nice docset in my Dash right now as a result, but haven't had time to check it fully. Thanks to you and @jfeltz for making these solutions. Way way better than googling for docs on hackage.

philopon added a commit to philopon/haddocset that referenced this issue Sep 13, 2015
@olivierverdier
Copy link

olivierverdier commented Jan 5, 2018

@mohanzhang amazing 😲 This should really be part of the readme of haddocset.

EDIT: (well, nevermind, it is already part of the readme of haddocset...)

@adamczykm
Copy link

Each time I'm calling stack exec wtih haddock I get a following error:
haddock: internal error: /usr/lib/ghc-8.2.2/package.conf.d/package.cache: GHC.PackageDb.readPackageDb: inappropriate type (Not a valid Unicode code point!)
Do you know how can I resolve it? Thanks!

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

No branches or pull requests

6 participants