Cleaning a Stack project
By default, if we have already compiled our project before (by using
stack build
, stack run
or stack install
), every use of stack build
,
stack run
or stack install
after that compiles only those files that have
changed since the last time we compiled our project, and the files that depend
on them. That's the same way make
operates for C/C++ projects.
Sometimes, it is useful to ensure that all files are compiled from scratch, for
example if we want to hunt down compiler warnings that we want to eliminate. To
this end, we have the stack clean
command. It deletes all files created by a
previous run of the compiler. If we now run stack build
, the project is built
from scratch.
You have now learned everything you need to know to write Haskell code and to
bundle it in a package you can build using Stack. Especially this section on
packages was a bit dry though. Instead of working with our hello-world
project
and turning it into a slightly more meaningful toy project, we will spend the
remaining three chapters of this book on implementing three complete projects
that do something meaningful. We will implement a program that can find a path
through a maze, we will implement the \(k\)-means clustering algorithm, and we
will implement a parser for (phylogenetic) trees encoded in Newick format.