GithubHelp home page GithubHelp logo

Comments (10)

bravit avatar bravit commented on August 22, 2024

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.

from hid-examples.

Rhywun avatar Rhywun commented on August 22, 2024

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.

from hid-examples.

Rhywun avatar Rhywun commented on August 22, 2024

@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.

from hid-examples.

Rhywun avatar Rhywun commented on August 22, 2024

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’

from hid-examples.

bravit avatar bravit commented on August 22, 2024

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.

from hid-examples.

Rhywun avatar Rhywun commented on August 22, 2024

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

from hid-examples.

brunoparga avatar brunoparga commented on August 22, 2024

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.

from hid-examples.

bravit avatar bravit commented on August 22, 2024

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.

from hid-examples.

Rhywun avatar Rhywun commented on August 22, 2024

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! :)

from hid-examples.

brunoparga avatar brunoparga commented on August 22, 2024

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.

from hid-examples.

Related Issues (14)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.