hint-based build service for the diagrams graphics EDSL.


Version on this page:
LTS Haskell 20.24:
Stackage Nightly 2022-11-17:
Latest on Hackage:

See all snapshots diagrams-builder appears in

BSD-3-Clause licensed by Brent Yorgey
This version can be pinned in stack with:diagrams-builder-,5668

Module documentation for

  • Diagrams
    • Diagrams.Builder
      • Diagrams.Builder.CmdLine
      • Diagrams.Builder.Modules
      • Diagrams.Builder.Opts

Build Status

diagrams-builder provides backend-agnostic tools for dynamically turning code into rendered diagrams, using the hint wrapper to the GHC API. It supports conditional recompilation using hashing of diagrams source code, to avoid recompiling code that has not changed. It is useful for creating tools which compile diagrams code embedded in other documents. For example, it is used by the BlogLiterately-diagrams package (a plugin for BlogLiterately) to compile diagrams embedded in Markdown-formatted blog posts.

An executable specific to the cairo backend is included (more executables specific to other backends will be included in the future). It takes an input file and an expression to render and outputs an image file, using the cairo backend. If you want it you must explicitly enable the cairo flag with -fcairo.

A LaTeX package, diagrams-latex.sty, is also provided in the latex/ directory of the source distribution, which renders diagrams code found within diagram environments. It makes use of the diagrams-builder-cairo executable, so if you want to use diagrams-latex.sty you should install diagrams-builder with the -fcairo option. Note that diagrams-latex.sty is licensed under the GPL.

Changes (20 November 2014)

  • Allow lens-4.6
  • Allow and require haskell-src-exts-1.16 (22 August 2014)

  • Allow lens-4.4

0.6 (5 June 2014)

  • Require diagrams-lib-1.2
  • Change to the type of buildDiagram in actually required a major version bump. (2 June 2014) (BROKEN)

  • Allow transformers-0.4
  • Allow lens-4.2
  • Allow mtl-2.2 (21 May 2014)

  • Module parse error messages now include the error location (thanks to Yiding Jia) (15 April 2014)

  • Fix bug introduced by release (accidentally included commit meant for compatibility with unreleased versions of other diagrams packages) (15 April 2014) (BROKEN)

  • Allow haskell-src-exts-1.15 (7 April 2014)

  • Allow exceptions-0.5 (20 March 2014)

  • Allow lens-4.1 in executables also (19 March 2014)

  • Allow lens-4.1 (15 March 2014)

- Update for `hint-0.4`
- Allow `diagrams-lib-1.1` and `diagrams-cairo-1.1`
- Allow `lens-4.0` (8 March 2014)

- Allow `base-4.7` (6 March 2014)

- Allow `diagrams-lib-1.1`
- Allow `lens-4.0` (27 January 2014)

- Allow hashable-1.1

0.5 (27 January 2014)

- Consolidate buildDiagram arguments into a single record of
- Add a `postProcess` argument, a function to be applied to the
  interpreted diagram.

0.4.2 (26 November 2013)

- `buildDiagram` now accepts expressions of type `Diagram` or `IO
  Diagram`: it just tries both.
- Add dependency on `mtl`.

0.4.1 (24 November 2013)

- bug fix: avoid ambiguity errors when parsing unknown operators
- update to work with diagrams-1.0 (2 October 2013)

- allow cryptohash-0.11 (11 September 2013)

- require diagrams-svg >= (11 September 2013)

- fix compile error in diagrams-builder-svg executable
- require diagrams-svg >= 0.8 (10 September 2013) [BROKEN]

- allow diagrams-svg-0.8 (31 August 2013)

- allow cryptohash-0.10 (22 August 2013)

- allow haskell-src-exts 1.14

0.4: 9 August 2013

  • Add hsenv compatibility.
  • Big improvements in the way rebuilding is handled:
    • Strip comments before deciding whether to rebuild, so changing only comments does not trigger a rebuild
    • Take local imports into account: if a diagram has an import which corresponds to a local file, rebuild if that file has changed
    • Rebuild when options (e.g. size) change (3 April 2013)

  • depend on cryptohash >= 0.8 && < 0.10 (use new unified API)
  • remove base16-bytestring dependency

0.3: 3 Feburary 2013

  • new diagrams-builder-postscript tool
  • miscellaneous improvements to diagrams-latex.sty 11 December 2012

  • new diagrams-builder-svg tool
  • deal properly with an empty list of sources (#2)
  • put cached diagrams in .diagrams_cache instead of diagrams by default
  • bug fix: cached files should use same extension as requested output, not “png”
  • bug fix: create output directory for cached images if it doesn’t exist
  • new module Diagrams.Builder.CmdLine; factor out common utilities for command-line tools
  • depend on 0.6 versions of diagrams libs 26 August 2012

Initial release