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

Build/ghci issues with version 0.4 #2

Closed
Rhywun opened this issue Jan 25, 2019 · 10 comments
Closed

Build/ghci issues with version 0.4 #2

Rhywun opened this issue Jan 25, 2019 · 10 comments

Comments

@Rhywun
Copy link

Rhywun commented Jan 25, 2019

Hi, I'm having some problems with the latest version of the source code:

stack build succeeds but it warns that "This package indirectly depends on multiple versions of the same package" (see attached build.txt).

Executables seem to run fine with stack exec.

stack ghci [any file] fails with the message cannot satisfy -package z-hid-examples-z-ipgen-lib (see attached ghci.txt).

I am using homebrew stack version 1.9.3 x86_64. Thanks for any advice.

build.txt
ghci.txt

@bravit
Copy link
Owner

bravit commented Jan 30, 2019

Thanks for reporting! It looks like a bug in stack (see commercialhaskell/stack#3926 for something very similar). I believe that running stack exec -- ghci vocab1.hs should be enough as a workaround given your use case. In fact, I'd recommend using cabal new- instead as it is quite reliable now.

@Rhywun
Copy link
Author

Rhywun commented Jan 30, 2019

I'm not at all familiar with cabal new - I've only used stack because that's what all the learning materials I've seen uses - but I guess it doesn't hurt to investigate something new.... Thanks.

@Rhywun
Copy link
Author

Rhywun commented Mar 19, 2019

@bravit

Hi, after doing a little research I installed GHC (v8.6.4) and tried cabal new-build - here is the output.

Resolving dependencies...
cabal: Could not resolve dependencies:
[__0] trying: hid-examples-0.4 (user goal)
[__1] trying: Chart-diagrams-1.9 (dependency of hid-examples)
[__2] next goal: lens (dependency of Chart-diagrams)
[__2] rejecting: lens-4.17 (conflict: Chart-diagrams => lens>=3.9 && <4.17)
[__2] trying: lens-4.16.1
[__3] next goal: template-haskell (dependency of lens)
[__3] rejecting: template-haskell-2.14.0.0/installed-2.1... (conflict: lens =>
template-haskell>=2.4 && <2.14)
[__3] rejecting: template-haskell-2.14.0.0, template-haskell-2.13.0.0,
template-haskell-2.12.0.0, template-haskell-2.11.1.0,
template-haskell-2.11.0.0, template-haskell-2.10.0.0,
template-haskell-2.9.0.0, template-haskell-2.8.0.0, template-haskell-2.7.0.0,
template-haskell-2.6.0.0, template-haskell-2.5.0.0, template-haskell-2.4.0.1,
template-haskell-2.4.0.0, template-haskell-2.3.0.1, template-haskell-2.3.0.0,
template-haskell-2.2.0.0 (constraint from non-upgradeable package requires
installed instance)
[__3] fail (backjumping, conflict set: lens, template-haskell)
After searching the rest of the dependency tree exhaustively, these were the
goals I've had most trouble fulfilling: template-haskell, lens,
Chart-diagrams, base, hid-examples

Not sure what to do with that :)
Anyway the exec workaround works fine.

@Rhywun
Copy link
Author

Rhywun commented Mar 23, 2019

Update: actually the exec workaround doesn't work with local imports. Example:
stack exec -- ghci stockquotes/Statistics.hs gives:
Could not find module ‘BoundedEnum’ and Could not find module ‘QuoteData’

@bravit
Copy link
Owner

bravit commented Apr 3, 2019

Hi @Rhywun, there were problems with package dependencies, but it should be built now with the latest GHC via cabal new-build. Please, run cabal update before doing that.

@Rhywun
Copy link
Author

Rhywun commented Apr 3, 2019

It worked after running cabal new-update. Thanks, I'll play around some more and re-open if anything seems amiss.

@Rhywun Rhywun closed this as completed Apr 3, 2019
@brunoparga
Copy link

Is there any way to fix this repository so that stack just works? According to the State of Haskell Survey, stack is the most popular build tool by a fair amount over cabal. And the intro to the book presents them both as valid options to follow along with the distribution code. It is frustrating to simply have to use another tool because one of them is not set up in a way that works (I can't imagine it is impossible to configure the code so that stack just works).

I cannot run stack ghci with any of the provided modules, as I always run into this error:

stack ghci vocab1.hs
Using configuration for hid-examples:exe:vocab1 to load /home/bruno/code/haskell/hid-examples-0.4/vocab1.hs
Using main module: 1. Package `hid-examples' component exe:vocab1 with main-is file: /home/bruno/code/haskell/hid-ex
amples-0.4/vocab1.hs
hid-examples-0.4: initial-build-steps (internal-lib + exe)
Configuring GHCi with the following packages: hid-examples
GHCi, version 8.2.2: http://www.haskell.org/ghc/  :? for help
<command line>: cannot satisfy -package z-hid-examples-z-ipgen-lib
    (use -v for more information)

I tried ignoring that limitation and proceeded reading, but in section 3.2.4 I get this error:

ghci> import Fmt

<no location info>: error:
    Could not find module ‘Fmt’
    It is not a module in the current program, or in any known package.

Running stack install fmt within the hid-examples directory does not help.

I know students are supposed to try things and explore the language in order to learn, but I expected to do this by building on top of the course itself, which I expected to work out of the box.

@bravit
Copy link
Owner

bravit commented Jun 30, 2019

Hi @brunoparga, it's an old stack bug, unfortunately. You can follow the latest news on it here: commercialhaskell/stack#4564. It seems that I can do nothing about it except for splitting the package into dozens of independent packages that doesn't feel right. The only solution that I can suggest is to use cabal instead.

@Rhywun
Copy link
Author

Rhywun commented Jun 30, 2019

It is painful especially when I don't see what advantage cabal new* oh wait now it's cabal v2* is supposed to bring.

I like stack's curated list of packages. If that's going to be deprecated, I don't understand how cabal v2 is solving the version-hell problem.

I get that everything is in flux - fun times! :)

@brunoparga
Copy link

Thank you @bravit , it is a bit sad that what seems to be such and important part of the ecosystem has what looks like a pretty inconvenient bug. I'll switch to cabal as you suggested.

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

3 participants