LevelChart8
LevelChart8

Reputation: 207

Using a package that's not on Hackage

I am trying to use EuterpeaLite (https://github.com/Euterpea/EuterpeaLite), but it is not on Hackage.

I imported it like such import EuterpeaLite as EL and I added it to my cabal file like this:

build-depends:
base >=4.7 && <5
, postgresql-simple
, EuterpeaLite

But when I run stack build or stack ghci, I get this error:


Error: While constructing the build plan, the following exceptions were encountered:

In the dependencies for engine-0.1.0.0:

EuterpeaLite needed, but the stack configuration has no specified version (no package with that name found, perhaps there

is a typo in a package's build-depends or an omission from the stack.yaml packages list?)

needed since engine is a build target.

Some different approaches to resolving this:

Plan construction failed.

Is there a special process for non-Hackage packages?

Upvotes: 1

Views: 220

Answers (1)

K. A. Buhr
K. A. Buhr

Reputation: 51029

I used the following procedure.

  1. Create a new stack project stack new myproject --resolver=14.27. I needed to specify an older resolver, since EuterpeaLite wouldn't build with lts-15.3
  2. In the myproject directory, add the following lines to stack.yaml:

    extra-deps:
    - git: https://github.com/Euterpea/EuterpeaLite.git
      commit: 5fe2d129bd3087dd78c0feaf4d35fc03ffd36215
    
  3. Also in the myproject directory, I added the following dependency to package.yaml:

    dependencies:
    - base >= 4.7 && < 5
    - EuterpeaLite           # <- added this line
    
  4. Ran stack build in the myproject directory.

As you noted, instead of using package.yaml, you could change your .cabal file.

Upvotes: 1

Related Questions