I downloaded the source files of package (e.g. test-framework
) to have a closer look in it's architecture, to modify it for experiments, and may be to contribute later on.
I downloaded the source code and got stuck in incompatibilities and lots of compiler errors.
Is there a step by step procedure, of how to obtain the source code properly and to setup such a project using the Haskell Stack?
We can choose out of the following two opportunities:
Thanks to the "Cigarette Smoking Man"...
Setup your main project
unpack the package that should be obtained as source code
stack unpack
change current directory to the created folder
cd <package>
initialise the folder (creates file stack.yaml
)
stack init
modify stack.yaml
of the main project, to add package with relative path to section packages
!!!
modify package.yaml
of main project, to add dependency to package with constraint (e.g. == 1.2.1
) to section dependencies
delete cabal-file (here local-from-hackage-without-tarball.cabal
), if any
in the main folder build the main project
stack build
NOTE: This setup can be even used in ghci, by typing stack ghci
and :reload
.
Setup your main project
unpack the package that should be obtained as source code
stack unpack
change current directory to the created folder
cd <package>
initialise the folder (creates file stack.yaml
)
stack init
generate a tarball file of the package code
stack sdist
modify stack.yaml
of the main project, to add package with relative path to section extra-deps
!!!
modify package.yaml
of main project, to add dependency to package with constraint (e.g. == 1.2.1
) to section dependencies
delete cabal-file (here local-from-hackage-by-tarball.cabal
), if any
in the main folder build the main project
stack build
For more details check source: Building a package locally from source using "stack"
Additonally, for both alternatives, here you can find a complete projects, where the module Random
exports an additional function.
GitHub: