diagramslib
Embedded domainspecific language for declarative graphics
Version on this page:  1.4.3@rev:1 
LTS Haskell 22.16:  1.4.6.1 
Stackage Nightly 20240412:  1.4.6.1 
Latest on Hackage:  1.4.6.1 
diagramslib1.4.3@sha256:04f77778d4b550d3c8e54440800685f88467bef91075e82e009a8a6f45c51033,8232
Module documentation for 1.4.3
 Diagrams
 Diagrams.Align
 Diagrams.Angle
 Diagrams.Animation
 Diagrams.Attributes
 Diagrams.Backend
 Diagrams.BoundingBox
 Diagrams.Combinators
 Diagrams.Coordinates
 Diagrams.CubicSpline
 Diagrams.Deform
 Diagrams.Direction
 Diagrams.Envelope
 Diagrams.LinearMap
 Diagrams.Located
 Diagrams.Names
 Diagrams.Parametric
 Diagrams.Path
 Diagrams.Points
 Diagrams.Prelude
 Diagrams.Query
 Diagrams.Segment
 Diagrams.Size
 Diagrams.Tangent
 Diagrams.ThreeD
 Diagrams.Trace
 Diagrams.Trail
 Diagrams.TrailLike
 Diagrams.Transform
 Diagrams.TwoD
 Diagrams.TwoD.Adjust
 Diagrams.TwoD.Align
 Diagrams.TwoD.Arc
 Diagrams.TwoD.Arrow
 Diagrams.TwoD.Arrowheads
 Diagrams.TwoD.Attributes
 Diagrams.TwoD.Combinators
 Diagrams.TwoD.Curvature
 Diagrams.TwoD.Deform
 Diagrams.TwoD.Ellipse
 Diagrams.TwoD.Image
 Diagrams.TwoD.Model
 Diagrams.TwoD.Offset
 Diagrams.TwoD.Path
 Diagrams.TwoD.Points
 Diagrams.TwoD.Polygons
 Diagrams.TwoD.Segment
 Diagrams.TwoD.Shapes
 Diagrams.TwoD.Size
 Diagrams.TwoD.Text
 Diagrams.TwoD.Transform
 Diagrams.TwoD.Types
 Diagrams.TwoD.Vector
 Diagrams.Util
The standard library for diagrams, a Haskell embedded domainspecific language for compositional, declarative drawing.
Changes
v1.4.3 (20191106)
 Bumps to upper bounds, to allow building with:
base4.13
(tested with GHC 8.8.1)intervals0.9
semigroups0.19
hashable1.3
 Many bug fixes, including
 Added derived
Eq
andOrd
instances forFixedSegment
v1.4.2.3 (20180611)
 Bug fix for
extrudeEnvelope
and friends (#316)
v1.4.2.2 (20180508)
 Fixes for GHC < 8.0
v1.4.2.1 (20180413)
 Allow
base4.11
(GHC 8.4)  Allow
tastyquickcheck0.10
 Bug fix for
Diagrams.TwoD.Offset.capArc
(#310)
v1.4.2r1 (20171220)
Hackage revision to allow tasty1.0
in the test suite.
v1.4.2 (20171220)
 New functions:
boxGrid
, for computing a grid of regularly spaced points.scalingRotationTo
andscaleRotateTo
, for affine conformal 2D transformations.
 Documentation fixes:
dirBetween
PolyOrientation
 Upper bound updates: allow
tasty0.12
,tastyquickcheck0.9
,tastyhunit0.10
,optparseapplicative0.14
 Test with GHC 8.2.2
v1.4.1.2 (20170610)
 Fix test suite compilation failure #299.
v1.4.1.1 (20170606)
 Fix
Diagrams.Points.centroid
to make it total.  Fix bug in
Diagrams.Transform.Matrix.fromMatWithInv
(and hence also related functions which called it, such asfromMat22
andfromMat33
).
v1.4.1 (20170528)
 New functions
embeddedImage
andloadImageEmbBS
for loading images.  Fix #289 which could have caused strange behavior in looped compilation mode on 32bit platforms.
 Allow
intervals0.8
anddirectory1.3
.  Minor fixes to compile with GHC 8.2.
v1.4.0.1 (20161107)
 Fix test suite compilation problem (#286)
v1.4 (20161026)

New features

New
mkText'
function, which allows making a text primitive without recommending a fill colour or font size so users can recommend their own (e.g. using therecommendFontSize
function). 
New functions
reflectXY
andreflectionXY

New
composeAligned
combinator for doing composition under an alignment while leaving the local origin unaffected. 
Add
_LocLoop
and_LocLine
prisms 
New
bspline
function for creating uniform cubic Bsplines 
New 3D features:
 New
Skinned
class  Improved handling of 3D primitives
 CSG
 New

New standard attributes for separate fill and stroke opacity (see #248).

New
HasQuery
class for things which can be spatially queried for values from some monoid. 
New function
inquire
for testing whether a given point is inside a diagram. 
New font weights:
bolder
,lighter
,thinWeight
,ultraLight
,light
,mediumWeight
,heavy
,semiBold
,ultraBold
. Note that currently only the SVG backend deals with the new weights. 
Export
GetSegmentCodomain
and update documentation 
Improved performance of 2D rotations


New instances

Alignable
instance forLocated

ToPath
instances for lines and loops 
Serialize
instances forTrail
,Path
,Located
,SegTree
,Segment

Generic
instances forPath
,Located

Action
instance forAngle
: angles act by rotation.


API changes
snugBL
,snugBR
,snugTR
andsnugBR
are deprecated. These functions were unintuitive, adhoc, and not particularly useful, especially since e.g.snugL
andsnugB
do not commute. You can use something likesnugB . snugL
directly, or usesnug
with a direction vector. See #250 for more details.

Dependency/version changes
 upgrade
fsnotify
and drop dependency on deprecatedsystemfilepath
 Allow
lens4.15
 Many other bumped upper bounds, see release notes for minor releases below
 upgrade

Bug fixes
v1.3.1.4 (20160816) (16 August 2016)
 allow
optparseapplicative0.13
v1.3.1.3 (20160605)
 allow
base4.9
 allow
datadefaultclass0.1
 test with GHC 8.0.1
v1.3.1.2 (20160501)
 allow
lens4.14
v1.3.1.2 (20160219)
 allow
unorderedcontainers0.2.*
v1.3.1.0 (20160214)
 improve path offset calculations
v1.3.0.9 (20160114)
 allow
unorderedcontainers0.2.6
v1.3.0.8 (20151110)
 allow
semigroups0.18
v1.3.0.7 (20151008)
 Add
LambdaCase
extension to.cabal
file, socabal
correctly reports thatdiagramslib
does not build onGHC7.4
.
v1.3.0.6 (20150929)
 Allow
optparseapplicative0.12
v1.3.0.5 (20150918)
 Fix compilation problem with
lens4.13
v1.3.0.4 (20150917)
Dependency/version changes
 Allow
lens1.13
 Allow
semigroups0.17
 Require
linear1.20
v1.3.0.3 (20150810)
Dependency/version changes
 Drop dependency on deprecated
systemfilepath
package  Require
fsnotify0.2.1
v1.3.0.2 (20150719)
v1.3.0.1 (20150526)
v1.3 (20150419)
New features

Native image type that backends can specify.

Affine maps between spaces for pathlike objects. A new
Diagrams.ThreeD.Projections
has some helper functions for orthographic and perspective projections. 
Intersections for pathlike objects using Bézier clipping.

Helper functions in
Diagrams.Matrix
for converting between transforms and matrices. 
New
Diagrams
module that only exports functions defined in diagrams. 
New
Direction
type.Direction
is a vector that’s forgot it’s magnitude. Some functions have changed their type fromR2
toDirection V2 n
to make it clear that magnitude has no effect. 
Use the
fsnotify
package for command line looping. Command line looping now works on Windows. 
groupOpacity
function added for lowering the opacity of a diagram as a whole. 
New
ToPath
class for converting pathlike things to aPath
.
New instances

Each
instances forBoundingBox
,Offset
,Segment
,FixedSegment
andPath
. 
Reversing
instances forOffset
,Segment
,FixedSegment
,Trail
andPath
. 
AsEmpty
instances forBoundingBox
,Trail
andPath
. 
Cons
andSnoc
instances forPath
andLine
. 
New
Show
instances forAngle
,Segment
,SomeColor
,Trail'
andat
. 
Tangent
instance for(FixedSegment v n)
. 
Ord
instances forLineMiterLimit
,LineJoin
andLineCap
.
New helper functions

_Line
and_Loop
prisms. 
Style lenses:
_fontSize
,_lineWidth
,_fillTexture
,_lineTexture
,_opacity
,_font
,_lineCap
,_lineJoin
_dashing
. 
_SomeColor
iso and_AC
prism onto anAlphaColour
. 
atPoints
function to zip points with diagrams.
API changes

Diagram
type synonym now only takes a backend token:Diagram B

Types that previously had a
v
variable now havev
andn
. 
Control.Lens
andData.Default.Class
are now exported from fromDiagrams.Prelude

Measure
has a new internal representation.Local
,Global
,Normalized
, andOutput
have been renamed tolocal
,global
,normalized
andoutput
respectivly. 
SizeSpec2D
has moved toSizeSpec v n
inDiagrams.SizeSpec
.Dims, Height, Width and
Absolutehave moved to
dims2D,
mkHeight,
mkWidthand
absolute` respectively. 
Color
instances forColour
andAlphaColour
are limited toDouble
for better type inference. 
under
has been renamed tounderT
. Newtransformed
,translated
,movedTo
,movedFrom
androtated
isomorphisms to use with lens’sunder
function. 
stroke
is now polymorphic. UsestrokePath
orstrokeP
to get oldstroke
behaviour. 
angleBetween
now works for any vector space, which means the angle is always positive. The old behaviour can be retrieved fromsignedAngleBetween

arc
now takes a startingDirection
and a sweepAngle
.arcCW
andarcCCW
take a start and finishDirection
.
Dependency/version changes
 use
linear
instead ofvectorspace
Closed issues:

Perspective deformation of square vertices yields extra point #244

Local fontsize renders inconsistentl on diffrent backends #243

Factor out Diagrams.Solve into a package? #235
Merged pull requests:
1.2.0.9 (2 April 2015)

allow
lens4.9

allow
vectorspace0.10
v1.2.0.8 (20150113)
Merged pull requests:
v1.2.0.7 (20141207)
v1.2.0.6 (20141204)
Merged pull requests:
v1.2.0.5 (20141117)
Implemented enhancements:
Fixed bugs:
Sectionable
instance forSegTree
is not a linear reparameterization. #217
Closed issues:

bezierFromSweep very slow? #227

All lines render at same width #222

numerically stable cubic rootfinder #204
Merged pull requests:

Diagram b v n to QDiagram b v n Any #219 (jeffreyrosenbluth)
v1.2.0.4 (20141008)
Merged pull requests:
v1.2.0.3 (20140907)
Closed issues:
 arrowFromLocatedTrail function #205
Merged pull requests:
v1.2.0.2 (20140822)
Implemented enhancements:
 Generalize Angle class? #38
Fixed bugs:
 –selection and –src both use s abbreviation #172
Closed issues:
 Spike arrowhead and tail render with oversized joint #203
Merged pull requests:

add atPoints, deprecate decorateFoo #198 (jeffreyrosenbluth)

Add bg’ #197 (jeffreyrosenbluth)

add convenience synonyms [hv]sep for [hv]cat’ (with & sep .~ x) #196 (byorgey)

Vertices #192 (jeffreyrosenbluth)
v1.2.0.1 (20140604)
Closed issues:
 Local headLength / headGaps act like Output #193
Merged pull requests:
v1.2 (20140602)
New features

Several attributes (such as line width, dashing size, arrowhead size, and font size) that formerly had a value of type
Double
now have the more general typeMeasure R2
. This allows the attributes to be specified relative to one of four measurement frames:Local
,Global
,Normalized
, andOutput
. 
New DSL for specifying measurements.

New synonyms for specifying measurements, e.g.
thin
,thick
, andmedium
,large
. 
Support for radial and linear gradients for fills and strokes.

New
DImage
type that supports both embedded and external images in Backends that support them. 
New
lengths
Traversal for settingheadLength
andtailLength
simultaneously. 
Frustrum
andBox
shapes added toDiagrams.ThreeD.Shapes
. 
New function
quartForm
to find roots of quartic polynomials. 
New Lenses for polar coordinates.

New trig functions,
sinA
,atanA
, etc. which takeAngle
as input or output.
New instances
Transformable
instances forLineWidth
,Dashing
,LineTexture
, andFillTexture
.
API changes

FillColor
andLineColor
attributes have been replaced with the more generalFillTexture
andLineTexture
. Use thesolid
function to convert a color to a texture. 
The size of arrow heads and tails is now specified in terms of length instead of the radius of their circumcircle.

Gaps at the ends of arrows are now specified using
Measure R2
. 
The
gap
traversal has been replaced bygaps
for consistency in naming, thoughgap
is still provided for backwards compatibility. 
fontSize
now takes a value of typeMeasure R2
. 
Get rid of (bitrotted)
Show
backend. 
Functions in
TwoD.Adjust
now return the adjustment transformation itself in addition to the resizedDiagram
andOptions
record; this can be used, e.g. to convert screen coordinates back into diagram coordinates. 
Export
pathLocSegments
. 
The
avgScale
function has been moved toDiagrams.Core
. 
The
Angle
definition and related functions (e.g.angleBetween
) have moved to a separate module,Diagrams.Angle
. 
A separate
Diagrams.TwoD.Attributes
module now contains most of the attributes that require 2D transformation instances. 
The
splitColorFills
function has been replaced bysplitTextureFills
.
Dependency/version changes

Allow
semigroups0.15

Allow `optparseapplicative0.9.0

Allow
lens4.2
Implemented enhancements:
Closed issues:

fails to build against HP #190

text does not scale #179

Please add support for latest version of intervals library #170

presence of arrowHead can tilt connection sideways #162
Merged pull requests:

Quartic formula, no obvious bugs #187 (Mathnerd314)

Arrow length #185 (jeffreyrosenbluth)

Texture #181 (jeffreyrosenbluth)

arrow envelopes #180 (jeffreyrosenbluth)

make headSize and tailSize back into ArrowOpts fields #177 (byorgey)

updated the upper bounds of the .cabal constraints for ‘semigroups’ package #176 (zgredzik)

Image2 #174 (jeffreyrosenbluth)

Image #173 (jeffreyrosenbluth)

Preliminary implementation of Measure #159 (jeffreyrosenbluth)

Gradient #136 (jeffreyrosenbluth)
v1.1.0.7 (20140515)
 Allow
semigroups0.14
v1.1.0.6 (20140410)
 Allow
semigroups0.13
v1.1.0.4 (20140404)
Merged pull requests:

Make Diagrams.Transform.under more polymorphic #168 (FlorentBecker)
v1.1.0.3 (20140319)
 Allow
lens4.1
v1.1.0.2 (20140319)
Merged pull requests:

move avgScale to core #167 (jeffreyrosenbluth)

3d color & lighting, more solids, Angle utilities #166 (bergey)

Added bothSize function, lineHead and lineTail #165 (jeffreyrosenbluth)
v1.1.0.1 (20140309)

Depend on
hashable
package, and addHashable
instance forSizeSpec2D
.Technically, the PVP specifies that adding a new instance requires a major version bump. However, I highly doubt anyone was making their own orphan
Hashable
instances before. Feel free to yell at Brent if this breaks your build.
v1.1 (20140309)
New features

Support for
Deformation
s, arbitrary (nonaffine) transformations on objects such as points, paths, and located trails (though not on diagrams). 
New functions
clipTo
, which clips a diagram’s envelope and trace along with its visual representation, andclipped
, which clips the diagram’s visual representation but replaces its envelope and trace with those of the clipping path. 
New
arrowV
function, for creating an arrow with the direction and magnitude of a given vector. 
gap
traversal, for setting the head and tail gaps of an arrow simultaneously. 
Generalized types for
centerXY
andsnugXY
, based on newbasis
function from `diagramscore 
New 3D
Transform
s, alignment, and 3DspecificPrelude
. 
New
frame
function similar topad
, but increases the envelope of a diagram by an amount specified in local units in every direction irrespective of the local origin. 
New
splitFills
function for pushing fill attributes down to subtrees containing only loops (mostly of relevance only to backend implementors).
New instances

Typeable
instances for all data types that are used as diagram primitives. 
Sectionable
instance forFixedSegment
.
API changes

Angle
is now a type, rather than a class. It uses a single internal representation for angles, and lensesturn
,rad,
anddeg
are supplied for constructing (using@@
) and viewing (using^.
)Angle
s in various units. In addition, theNum
instance forAngle
has been removed, eliminating a class of errors where a bare number is interpreted in units other than what you expect. 
Removed
Num
instance for angles.
Dependency/version changes

Require
lens >= 4.0
. 
Allow
array0.5
. 
Allow
hashable1.1
. 
Remove
NumInstances
dependency.
Bug fixes

Exclude joins in offsets on close segments (#160).

Exclude extra segment when joining loops in offset (#155).
Performance improvements
colorToSRGBA
function now avoids expensive matrix operations, offering dramatic speedups in rendering diagrams with many color attributes.
Implemented enhancements:

Better color model in 3D #121

Projective/perspective transforms for points and paths #108

clipTo function #35
Fixed bugs:
 Offset Bug #155
Closed issues:
 Expand of an expand #160
Merged pull requests:

fix doc for === and  #164 (denysduchier)

Exclude extra segment when joining loops in offset. Fixes #155. #158 (fryguybob)

added basis, generalized
centerXY
andsnugXY
#157 (jeffreyrosenbluth) 
derive Typeable for all data types used in Prims #156 (byorgey)

removed NumInstances dependency #153 (jeffreyrosenbluth)

Change internal color representation to SRGBA #149 (jeffreyrosenbluth)
v1.0.1 (20140126)
Implemented enhancements:
 Module for generating nice colors/color schemes #77
Closed issues:
 “Maybe.fromJust: Nothing” error when connecting translated small diagram #147
Merged pull requests:

return list of traces #145 (jeffreyrosenbluth)

added clipTo #144 (jeffreyrosenbluth)
v1.0.0.1 (20131128)
v1.0 (20131125)
New features

New modules
Diagrams.TwoD.Arrow
andDiagrams.TwoD.Arrowheads
for creating arrows. 
New module
Diagrams.Backend.CmdLine
, providing a flexible framework for creating commandlinedriven diagram rendering executables. 
New functions in
Diagrams.Offset
:offsetTrail
andoffsetPath
for onesided offsets of trails and paths;expandTrail
andexpandPath
for “stroking” trails and paths, computing a path whose fill corresponds to the stroke of the given trail or path. 
New module
Diagrams.Tangent
for computing tangent and normal vectors of segments, trails, and paths. 
New functions in
Diagrams.Align
to allow diagrams to be aligned byTrace
calledsnug
,snugBy
andsnugCenter
and the ability to define other boundary functions for alignment. FunctionssnugL
,snugR
, etc. are included inTwoD.Align
. 
Lenses from
Control.Lens
are now used consistently for record fields throughout the library. 
New function
angleRatio
for calculating the ratio between two angles. 
Restricted identity functions
asTurn
,asRad
, andasDeg
for resolving type ambiguity 
New miter limit attribute.

New function
annularWedge
inTwoD.Arc

New
avgScale
utility inTwoD.Transform
, for backends which cannot fully implement freezing of line width 
New function
heptagon
, a vast improvement over the linguistic frankensteinseptagon
. 
New function
lookupName
(reexported fromdiagramscore
) for simple lookups of named subdiagrams 
New function
angleBetween
to calculate the angle between two vectors. 
New function
arcBetween
to draw an arc between two given points. 
A bunch of new modules containing types, primitives and utilities for constructing 3D diagrams:
Diagrams.ThreeD.Align
,.Camera
,.Light
,.Shapes
,.Transform
,.Types
, and.Vector
. This is still a “feature preview” (in particular, appropriate 3D backends are still under construction).
New instances

AdditiveGroup
andVectorSpace
instances forTurn
,Rad
,Deg

Alignable
instance for(>) e

Default
instances forFillRule
,FillRuleA
,LineJoin
,LineCap
,FillColor

Show
instances forFillRule
,FillRuleA
API changes

e
no longer exported fromDiagrams.Prelude
. 
Diagrams.BoundingBox
is no longer exported fromDiagrams.Prelude
. 
Reexport
Diagrams.Core.pointDiagram
fromDiagrams.Prelude
. 
Added
fromAlphaColour
method toColor
class. 
&
renamed to^&

Stop reexporting
tan
,over
, andboth
fromData.Colour
. 
New coordinate lenses
_x
,_y
, and_z
forR2
,P2
,R3
,P3

Export
fullTurn
fromDiagrams.Prelude
. 
Codomain (Located a)
is nowPoint (Codomain a)
instead ofLocated (Codomain a)
. 
Export
domainBounds
fromDiagrams.Parametric
. 
Adjusting functionality moved from
Diagrams.Parametric
to its own module,Diagrams.Parametric.Adjust
. 
Rename
strokeT
(and primed variant) tostrokeTrail
; renamestrokeLocT
tostrokeLocTrail
. 
ScaleInv
is now in its own module,Diagrams.TwoD.Transform.ScaleInv
. 
Reexport
Image
type (but not constructor) fromDiagrams.TwoD

Removed
Floating
andRealFloat
instances forTurn
andDeg

offsetSegment
now returns aLocated
instead of a tuple. 
Removed
Num
andFractional
instances forR2
.
Dependency/version changes

Remove
newtype
dependency 
New dependencies on
lens
,tagged
,optparseapplicative
,filepath
,safe
,vectorspacepoints
,MemoTrie

Depend on
intervals >= 0.3 && < 0.5
.
Bug fixes

Depend on
intervals 0.3
, which allows diagrams to build on Windows, by evading a GHCi linker bug which affects the FFI use in previous versions of intervals (diagramscontrib#14) 
Use point envelope at the origin for text objects instead of an empty envelope (#115, #116).

Adjusting the end of a trail now works correctly (#95).

Only look for miter join on corners in
Diagrams.TwoD.Offset
(#118). 
wedge
fromDiagrams.TwoD.Arc
is now a Loop (#99) 
Arrows do not behave correctly under scaling #112
Performance improvements

R2
is now strict andUNPACK
ed 
Add strictness to
Offset
,Segment
,OffsetEnvelope
, andSizeSpec2D
. 
Make
getEnvelope
calculation forSegment
more efficient by floating divisions out of the inner calculation. 
Use a specialized
HasTrie
instance forR2
.
Closed issues:
Merged pull requests:

Lenses for setting arrow head, tail, and shaft colors #138 (byorgey)

Add helpers for common optparseapplicative backend command line. #135 (fryguybob)

add located lens for access into Located things #134 (byorgey)

Lens #131 (jeffreyrosenbluth)

correctly (?) compute shaftScale by solving a quadratic #127 (byorgey)

calculate arrow shaftScale using projection of ends onto shaft offset #125 (bergey)
v0.7.1.1 (20130927)
Implemented enhancements:

Use a point envelope for builtin text objects #116

implement rotations in 3D #86

Control over boundary conditions on cubic splines. #32
Fixed bugs:
 diagrams with empty envelopes are not properly separated by struts #115
Closed issues:
Merged pull requests:
v0.7.1 (20130911)
New features

New standard miter limit attribute

New functions
lineColorA
,lineWidthA
,lineMiterLimitA
,fontSizeA
for directly applying attribute values 
setDefault2DAttributes
now sets default line cap (butt), line join (miter), and miter limit (10) attributes
New instances

Data.Default
instances for 
LineCap

LineJoin

LineMiterLimit

LineWidth

LineColor

FontSize
Implemented enhancements:
Fixed bugs:
Merged pull requests:

change Codomain of Located to Point (Codomain a) #102 (byorgey)

Default and Show instances for FillRule and FillRuleA #100 (jbracker)

Changes required due to the introduction of Roles in GHC #98 (codan)

removed default implementation of reverseDomain #97 (jeffreyrosenbluth)

fixed issue #95 #96 (jeffreyrosenbluth)
v0.7 (20130809)
New features

New module
Diagrams.TwoD.Curvature
, for computing the curvature of 2D segments at any given point. 
New module
Diagrams.Offset
, containing anoffsetSegment
function that builds a trail a fixed distance from the original segment. This is a precursor to planned functionsoffsetTrail
andoffsetPath
. 
New function
Diagrams.TwoD.Transform.onBasis
, for extracting a matrix representation of a 2D transformation 
New functions
extrudeEnvelope
andintrudeEnvelope
, for extending or shrinking an envelope only in a certain direction. 
Generalize the
Color
class to absolute colors. This addresses concerns raised in issue #66 by letting the backend choose which color space to renderColor
instances to. Functions are provided for backwards compatibility with the old semantics. 
New function
scaleInvPrim
for creating a diagram from a single scaleinvariant primitive. 
New module
Diagrams.Parametric
, containing a collection of classes abstracting over “parametric” things:Parametric
,DomainBounds
,EndValues
,Sectionable
, andHasArcLength
, with instances for segments, trails, and related things. 
A big refactoring of segments and trails:

Segments can now be either “closed” or “open”.

There are now two types of trails: “lines” (which travel from point A to point B) or “loops” (closed curves which end where they started).
Trail
is now a wrapper type which can contain both loops and lines. 
There is a new
Located
wrapper type for adding locations to translationinvariant things.Path
s now consist of a collection ofLocated Trail
s. 
The
PathLike
class is now renamed toTrailLike
; thetrailLike
function takes aLocated Trail
as input.


New convenience functions
boundaryFrom
andboundaryFromMay
, for computing boundaries of subdiagrams. 
Reexport from
diagramslib
a lot of things defined indiagramscore
, to make them easier for users to find. Several new modules have been created as a result:Diagrams.Query
,Diagrams.Envelope
,Diagrams.Trace
, andDiagrams.Names
. 
Export the
centroid
function fromDiagrams.Prelude
. 
triangle
is now a synonym foreqTriangle
.
New instances

IsPrim
instances forPath
,Ellipsoid
,Image
,Text
, andScaleInv

Eq
,Ord
, andShow
instances forSizeSpec2D
API changes

CircleFrac
has been renamedTurn
(thoughCircleFrac
is retained as a deprecated synonym). 
Diagrams.Coordinates
is no longer exported fromDiagrams.Prelude
. This is for compatibility withlens
, as(&)
is a rather important lens operator and clashes withDiagrams.Coordinates
. Users who want theCoordinates
stuff can importDiagrams.Coordinates
explicitly.
Dependency/version changes

allow
base4.7

upgrade to
monoidextras0.3

depend on
datadefaultclass
instead ofdatadefault

Tested with GHC 7.7.
Bug fixes

Added a special case that was a not handled properly by the quadratic solver, resulting in bogus envelopes in certain cases (#88).

Import only
Data.NumInstances.Tuple
instead ofData.NumInstances
. Previously,Diagrams.Prelude
exportedEq
,Show
, andNum
instances for functions and tuples; now it only exports tuple instances. Users wishing to useDiagrams.CubicSpline
with a vector space built over functions (!?) can importData.NumInstances.Function
themselves. (#48) 
Do scaling on a
Path
before constructing aTrailLike
inrect
(#43)
Implemented enhancements:

Split PathLike, Trail, and Path into separate modules #25

Add support for pathoriented diagrams. #13
Fixed bugs:

Wrong envelope for cubic segment #88

Fix documentation of beside, (===), and () re: monoidal semantics #83

reverseTrail should not generate extra segments for closed trails #24
Closed issues:
 Test issue #91
Merged pull requests:

Add parametric generalizations for segments, trails, Located, etc. #92 (byorgey)

Adding type signature so it compiles with GHC7.7 #90 (codan)

bug fix: add special case for b==0 to quadform solver #89 (byorgey)

Stop exporting Diagrams.Coordinates from Diagrams.Prelude #82 (byorgey)
v0.6.0.3 (20130504)
Closed issues:
 Offset #80
Merged pull requests:
v0.6.0.2 (20130329)
Implemented enhancements:
 Don’t export Eq and Show instances for functions from Diagrams.Prelude #48
Closed issues:
 radius is wrong #75
Merged pull requests:
typesgeneralized (20130213)
v0.6.0.1 (20130107)
Fixed bugs:

text on zero width rect leads to nans #51

wrong result when using
beside
with circle and vector (1 & (1)) #46 
Handle
rect
with zero arguments. #43
Closed issues:
 Generalization of color space used in rendering #66
Merged pull requests:
v0.6 (20121212)
New features

boundingRect
function for constructing a bounding rectangle 
bg
function for “setting the background color” (i.e. placing atop a colored bounding rectangle) 
New functions
setDefault2DAttributes
andadjustDiaSize2D
.adjustDia2D
does both — so the behavior ofadjustDia2D
has not changed, but it is now possible to apply just one of the two adjustments using the new functions. 
Diagrams.TwoD.Transform
now exports aScaleInv
type for creating scaleinvariant objects, which are only affected by rotational and translational components of transformations. 
The new
Diagrams.Coordinates
module provides nicer syntax for constructing and patternmatching point and vector literals. 
New
fromFixedSeg
function inDiagrams.Segment
, which decomposes aFixedSegment
into a starting point and aSegment
. 
New
withTrace
function for setting theTrace
of a diagram. 
Three new sizerelated functions:

New
sized
function for scaling an object to a particular size. One particularly nice use of this is to obviate the need to keep fiddling with the line width to get diagrams to “look right”; just set the line width relative to some arbitrary scale (e.g. assuming the final diagram will fit into a 1x1 box) and then applysized
to the final diagram to make it that given arbitrary size. It can also be used for easily making something (a diagram, path, trail, …) the same size as something else, with the help of the newsizeSpec2D
function. 
New
sizedAs
function, for setting the size of some object to be “the same as” some other object. 
New
sizeSpec2D
function for conveniently calculating the size of an object as aSizeSpec2D
value (for use with the newsized
funtion).


New
extrudeEnvelope
andintrudeEnvelope
functions for modifying envelopes in a single direction only, as well as new functionsextrude{Left,Right,Bottom,Top}
specializingextrudeEnvelope
to 2D. 
arcCW
draws clockwise arcs;arc'
draws arcs counterclockwise or clockwise as the radius is positive or negative, respectively. 
fill color attribute is generalized to support “recommended” and “committed” colors; text objects use a recommended fill color of black.
New instances

The
Show
instance forR2
now produces something like2 & 6
instead ofR2 { unR2 = (2,6) }
. TheRead
instance has also been changed to match, soread . show = id
. 
Enveloped
instance forFixedSegment

Traced
instances forSegment
,FixedSegment
,Trail
, andPath

New derived
Eq
instances forLineCapA
,LineJoinA
,Dashing
,DashingA
,FillRule
,Font
,FontSize
,FontSlant
,FontSlantA
,FontWeight
, andFontWeightA

Renderable Ellipsoid NullBackend
instance
API changes

Data.Colour
(minusatop
andAffineSpace
) is now reexported from Diagrams.Prelude for convenience. 
The
beneath
function is now infixl 6. 
The
BoundingBox
module has had a complete overhaul. There is now a special empty bounding box, and bounding boxes are an instance ofMonoid
. 
The type of
withEnvelope
has been slightly generalized. 
Diagrams.TwoD.Adjust.adjustSize
is now deprecated; it has been renamed and moved toDiagrams.TwoD.Size.requiredScaleT
. 
expandPath
has been renamed toscalePath
.
Dependency/version changes

Allow
datadefault
0.4 and 0.5 
Allow
base
4.6 
Allow
containers
0.5
Bug fixes
arc
andarcT
functions now always produce counterclockwise arcs, as claimed.
Implemented enhancements:

Enhancements for
arc
s. #54 
align and friends should be in terms of a new ‘Alignable’ class instead of ‘Boundable’ #31

Tools for more accurate boundary calculations in common cases #30

Reimplement Diagrams.TwoD.Ellipse in terms of Diagrams.TwoD.Arc #27

Function to convert angles into 2D unit vectors #23

2D specialization of ‘beside’ which takes an angle instead of a vector #22

Generalize showOrigin function #21

Add generic ‘extent’ and ‘breadth’ ? functions #20

Add shearing transformations to standard library #19

Add support for text #15

Allow the user to choose the fill rule used for paths when stroking #14

Image primitives #10

Merge polygon code from Dmitry Olshansky #4
Fixed bugs:

Enhancements for
arc
s. #54 
boundingBox computes incorrect bounding box for transformed diagrams #39

hcat is really *terrible* performancewise #28

stroke sets the fill rule attribute to a default value, so it can’t be changed later #26

Text alignment should be with respect to descent and ascent lines rather than text bounding box #17

incorrect bounds for Bezier segments #11

More combinators in D.Combinators #5
Merged pull requests:

Renamed
expandPath
toscalePath
to make room #61 (fryguybob) 
Added
Eq
instances for some data structures. #59 (fryguybob) 
More involved diameter benchmark + better implementation #58 (mgsloan)

Update to track with diagramscore renaming, and a better Show instance for R2 #47 (byorgey)

Minor tweaks due to monoidextra and dualtree changes #45 (byorgey)

split out default attribute setting and size adjustment into separate functions #42 (byorgey)

New module enabling nice syntax for constructing and patternmatching literal points and vectors #1 (byorgey)
v0.5.0.1 (20120724)
v0.5 (20120309)
New features

mkSizeSpec
function for constructing aSizeSpec2D
from twoMaybe Double
s 
beneath
as convenient synonym forflip atop

Improvements and extensions to rounded rectangles by Peter Hall:

roundedRect'
allows rounded rectangles with a different radius specified for each corner 
both
roundedRect'
androundedRect
now allow negative radii, resulting in “inverted” circular corners


#64: New
Alignable
class for things that can be aligned. 
explodeTrail
andexplodePath
have been generalized to return anyPathLike
type. 
New path functions
pathCentroid
(compute the centroid of a path’s vertices) andexpandPath
(scale a path about its centroid). 
Generalized
centroid
function now exported from new moduleDiagrams.Points
. 
Initial (experimental) support for animation:

Animation
andQAnimation
defined as synonyms forActive
diagrams (seeactive
package) 
Instances for
Active
:V
,HasOrigin
,Transformable
,HasStyle
,PathLike
,Juxtaposable
,Alignable

animEnvelope
andanimRect
functions for automatic bounding of animations


addClosingSegment
function for making the implicit closing segment of a closed trail explicit 
Improvements to
BoundingBox
module from Michael Sloan: querying ofBoundingBox
bounds, corners, extents, and transformation of objects to fit within a given box. 
Text alignment options from Michael Sloan

view
function for restricting a diagram’s envelope to a rectangular region. 
iterateN
function for iterating a finite number of times 
atAngle
for placing two diagrams next to each other along a specified angle. 
padX
andpadY
functions for padding in the X and Ydirections independently. 
generalized
showOrigin
function from Ian Ross 
#40: add shears to
Diagrams.TwoD.Transform
Performance improvements

Use a balanced folding scheme for
cat'
, reducing time in some cases from \(O(n^2)\) to \(O(n \log n)\) 
More efficient implementation of
beside
New instances

Alignable
instances forQDiagram
,Path
,Envelope
,Active
,Set
,Map
,[]

Renderable
instances forNullBackend
(Trail
,Path
,Segment
,Image
,Text
) 
Instances for
Active
:V
,HasOrigin
,Transformable
,HasStyle
,PathLike
,Juxtaposable
,Alignable
API changes

R2
used to be a synonym for(Double, Double)
but is now abstract. To convert between pairs ofDoubles
andR2
, use the new functionsr2
andunr2
. There are two reasons for this change: 1. to allow for future changes to the implementation ofR2
; 2.(Double, Double)
was an awkward special case getting in the way of useful tuple instances for classes likeHasOrigin
,Enveloped
, and so on. 
circlePath
has been removed; its functionality has been subsumed bycircle
. 
adjustSegment
now takes an extra tolerance option. 
Ellipses are now represented using Bezier approximations rather than a separate special type.

BoundingBox
no longer has aTransformable
instance; the old instance was misleading at best. 
Change semantics of
beside
(hence also()
and(===)
) so the result’s origin is the same as that of the first argument. 
adjustDia2D
now takes aSizeSpec2D
. 
beside
and related functions are now implemented in terms ofjuxtapose
. 
Instead of taking an
R2
,roundedRect
now takes a pair ofDouble
s, to be more consistent withrect
.
Dependency/version changes

Support for GHC 7.4.1:

depend on
colour
>= 2.3.2 
update
base
andarray
upper bounds


bump
vectorspace
upper bound
Bug fixes
 Avoid scale by zero error in
showOrigin
.  Base
adjustDia2D
translation on output size rather than diagram size.
[v0.4.0.1] () (30 October 2011)
 bump
datadefault
dependency to allow version 0.3
v0.4 (23 October 2011)
documentation fixes
New functions and primitives

wedge
shape primitive 
fromDirection
function for converting angles to 2D unit vectors;inverse function
direction
generalized to return any Angle type 
New functions for computing and adjusting segment lengths

scaleUToX
andscaleUToY
for doing uniform scales resulting in a desired width or height. 
circlePath
,reversePath
,decoratePath
New features

Completely new and improved polygon generation API

Cubic splines

Usercontrollable path fill rules
Bug fixes

fix incorrect corner case in arc generation

fix incorrect
reverseTrail
function
v0.3 (18 June 2011)
New features

new customizable
stroke'
function which lets you assign names to path vertices 
circle
andsquare
functions now take a size argument 
function for adjusting 2D diagrams to requested size abstracted from cairo backend

generalize
PathLike
class to include an instance for diagrams, and collapse things likepolygon
/polygonPath
into a single polymorphic function 
basic text support

basic support for external images

very sketchy initial proofofconcept library of 3D primitives. See also diagramspovray package.
Bug fixes
 Issue 32 (
mempty
not behaving correctly within concatenations)
v0.2 (3 June 2011)
New functions and primitives

scaleToX
andscaleToY
for scaling to an absolute width/height 
reverseTrail

new
Angle
class and ability to use radians, degrees, or circle fractions for specifying angles 
rotateAbout
andreflectAbout
transformations based on new conjugation functions 
rect
androundedRect
primitives 
explodeTrail
/Path
for breaking trails and paths into individual segments
New features

opacity attribute

support for path clipping
 New modules
Diagrams.BoundingBox
Fixes and updates
withBounds
now properly uses the new bounds instead of just combining them with the old
v0.1.1 (18 May 2011)

minor documentation fixes

link to new website
v0.1 [17 May 2011]
 initial preview release
* This Change Log was automatically generated by (and then edited by hand) github_changelog_generator