Build Status

This package is a repository for user contributions to the diagrams project: generation of specialized diagrams, fun or instructive examples, half-baked ideas, stuff which is not sufficiently polished or general to go in the diagrams-lib package but is nonetheless worth sharing. Any code is welcome, as long as it conforms to a few simple standards:

  • Code must be released under a BSD3 license (see the LICENSE).

  • You must list yourself as the maintainer.

  • Try to keep external dependencies to a minimum; the goal is for diagrams-contrib to be easily installable by as many people as possible. New dependencies will be considered on a case-by-case basis. Dependencies involving the FFI will most likely be rejected. If you have some cool code using diagrams which requires big external dependencies, you should release it as a separate package rather than including it in diagrams-contrib.

  • There should at minimum be a Haddock comment on the module itself, explaining the purpose, giving some examples of use, etc. You may also want to use diagrams-haddock to include some example images in the Haddock documentation; see the diagrams-haddock documentation and take a look at other modules in the package for examples.

  • It must compile with no warnings under -Wall. This may seem a bit draconian, but you’ll get over it. If it makes you feel any better, you are welcome to turn off specific warnings for your module with an {-# OPTIONS_GHC -fno-warn-blah #-} pragma.

For more general information on contributing to the diagrams project, see the Contributing page on the diagrams wiki.


1.4.4 (12 Nov 2019)

  • Updated to build on GHC 8.8
  • New module Diagrams.TwoD.Path.IntersectionExtras

1.4.3 (14 May 2018)

  • New Semigroup instance for Following
  • Allow base-4.11 and lens-4.16
  • Drop GHC-7.8 support (9 February 2018)

  • Bug fix: remove Semigroup instance on Following for now, until a corresponding instance is added for Trail' in diagrams-lib.

1.4.2 (4 Feb 2018)

  • New function Diagrams.TwoD.Layout.Constrained.runLayout (thanks to Sandy Maguire)

1.4.1 (3 July 2017)

  • allow QuickCheck-2.10
  • allow base-4.10 (for GHC-8.2)
  • allow MonadRandom-0.5
  • export some things inadvertently unexported from Diagrams.TwoD.Grid (#68)

Hackage revisions:

  • r1:
    • allow QuickCheck-2.11 (13 November 2016)

  • allow cubicbezier-0.5

  • allow HUnit-1.6 (Hackage revision 2, 21 March 2017)

  • Revision 2 on Hackage requires cubicbezier-0.6 (which has some relevant bug fixes).

1.4 (2016-10-26)

  • New features

    • New modules:

      • Diagrams.TwoD.Path.LSystem: module for generating L-system fractals

      • Diagrams.TwoD.Path.Boolean: boolean operations on paths

      • Diagrams.Color.XKCD: Common names for the 949 most common RGB monitor colors, as determined by the xkcd color name survey.

      • Diagrams.TwoD.Layout.Constrained: 2D layout via relative constraint specifications

      • Diagrams.Anchors: layout via specified anchor points

      • Diagrams.TwoD.Path.Follow: monoid for trails which matches tangent vectors at endpoints

    • Diagrams.TwoD.Path.IteratedSubset is greatly expanded, with more tools, examples, and documentation

    • New radial layout algorithm for rose trees, radialLayout function in Diagrams.TwoD.Layout.Tree

    • Code in Diagrams.TwoD.Apollonian cleaned up and generalized

  • API changes

    • Diagrams.TwoD.Path.Turtle: pen width is now a Measure n instead of n (31 August 2016)

  • allow QuickCheck-2.9 (6 June 2016)

  • allow base-4.9
  • allow data-default-0.7
  • allow data-default-class-0.1
  • test with GHC 8.0.1 (1 May 2016)

  • allow lens-4.14 (20 April 2016)

  • allow data-default-0.6 (10 November 2015)

  • allow semigroups-0.18 (28 September 2015)

Fix compilation error with lens-4.13 under ghc-7.10. (17 September 2015)

  • allow lens-4.13
  • allow linear-1.20
  • allow semigroups-0.17 (4 September 2015)

  • allow HUnit-1.3

v1.3.0.4 (2015-07-19)

Full Changelog

v1.3.0.3 (26 May 2015)

  • allow lens-4.11 (12 May 2015)

  • allow MonadRandom-0.4 (29 April 2015)

  • allow QuickCheck-2.8 in test suite (19 April 2015)

  • New features

    • Generalized Diagrams.TwoD.IteratedSubset and added more examples.
    • New module Diagrams.TwoD.Layout.Grid.
  • API changes

    • Diagrams.Lens has had a lot of its lenses removed because they’re either invalid lenses or are now in diagrams-lib.
  • Dependency/version changes

    • Allow diagrams-core-1.3
    • Allow diarams-lib-1.3
    • use linear instead of vector-space (2 April 2015)

  • allow lens-4.9
  • allow vector-space-0.10 (13 Jan 2015)

  • Allow vector-space-0.9
  • Allow lens-4.7 (04 Dec 2014)

  • Allow semigroups-0.16 (17 November 2014)

  • Allow lens-4.6 (12 Sept 2014)

  • Allow text-1.2
  • Allow MonadRandom 0.3 (22 August 2014)

  • Allow lens-4.4

1.1.2 (28 May 2014)

  • New features

    • New module Diagrams.TwoD.Grid, for making grids.
  • Dependency/version changes

    • Allow diagrams-core-1.2
    • Allow diarams-lib-1.2
    • Allow semigroups-0.15
    • Allow lens-4.2
    • Allow mtl-2.2 (15 May 2014)

- Allow `semigroups-0.14` (10 April 2014)

- Allow `semigroups-0.13` (19 March 2014)

  • Allow lens-4.1 (9 March 2014)

- Allow `vector-space-points-0.2`

1.1.1 (8 March 2014)

- require `diagrams-core-1.1` and `diagrams-lib-1.1` (15 January 2014)

- allow text-1.1

1.1 (1 January 2014)

- Switch to using lens for `SymmLayoutOpts` and `ForceLayoutTreeOpts`
- Require `force-layout-0.3` (28 November 2013)

- Allow semigroups-0.12

1.0: 25 November 2013

  • New features

    • New module Diagrams.TwoD.Sunburst, for drawing sunburst charts.
    • New module Diagrams.TwoD.Path.Metafont, for specifying trails/paths using an API inspired by Metafont. Like cubicSpline but gives you control over things like the tension/curvature or the tangent at a given point.
    • New module Diagrams.TwoD.Path.Calligraphic for making simple “calligraphic” strokes.
    • New module Diagrams.Lens with lenses for working with diagrams.
  • Bug fixes

    • Diagrams.TwoD.Factorization.primeLayout has been rewritten to avoid iterated transformations, giving a significant performance boost.

0.7: 9 August 2013

  • New features

    • New module Diagrams.Color.HSV with an hsvBlend function for blending colors in HSV space.

    • Diagrams logo code is now in Diagrams.Example.Logo.

    • New symmetric layout algorithm for binary trees in Diagrams.TwoD.Layout.Tree.

  • Bug fixes

    • Fix a bug in Diagrams.TwoD.Path.Turtle which sometimes caused it to output a doubled path (#13).

0.6.1 (23 March 2013)

  • New features

    • New Diagrams.TwoD.Path.IteratedSubset module, for constructing paths using an “iterated subset” algorithm (repeatedly replacing segments with a given path).

    • New Diagrams.TwoD.Layout.CirclePacking module for circle-packing layout

    • New Diagrams.TwoD.Factorization module, for creating “factorization diagrams” as seen at and on the cover of Hacker Monthly (

    • Diagrams.TwoD.Path.Turtle: generalize runTurtle function, and add new functions drawTurtle and sketchTurtle. drawTurtle results in a diagram (like the old runTurtle), and sketchTurtle yields a path (ignoring pen style commands).

  • Documentation

    • Added lots of example images using diagrams-haddock (19 March 2013)

  • bump upper bound to allow QuickCheck-2.6 27 January 2013

  • Switch to explicit import list for Control.Lens to avoid name conflicts 24 January 2013

  • Require lens-3.8 17 December 2012

  • Update dependencies of tests

0.6: 11 December 2012

  • New features

    • New pure implementation of Turtle library, in Turtle.Internals

    • Diagrams.TwoD.Layout.Tree:

    • New renderTree' function which gives the edge-drawing function access to the values stored at the nodes instead of just the node positions.

    • The type of renderTree is generalized to work with any QDiagram b R2 m.

  • Bug fixes

    • Tiling generation code in Diagrams.TwoD.Tilings wasn’t actually checking whether vertexes had been already visited.
  • Dependency/version changes

    • Switch from fclabels to lens 13 May 2012

  • bump mtl (< 2.2) and data-default (< 0.5) upper bounds 16 March 2012

  • Add Andrew Kennedy’s symmetric rose tree layout algorithm to Diagrams.TwoD.Layout.Tree 9 March 2012

Initial release, containing:

  • Diagrams.Layout.Wrap, for laying out diagrams “wrapped” inside an arbitrary region (Michael Sloan)

  • Diagrams.TwoD.Tilings, for generating various 2D regular tilings (Brent Yorgey)

  • Diagrams.TwoD.Apollonian, for generating Apollonian gaskets (Brent Yorgey)

  • Diagrams.TwoD.Layout.Tree, tree layout and drawing algorithms (Brent Yorgey)

  • Diagrams.TwoD.Path.Turtle, creation of 2D paths using a stateful “turtle” interface (Michael Sloan)