DEV Community

Ken Aguilar
Ken Aguilar

Posted on • Edited on

2 1

Using github repos as Haskell dependency

I'm fairly new to haskell especially when it comes to packaging libraries.
I was having a hard time finding how to include github repositories in the [name of your project].cabal file of my project. I've been to cabal user guide and didn't find it there, at least not at first. Good thing @samderbyshire saw my tweet and answered my question.

First thing to do is to create a cabal.project file because this file doesn't get generated when you do cabal init, then include the following

source-repository-package
  type: git
  location: git://github.com/[repo owner]/[the repo i want to include as dependency].git

packages: ./[name of your project].cabal

Then in the your [name of your project].cabal file include the repository under the build-depends section

build-depends:    base ^>= 4.11.1.0
                , the-repo-you-want-to-include

The reason I wanted to do this was because I want to use the library I've written in one of my project without the hassle of publishing it to stackage or hackage.

Qodo Takeover

Introducing Qodo Gen 1.0: Transform Your Workflow with Agentic AI

While many AI coding tools operate as simple command-response systems, Qodo Gen 1.0 represents the next generation: autonomous, multi-step problem-solving agents that work alongside you.

Read full post

Top comments (3)

Collapse
 
jvanbruegge profile image
Jan van Brügge

Just as a side note, when you are using stack, you can add git repos in your stack.yaml under extraDeps

Collapse
 
glebec profile image
Gabriel Lebec

Indeed; here is the location for the relevant docs, at least as of the date/time of this post.

Collapse
 
akbiggs profile image
Alexander Biggs

This should now use https://github.com instead of git://github.com. See cabal.readthedocs.io/en/latest/cab....

A Workflow Copilot. Tailored to You.

Pieces.app image

Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.

Read the docs

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay