Skip to content

cabalism/hpack-dhall

Repository files navigation

hpack-dhall

Use hpack's phrasing in dhall to write cabal files.

Installation

Install with cabal install hpack-dhall or install from source.

Motivation

There are two main reasons why you'd use hpack-dhall, convenience and safety.

Get the convenience of hpack. Don't bother to state what can be inferred or defaulted, easing the burden of completing a package description by hand. For example other-modules can be inferred by taking the set difference between modules on disk and the set of exposed-modules.

Get the safety of dhall's programmable configuration: typed fields, safe imports and functions.

Another convenience is that files are easily formatted. The cabal file is formatted on write and the package dhall file can be formatted too with:

> dhall format --inplace package.dhall

We use hpack phrasing. The vocabulary of hpack's fields and values differs only slightly from cabal's properties. They're close Haskell packaging dialects.

Use

This very package is described in package.dhall and produces hpack-dhall.cabal with the command:

> dhall-hpack-cabal
generated hpack-dhall.cabal

The generated cabal file can then inform both stack and cabal-install what modules to package into libraries, executables and test suites.

There is more you can do.

Source Control

Value the dhall file as a way to produce the cabal file. If both files are be checked into source control but the cabal file gets ahead of the dhall file then it should be possible to get them in sync again.

Status

cabal stack hackage release Dependencies of latest version on Hackage