% Cabal-MC.tex
\begin{hcarentry}{Cabal}
\label{cabal}%\label{hackage}\label{hackagedb}%
\report{Mikhail Glushenkov}%11/16
\status{Stable, actively developed}
\makeheader

\subsubsection*{Background}

Cabal is the standard packaging system for Haskell software. It specifies a
standard way in which Haskell libraries and applications can be packaged so
that it is easy for consumers to use them, or re-package them, regardless of
the Haskell implementation or installation platform.

\texttt{cabal-install} is the command line interface for the Cabal and Hackage
system. It provides a command line program \texttt{cabal} which has
sub-commands for installing and managing Haskell packages.

\subsubsection*{Recent Progress}

We've recently produced
\href{https://mail.haskell.org/pipermail/cabal-devel/2016-December/010384.html}{new
  point releases} of Cabal/\texttt{cabal-install} from the 1.24
branch. Among other things, Cabal 1.24.2.0 includes a
\href{https://gitlab.haskell.org/ghc/ghc/-/issues/12479}{fix} necessary to
make soon-to-be-released GHC 8.0.2 work on macOS Sierra.

Almost 1500 commits were made to the \texttt{master} branch by
\href{https://gist.github.com/23Skidoo/1a291fd56a18b51f415db5fbaff56ec6}{53
different contributors} since the 1.24 release. Among the highlights are:

\begin{compactitem}
\item
  \href{http://cabal.readthedocs.io/en/latest/developing-packages.html#library}{Convenience,
    or internal libraries} -- named libraries that are only intended
  for use inside the package. A common use case is sharing code
  between the test suite and the benchmark suite without exposing it
  to the users of the package.

\item Support for
  \href{http://cabal.readthedocs.io/en/latest/developing-packages.html#foreign-libraries}{foreign
    libraries}, which are Haskell libraries intended to be used by
  foreign languages like C.  Foreign libraries only work with GHC 7.8
  and later.

\item Initial support for building Backpack packages. Backpack is an
  exciting new project adding an ML-style module system to Haskell,
  but on the package level. See
  \href{https://github.com/ezyang/ghc-proposals/blob/backpack/proposals/0000-backpack.rst}{here}
  and \href{http://blog.ezyang.com/category/haskell/backpack/}{here}
  for a more thorough introduction to Backpack.

\item \texttt{./Setup configure} now accepts an argument
  \href{https://github.com/ghc-proposals/ghc-proposals/pull/4}{specifying
    the component to be configured}. This is mainly an internal
  change, but it means that \texttt{cabal-install} can now perform
  component-level parallel builds (among other things).

\item A lot of improvements in the \texttt{new-build} feature
  (a.k.a. nix-style local builds). Git \texttt{HEAD} version of
  \texttt{cabal-install} is now recommended if you use
  \texttt{new-build}. For an introduction to \texttt{new-build}, see
  \href{http://cabal.readthedocs.io/en/latest/nix-local-build-overview.html}{this
    chapter} of the manual.

\item Special support for the Nix package manager in
  \texttt{cabal-install}. See
  \href{http://cabal.readthedocs.io/en/latest/nix-integration.html}{here}
  for more details.

\item \texttt{cabal upload} now uploads a package candidate by
  default. Use \texttt{cabal upload -{}-publish} to upload a final
  version. \texttt{cabal upload -{}-check} has been removed in favour
  of package candidates.

\item
  \href{http://cabal.readthedocs.io/en/latest/nix-local-build.html#cfg-field-index-state}{An
    \texttt{-{}-index-state} flag} for requesting a specific version
  of the package index.

\item \href{https://github.com/haskell/cabal/pull/3818}{New \texttt{cabal reconfigure} command}, which re-runs
  \texttt{configure} with most recently used flags.

\item
  \href{http://cabal.readthedocs.io/en/latest/developing-packages.html#autogenerated-modules}{New
    \texttt{autogen-modules} field} for modules built automatically
  (like \texttt{Paths\_PACKAGENAME}).

\item
  \href{http://cabal.readthedocs.io/en/latest/developing-packages.html#pkg-field-build-depends}{New
    version range operator} \texttt{\^{}>=}, which is equivalent to
  \texttt{>=} intersected with an automatically-inferred major version
  bound. For example, \texttt{\^{}>= 2.0.3} is equivalent to \texttt{>=
    2.0.3 \&\& < 2.1}.

\item
  \href{http://cabal.readthedocs.io/en/latest/installing-packages.html#cmdoption-setup-configure--allow-newer}{An
    \texttt{-{}-allow-older} flag}, dual to \texttt{-{}-allow-newer}.

\item New Parsec-based parser for \texttt{.cabal} files
  \href{https://github.com/haskell/cabal/pull/3602}{has been merged},
  but not enabled by default yet.

\item \href{http://cabal.readthedocs.io/en/latest/}{The manual} has
  been converted to reST/Sphinx format, improved and expanded.

\item
  \href{https://www.well-typed.com/blog/2015/08/hackage-security-beta/}{Hackage
    Security} has been enabled by default.

\item A lot of bug fixes and performance improvements.

\end{compactitem}

\subsubsection*{Looking Forward}

The next Cabal/\texttt{cabal-install} versions will be released either
in early 2017, or simultaneously with GHC 8.2 (April/May 2017). Our
main focus at this stage is getting the \texttt{new-build} feature to
the state where it can be enabled by default, but there are many other
areas of Cabal that need work.

We would like to encourage people considering contributing to take a
look at \href{https://github.com/haskell/cabal/issues/}{the bug
  tracker on GitHub} and the
\href{https://github.com/haskell/cabal/wiki/Hackathon-2016}{Wiki},
take part in discussions on tickets and pull requests, or submit their
own. The bug tracker is reasonably well maintained and it should be
relatively clear to new contributors what is in need of attention and
which tasks are considered relatively easy. For more in-depth
discussion there is also the
\href{https://mail.haskell.org/mailman/listinfo/cabal-devel}{\texttt{cabal-devel}}
mailing list.

\FurtherReading
\begin{compactitem}
\item Cabal homepage:\hfill\url{https://www.haskell.org/cabal/}\\
\item Cabal on GitHub:\hfill\url{https://github.com/haskell/cabal}
\end{compactitem}
\end{hcarentry}
