Wednesday, July 08, 2020

How to use a personal library in another project with Stack? (Haskell)



In Haskell, Haskell tool stack is quite difficult at least to me. For example, I want to use a personal library (a pre-release version of a Hackage package) from a stack project  in another stack project. Conceptually, it is simple, but it takes a bit long to find a solution from Stackoverflow.

Here is a summary.

In stack.yaml

packages 
- '.'
- path-to-a-stack-project-directory-containing-your-personal-library

In packages.yaml

dependencies:
- your-personal-libary

Then run 

$ stack build

This will solve your need. How easy it is after one knows how to do it! But I worry how difficult Haskell newbies may feel. 


No comments: