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

Module documentation for

  • Diagrams
    • Diagrams.Core
      • Diagrams.Core.Compile
      • Diagrams.Core.Envelope
      • Diagrams.Core.HasOrigin
      • Diagrams.Core.Juxtapose
      • Diagrams.Core.Names
      • Diagrams.Core.Points
      • Diagrams.Core.Query
      • Diagrams.Core.Style
      • Diagrams.Core.Trace
      • Diagrams.Core.Transform
      • Diagrams.Core.Types
      • Diagrams.Core.V

Build Status

The core modules defining the basic data structures and algorithms for diagrams, a Haskell embedded domain-specific language for compositional, declarative drawing.

Changes (04 Dec 2014)

  • Allow semigroups-0.16 (17 November 2014)

  • Allow lens-4.6 (22 August 2014)

  • Allow lens-4.4 (4 June 2014)

  • Bug fix: Measure values using mini-DSL (atLeast, atMost, etc.) are now properly transformed

1.2 (27 May 2014)

  • New features

    • New function matrixHomRep to convert a transformation to a homogeneous matrix representation.

    • New function dropTransl to drop the translation component from a transformation.

    • A mini-DSL for Measures.

    • New extent function, used in diameter.

    • New dimension function to return the dimension of a vector space.

    • New _relative iso between points and vectors.

    • avgScale function (for computing the average scaling factor of a transformation) has been moved from diagrams-lib to diagrams-core and generalized to work over any vector space.

  • Dependency/version changes

    • Allow semigroups-0.15
    • Allow lens-4.2
  • API changes

    • Major refactoring which removes freeze (and hence Split transforms, etc.) and adds units of Measure.

    • Refactoring and simplification of the Backend class.

    • Remove Multibackend.

    • Remove nullPrim, IsPrim and simplify RPrim so that it does not carry a transformation.

    • Update adjustDia to return a transformation, not just a scale factor. Add renderDiaT which returns a transformation (for use by end users, e.g. to convert output coordinates back into local coordinates). (15 May 2014)

- Allow semigroups-0.14 (10 April 2014)

- Allow semigroups-0.13 (19 March 2014)

- Allow lens-4.1

1.1 (8 March 2014)

  • New features

    • New basis function
    • New determinant function for computing the determinant of a Transformation
    • Add Typeable constraint on Prims, making it possible to extract things back out of a Prim wrapper using cast
    • Raw Traces now return a sorted list of intersections, instead of only the smallest. This is used to implement a new family of functions rayTraceV, rayTraceP, maxRayTraceV, maxRayTraceP, which work similarly to the parallel versions without Ray, but return the first intersection in the positive direction from the given point, rather than the smallest in absolute terms.
    • New Annotation type and corresponding applyAnnotation function, for attaching uninterpreted annotations at specific points in a diagram tree. Currently this is used for hyperlinks; more annotation types will be added in the future.
  • Dependency/version changes

    • Require lens-4.0
    • Allow vector-space-points-0.2
  • Bug fixes

    • Looking up a subdiagram by name now results in a diagram which still has that name (#43) (27 November 2013)

- Allow semigroups-0.12

1.0 (25 November 2013)

  • New features

    • Delayed subtrees: instead of a primitive, one can now also have a delayed subtree at a leaf, containing a continuation which generates a QDiagram when given the accumulated d-annotation at that point in the tree. Useful for things which need to know the final transformation applied to them before deciding what diagram to generate. The prototypical use case is arrows: see . However, this may be useful for other things as well: for example, diagrams which scale normally until hitting some maximum or minimum size, at which point they refuse to scale any further (or more generally diagrams which scale as some non-linear function of the transformation applied to them).

      The only downside is that the u-annotation must be fixed ahead of time—doing otherwise requires a more general solution for constraint solving.

    • New function lookupName for doing a simple lookup of a named subdiagram

    • New module Diagrams.Core.Compile, containing a framework for compiling QDiagrams into a simpler tree type RTree, which may be used by backends for rendering.

  • New instances

    • Qualifiable instances for (,), (,,), [], Set, Map k, and (->) e.

    • (->) e instance for Juxtaposable (thanks to Carlos Scheidegger)

  • API changes

    • Export pointDiagram function, which creates an otherwise empty diagram with a point (not empty) envelope

    • A bunch of stuff now uses machinery from the lens library.

      • envelope, trace, and subMap are now Lens'es
      • Wrapped instances for Trace, TransInv, QDiagram, SubMap, Envelope, Style, Query, and Name (replaces Newtype instances)
      • Isos for Query, Envelope, QDiagram, SubMap, TransInv (26 September 2013)

allow semigroups-0.11

0.7: 9 August 2013

  • New features

    • new function onBasis, to extract the matrix equivalent of a Transformation
    • SubMaps are now Deletable
    • new function localize for hiding/deleting names from scope
    • new IsPrim class, containing transformWithFreeze function. This is primarily intended to support scale-invariant primitives (e.g. arrowheads) but may be useful for other stuff as well. The default implementation of renderDia now uses transformWithFreeze.
    • optimized Transformable instance for TransInv
  • New instances

    • Eq, Ord, Enveloped, Traced, and Qualifiable instances for TransInv

    • Transformable instance for functions, which acts by conjugation

  • API changes

    • named and namePoint have moved to the diagrams-lib package.
  • Dependency/version changes

    • allow base-4.7
    • upgrade to monoid-extras-0.3 5 March 2013

  • bug fix: the ‘diameter’ and ‘radius’ functions now work correctly. 7 January 2013

  • allow semigroups-0.9

0.6: 11 December 2012

  • New features

    • Proper support for subdiagrams: previous versions of diagrams-core had a mechanism for associating names with a pair of a location and an envelope. Now, names are associated with actual subdiagrams (including their location and envelope, along with all the other information stored by a diagram).

      See Diagrams.Core.Types.

    • Traces: in addition to an envelope, each diagram now stores a “trace”, which is like an embedded raytracer: given any ray (represented by a base point and a vector), the trace computes the closest point of intersection with the diagram along the ray. This is useful for determining points on the boundary of a diagram, e.g. when drawing arrows between diagrams.

      See Diagrams.Core.Trace.

  • API changes

    • The modules have all been renamed to be more consistent with the module naming scheme in the rest of the diagrams universe. In particular:

      Graphics.Rendering.Diagrams –> Diagrams.Core Grahpics.Rendering.Diagrams.Core –> Diagrams.Core.Types Graphics.Rendering.Diagrams.* –> Diagrams.Core.*

    • Graphics.Rendering.Diagrams.UDTree has been split out into a separate dual-tree package (which has also been substantially rewritten).

    • Graphics.Rendering.Diagrams.{Monoids,MList} have been split out into a separate monoid-extras package.

    • The names function now returns a list of names and their associated locations, instead of the associated subdiagrams. In particular the output is suitable to be rendered to a String using show.

    • The new subMap function fills a similar role that names used to play, returning the entire mapping from names to subdiagrams.

    • New functions envelope[VP]May

      envelopeV and envelopeP return the zero vector and origin, respectively, when called on an empty envelope. However, sometimes it’s useful to actually know whether the envelope was empty or not (the zero vector and the origin are legitimate outputs from non-empty envelopes). The new functions have their return type wrapped in Maybe for this purpose.

    • New functions envelopeS and envelopeSMay

      Like envelope[VP](May), but returning a scalar multiple of the input vector.

    • The Graphics.Rendering.Diagrams.Util module has been removed, along with the withLength function. Calls to withLength can be replaced using

      withLength s v = s *^ normalized v

    • Add needed constraints (InnerSpace v, OrderedField (Scalar v), Monoid' m) to the type of the renderDias method in the MultiBackend class.

    • Generalized Transformable instances for pairs and tuples

      Previously, the components of the tuples were required to have the same type; but everything still works as long as they all share the same vector space. This is actually useful in practice: say, if we wanted to pair a diagram with a path and then apply the same transformation to both.

  • Improvements

    • More efficient implementation of diameter
  • Dependency/version changes

    • Tested with GHC 7.6.1
    • allow base-4.6
    • allow containers-0.5.*
    • allow MemoTrie-0.6.1
  • Bug fixes

    • juxtaposeDefault now correctly handles empty envelopes (#37)

      juxtaposeDefault is now the identity on the second object if either one has an empty envelope. In particular this means that mempty is now an identity element for beside and friends. 11 May 2012

  • Update MemoTrie upper bound to allow MemoTrie-0.5

0.5: 9 March 2012

  • New features:

    • New Juxtaposable class
    • New NullBackend and D types, for conveniently giving a monomorphic type to diagrams when we don’t care which one it is.
    • #27: Change type of adjustDia to return a new options record (with an explicitly filled-in size)
  • New instances:

    • Enveloped, HasOrigin, Juxtaposable, HasStyle, and Transformable instances for Sets and tuples
    • V Double = Double
    • Juxtaposable and Boundable instances for Map
  • API changes

    • AnnDiagram renamed to QDiagram
    • #61: terminology change from “bounds” to “envelope”
      • boundary -> envelopeP
      • “bounding region” -> “envelope”
      • Bounds -> Envelope
      • Boundable -> Enveloped
      • getBounds -> getEnvelope
      • etc.
    • Split out definition of Point into separate package (vector-space-points)
    • The Point constructor P is no longer exported from Graphics.Rendering.Diagrams. See the Diagrams.TwoD.Types module from diagrams-lib for new tools for working with abstract 2D points. If you really need the P constructor, import Graphics.Rendering.Diagrams.Points.
    • Name-related functions now return “located bounding functions” instead of pairs of points and bounds, to allow for future expansion.
  • Dependency/version changes:

    • vector-space 0.8 is now required.
    • Bump base upper bound to allow 4.5; now tested with GHC 7.4.1.
  • Bug fixes:

    • Bug fix related to empty envelopes

0.4: 23 October 2011

  • improved documentation
  • a few new instances (Newtype Point, Boundable Point)
  • new functions (value, clearValue, resetValue) for working with alternate query monoids

0.3: 18 June 2011

  • big overhaul of name maps:
    • allow arbitrary types as atomic names
    • carry along bounding functions as well as names in NameMaps
    • additional functions for querying information associated with names
  • fix for issue #34 (fix behavior of setBounds)
  • Transformable and HasOrigin instances for Transformations

0.2: 3 June 2011

  • bounding regions can now be overridden
  • new namePoint function for more flexibly assigning names to arbitrary points
  • add HasStyle, Boundable, and HasOrigin instances for lists
  • add a “trivial backend”
  • transformable attributes

0.1.1: 18 May 2011

  • link to new website

0.1: 17 May 2011

  • initial preview release