Units of measure as a GHC typechecker plugin
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
uom-plugin-examples
uom-plugin
.gitignore
.travis.yml
README.md
cabal.project
cabal.project.freeze
stack.yaml

README.md

Units of measure as a GHC typechecker plugin

The uom-plugin library adds support for units of measure to GHC using the new experimental facility for typechecker plugins, which is available in GHC 7.10 and later. See Data.UnitsOfMeasure.Tutorial for an introduction to the library, and the accompanying paper for more background. An example of a package that uses the library is given in uom-plugin-examples.

The library has been tested with GHC 7.10.3, 8.0.2 & 8.2.2.

Installation

Grab the source.

> git clone https://github.com/adamgundry/uom-plugin.git
> cd uom-plugin

Then build and run with any of these methods:

  • With Cabal new-build

> cabal new-build all
> cabal new-exec Examples
  • Within a Cabal Sandbox

> cabal sandbox init
(cd uom-plugin && cabal sandbox init --sandbox=../.cabal-sandbox && cabal install)
> cd uom-plugin-examples/
uom-plugin-examples> cabal sandbox init --sandbox=../.cabal-sandbox
uom-plugin-examples> cabal build
uom-plugin-examples> dist/build/Examples/Examples
  • With Stack

> stack build
> stack exec Examples

Build Status