Personal tools

Diagrams/Projects

From HaskellWiki

< Diagrams(Difference between revisions)
Jump to: navigation, search
(reorganize projects page, and fold in GSoC ideas)
(Convert SVG files to diagrams)
(25 intermediate revisions by 4 users not shown)
Line 1: Line 1:
 
==Potential projects==
 
==Potential projects==
   
Looking for something to work on? Try one of these!
+
Looking for something to work on? Try one of these! There are also even more (crazy, potentially impossible) project ideas which can be found on the [https://trello.com/b/pL6YdKgz diagrams Trello board]. If you have any questions or want to discuss a potential project, send an email to the [https://groups.google.com/group/diagrams-discuss mailing list].
   
 
=== Port cool examples to diagrams ===
 
=== Port cool examples to diagrams ===
Line 13: Line 13:
 
* [http://www.joachim-breitner.de/blog/archives/557-A-copying-garbage-collector-animated.html Joachim Breitner's animation of a copying garbage collector]
 
* [http://www.joachim-breitner.de/blog/archives/557-A-copying-garbage-collector-animated.html Joachim Breitner's animation of a copying garbage collector]
 
* [http://www.numbersimulation.com/ Cool animation demonstrating the concept of prime numbers with orbiting segments for each natural]
 
* [http://www.numbersimulation.com/ Cool animation demonstrating the concept of prime numbers with orbiting segments for each natural]
  +
* [http://youtu.be/ug9fhgy9N60 animation of creating a dragon curve fractal by cutting and sliding blocks]
  +
* [http://www.mathcurve.com/fractals/gosper/gosper.shtml Gosper fractal, aka flowsnake]
  +
* [http://beesandbombs.tumblr.com/ Bees and Bombs]
  +
* [https://upload.wikimedia.org/wikipedia/commons/4/4e/Circle_radians.gif Visual explanation of radians]
   
 
=== Include animations in the gallery and user manual ===
 
=== Include animations in the gallery and user manual ===
   
We need some sort of infrastructure for including animations in the gallery and/or user manual. See https://github.com/diagrams/diagrams-doc/issues/1 .
+
We need some sort of infrastdireructure for including animations in the gallery and/or user manual. See https://github.com/diagrams/diagrams-doc/issues/1 .
   
=== GTK application for creating diagrams interactively ===
+
=== Visualization suite for the Haskell ecosystem ===
  +
  +
There are potentially tons of visualizations that could benefit both people learning Haskell and Haskell developers. Examples of things we might be able to visualize include:
  +
  +
* cabal build plans (especially failures)
  +
* APIs and API diffs
  +
* algebraic data types
  +
* memory layout/usage of data structures
  +
* graph reduction/lazy evaluation
  +
* types
  +
* maps, folds, filters, zips, etc.
  +
* zippers
  +
* Functor/Applicative/Monad operations/types
  +
  +
But there are probably lots of other things that make sense too. The idea would be to create some useful standalone tools---potentially even exposed as a web service, to remove the necessity for users to build them---to benefit all Haskell users.
  +
  +
This project of course would require creativity and a good sense of design and data visualization. See [http://www.edwardtufte.com/tufte/books_vdqi Edward Tufte] for inspiration.
  +
  +
=== GUI application for creating diagrams interactively ===
   
 
Having a tight feedback loop between coding and seeing the reflected changes in a diagram is important. Right now some of the backends have a "looped" compilation mode, but it's somewhat clunky and still a lot slower than it could be, probably due to overheads of compilation, linking, etc.
 
Having a tight feedback loop between coding and seeing the reflected changes in a diagram is important. Right now some of the backends have a "looped" compilation mode, but it's somewhat clunky and still a lot slower than it could be, probably due to overheads of compilation, linking, etc.
   
The idea would be to develop a GTK application allowing the user to edit diagrams code (either with an in-application editing pane or in their own editor, perhaps using [http://hackage.haskell.org/package/fsnotify fsnotify] to watch for changes) and see the updated diagram immediately. Additional potential features include:
+
The idea would be to develop a GUI application allowing the user to edit diagrams code (either with an in-application editing pane or in their own editor, perhaps using [http://hackage.haskell.org/package/fsnotify fsnotify] to watch for changes) and see the updated diagram immediately. Additional potential features include:
   
 
* the ability to "zoom in" on a selected subcomponent to display, instead of always displaying everything in the entire file
 
* the ability to "zoom in" on a selected subcomponent to display, instead of always displaying everything in the entire file
Line 28: Line 32:
 
* Interactive editing of diagrams, e.g. dragging a displayed component and having an appropriate translation call automatically added to the code, or some other sort of support for interactively generating points, vectors, scaling factors, etc. using mouse input
 
* Interactive editing of diagrams, e.g. dragging a displayed component and having an appropriate translation call automatically added to the code, or some other sort of support for interactively generating points, vectors, scaling factors, etc. using mouse input
 
* Support for developing animations (e.g. with a slider for moving back+forth in time)
 
* Support for developing animations (e.g. with a slider for moving back+forth in time)
  +
  +
Perhaps this could be built on top of GTK and diagrams-cairo, or for maximal platform independence perhaps it could use something like threepenny-gui and diagrams-sunroof.
   
 
=== Path operations ===
 
=== Path operations ===
Line 36: Line 42:
   
 
For more ideas see http://www.cgal.org/Manual/latest/doc_html/cgal_manual/packages.html.
 
For more ideas see http://www.cgal.org/Manual/latest/doc_html/cgal_manual/packages.html.
 
=== Taking advantage of diagram tree structure ===
 
 
Diagrams are stored using a [http://hackage.haskell.org/package/dual%2Dtree fancy tree data structure], but currently diagrams backends cannot take advantage of this information: diagrams are simply compiled into a list of primitives with attributes, and these are handed off to the backend. This has some important implications:
 
 
* Sometimes it leads to inefficiency. For example, the diagrams code <code>fc blue (hcat $ replicate 1000 (circle 1))</code> results in backends setting the fill color 1000 times (once for each circle), when instead the fill color ought to be set just once.
 
 
* There are additional features which could be implemented if backends were able to observe the tree structure, such as grouping for transparency.
 
 
The project would consist in first figuring out how best to change the backend interface to allow observing the tree structure, and then implementing new features and improvements to backends based on this new ability.
 
 
The devil's in the details: working with the diagram trees can be tricky. This is not a project for the faint of heart, but if you like getting down into tricky details, understanding them, and coming up with creative and elegant ways to achieve a goal given a number of constraints, this could be a fun project with a big impact.
 
   
 
=== Constraint Based Diagrams ===
 
=== Constraint Based Diagrams ===
Line 54: Line 48:
 
along the lines of http://wadler.blogspot.com/2011/06/combinator-library-for-design-of.html . The idea is to allow users to specify constraints on their diagram layout (e.g. "A should be no further left than B", "C and D should be at least 2 and at most 8 units apart"), probably using simple linear inequalities, and then solve them to generate an appropriate layout.
 
along the lines of http://wadler.blogspot.com/2011/06/combinator-library-for-design-of.html . The idea is to allow users to specify constraints on their diagram layout (e.g. "A should be no further left than B", "C and D should be at least 2 and at most 8 units apart"), probably using simple linear inequalities, and then solve them to generate an appropriate layout.
   
A large part of the project would be in simply coming up with a good design for the user API and how to collect constraints; the rest would consist in figuring out how to solve the constraints (either directly, or by hooking up to some other library to e.g. solve systems of linear constraints).
+
A large part of the project would be in simply coming up with a good design for the user API and how to collect constraints; the rest would consist in figuring out how to solve the constraints (either directly, or by hooking up to some other library to e.g. solve systems of linear constraints). See also https://groups.google.com/d/msg/diagrams-discuss/WBbhB4RXnck/ekSJOnHdBw8J .
 
=== 3D diagrams ===
 
 
Diagrams notionally supports arbitrary vector spaces, but no one has yet done the necessary work to make three-dimensional diagrams a reality. This project would have two main components:
 
 
* Add three-dimensional primitives and functions to [https://github.com/diagrams/diagrams-lib diagrams-lib].
 
 
* Work on one (or more) backends that can render 3D diagrams in some way. Options include developing the stub [https://github.com/diagrams/diagrams-povray diagrams-povray] backend, or developing an OpenGL backend.
 
 
A related project is to create projections of 3D objects to 2D for use with the current backends. These can be useful for diagrams that go into documentation and can be thought of as illustrations of 3D objects or simple animations. There are many examples of how to do this, one that I found quite accessible can be found [https://www.khanacademy.org/cs/3d-caffeine-molecule/1547272093 here] (hat tip to Joel Burget on twitter for the link).
 
 
=== Make Plotting As Easy As Doing It in R ===
 
 
From diagram-discuss:
 
 
The above code produces four plots: a scatterplot (something you would
 
often see in statistics), a plot of a function and, well, two empty
 
grids. As a statistician, I usually work a lot with R together with a
 
more or less sophisticated plotting package. The currently best
 
plotting system for R is probably [http://had.co.nz/ggplot2/ ggplot ]. Now, I started using
 
Bryan O'Sullivan's [http://hackage.haskell.org/package/statistics/ statistics package] for some of my calculations.
 
Once in Haskell mode, you obviously don't want to switch back and
 
forth between languages. So, I was wondering if it is possible to
 
produce professional looking plots with diagrams' DSL, and how
 
difficult it could be to put together a DSL for (statistical)
 
plotting.
 
 
I was thinking of something similar to ggplot's functionality. Making
 
it easy to overlay plots, producing and combining legends, etc.
 
Creating scatterplots and histograms and boxplots. Overlaying them
 
with error regions and density estimates respectively. Then do the
 
same for different subsets of the original data. Doing this with
 
diagrams DSL could proof to be extremely powerful. Each "dot" in a
 
plot could potentially be any diagram you want, dots, circles, stars,
 
numbers or characters -- and if plots are nothing but diagrams, you
 
could even plot plots into a plot. A real pain for most plotting
 
systems is to combine multiple plots into one and to generate a common
 
legend for all of them. This, for example, should be trivial to do
 
within diagrams DSL.
 
   
I would be more than happy to help in such a project. As the code
+
=== Search for Interesting Diagrams ===
above probably suggests, I am not the strongest Haskell hacker around.
 
In fact, I am a statistician/mathematician who happens to use Haskell
 
for some of his projects. That's it. Would anyone be interested in
 
picking up such a project? As I said, I would be happy to help and
 
get involved. Because I think there is a real need for something like
 
this, and it would be very powerful to have eDSL for statistical
 
plotting within Haskell.
 
   
There seems to some interest in this idea:
+
Inspired by QuickCheck and SmallCheck, the idea is to probe some function that produces a diagram to explore the range of diagrams it can produce. Instead of looking for failures it would be looking for differences (visually, in path complexity, time, space, etc.). Such a tool could be useful for generating galleries displaying the capabilities of some diagram generating function or debugging some function to find inputs that do not produce output in the expected visual range.
https://groups.google.com/d/topic/diagrams-discuss/TR9_Q8YnhMo/discussion
 
 
'''Interested Students:'''
 
 
* Jan Bracker
 
   
 
=== External Rendering ===
 
=== External Rendering ===
Line 75: Line 69:
 
the smallest for any particular number.
 
the smallest for any particular number.
   
This could be aided by generalized R2.
+
This could be aided by [https://github.com/diagrams/diagrams-lib/issues/50#issuecomment-23940308 generalized R2].
 
=== Diagrams Paste Site ===
 
 
Create a pastebin site where diagrams code is automatically compiled and the output shown alongside the code. This would be cool for sharing experiments, teaching beginners, helping out people having problems, and so on.
 
 
Potential sources of inspiration/libraries to use/code to steal:
 
 
* [http://hpaste.org hpaste] ([https://github.com/chrisdone/hpaste git source])
 
* [http://diagrams.alpmestan.com diagrams.alpmestan.com] ([http://hub.darcs.net/alp/factorization-diagrams-happstack darcs source])
 
* [http://hackage.haskell.org/package/diagrams%2Dbuilder diagrams-builder] ([http://github.com/diagrams/diagrams-builder git source])
 
* [http://hackage.haskell.org/package/mueval mueval] ([http://code.haskell.org/mubot/ darcs source])
 
 
'''Interested Students:'''
 
 
* Dan Frumin
 
   
 
=== Auto-generated "simple" prelude ===
 
=== Auto-generated "simple" prelude ===
Line 98: Line 92:
   
 
Add extra intensional information to help do a better job with combining envelopes? e.g. inner and outer bounding boxes, circles, etc. e.g. if the outer bound of one lies completely inside the inner bound of another, the resulting combined envelope can be optimized to not actually do a max operation.
 
Add extra intensional information to help do a better job with combining envelopes? e.g. inner and outer bounding boxes, circles, etc. e.g. if the outer bound of one lies completely inside the inner bound of another, the resulting combined envelope can be optimized to not actually do a max operation.
  +
  +
=== Convert SVG files to diagrams ===
  +
  +
It's impossible to support all the features of SVGs, but for a nontrivial subset of SVG it should be possible to parse an SVG file and convert it into a Path and/or a Diagram. This would be a really cool way to allow importing components more easily generated with some other tool---for example, use something like Inkscape to create some paths (using some of Inkscape's advanced tools, drawing them freehand, or whatever), export as SVG, then import those paths into a diagram and use/process them further. Note: This is possible now (although not finished). See https://github.com/diagrams/svg-diagrams
  +
  +
=== Auto-generate "connect the dots" puzzles ===
  +
  +
You know those "connect-the-dots" activities for kids? It would be fun to take (say) an SVG as input (this depends on the previous project) and output a "connect-the-dots" version. Fun for the whole family.
  +
  +
=== DSL for identifying subdiagrams ===
  +
  +
It would be extremely useful if subdiagrams could be identified using a small combinator DSL. For example, <hask>isLine `which` (connects isTriangle isTriangle)</hask> to return the line in a diagram connecting two triangles. Or <hask>smallest `which` isCircle</hask> the get the smallest circle. Then we would not always need to name subdiagrams and we would gain the ability to modify diagrams and subdiagrams after they have been created. Things like <hask>(isSquare `which` hasEdge 2) # lw 0.2 # fc red</hask>, and perhaps even, <hask>delete $ isPoly `which` (numSides 5)</hask> become possible. The idea would be to start with something very simple that we could add to incrementally.
  +
  +
=== Port potrace to Haskell ===
  +
  +
See http://potrace.sourceforge.net/ and in particular http://potrace.sourceforge.net/potrace.pdf .
  +
  +
=== General curved surfaces in 3D ===
  +
  +
We have some basic 3D support in the POV-Ray backend, limited to primitives such as boxes, spheres, and cones. It would be good to have a more general, flexible representation of solids, comparable to the flexibility of Cubic Bezier curves in 2D. Examples of suitable representations include bicubic patches, NURBs, and various implicit surface descriptions. The first step is choosing which representation to implement.
  +
  +
A minimal implementation would be able to calculate Envelope and Trace for the new primitives, and to render in at least one Backend (POV-Ray or OpenGL). More interesting methods of constructing surfaces, including CSG, extrusion, and revolution, can follow.
   
 
==Officially supported backends==
 
==Officially supported backends==
Line 138: Line 154:
   
 
== Unofficial backends ==
 
== Unofficial backends ==
  +
  +
=== PDF ===
  +
  +
* [http://hackage.haskell.org/package/diagrams-pdf Hackage]
  +
* [https://github.com/alpheccar/diagrams-pdf github repo]
  +
* Status: active
  +
* Participants: Christophe F
  +
  +
=== GHCJS/canvas ===
  +
  +
* [https://github.com/ghcjs/diagrams-ghcjs github repo]
  +
* Status: active development
  +
* Participants: Daniil Frumin, Luite Stegeman
  +
  +
=== OpenGL ===
  +
  +
* [https://github.com/bergey/diagrams-opengl github repo]
  +
* Status: active development
  +
* Participants: Daniel Bergey
   
 
=== HTML5 canvas ===
 
=== HTML5 canvas ===
   
* [https://github.com/ku-fpg/diagrams-canvas github repo]
+
* [https://github.com/jbracker/diagrams-sunroof github repo]
* [https://github.com/byorgey/diagrams-canvas variant ported to work with blank-canvas]
 
 
* Status: dormant
 
* Status: dormant
* Participants: Andy Gill, Brent Yorgey
+
* Participants: Jan Bracker, Andy Gill, Brent Yorgey
   
 
=== LaTeX/TikZ ===
 
=== LaTeX/TikZ ===
Line 149: Line 184:
 
* original [http://patch-tag.com/r/snwalck/diagrams-tikz darcs repo] by Scott Walck
 
* original [http://patch-tag.com/r/snwalck/diagrams-tikz darcs repo] by Scott Walck
 
* [https://github.com/mahrz/diagrams-tikz updated version] by Malte Harder on github
 
* [https://github.com/mahrz/diagrams-tikz updated version] by Malte Harder on github
  +
* Yet another version is [http://hackage.haskell.org/package/diagrams%2Dtikz on Hackage]
 
* Status: dormant
 
* Status: dormant
 
* Participants: Scott Walck, Malte Harder
 
* Participants: Scott Walck, Malte Harder
Line 157: Line 193:
   
 
* [http://github.com/diagrams/diagrams-povray github repo]
 
* [http://github.com/diagrams/diagrams-povray github repo]
* Status: proof of concept only, needs someone to take it over!
+
* Status: Alpha, active development
+
* Participants: Daniel Bergey
=== Wanted backends ===
 
 
* OpenGL
 
   
 
== Related packages and tools ==
 
== Related packages and tools ==
Line 169: Line 205:
   
 
* [http://patch-tag.com/r/fryguybob/diagrams-hint diagrams-hint]
 
* [http://patch-tag.com/r/fryguybob/diagrams-hint diagrams-hint]
  +
  +
=== Writing ===
  +
  +
* [http://hackage.haskell.org/package/diagrams%2Dhaddock diagrams-haddock] is a tool for embedding diagrams in Haddock documentation.
  +
* [http://hackage.haskell.org/package/BlogLiterately%2Ddiagrams BlogLiterately-diagrams] is a tool for embedding diagrams in blog posts.
   
 
=== Build service ===
 
=== Build service ===
Line 195: Line 236:
   
 
* [http://hackage.haskell.org/package/hierarchical-clustering-diagrams hierarchical-clustering-diagrams]
 
* [http://hackage.haskell.org/package/hierarchical-clustering-diagrams hierarchical-clustering-diagrams]
  +
* [http://hackage.haskell.org/package/Chart-diagrams Chart-diagrams]
  +
* [http://hackage.haskell.org/package/BlogLiterately-diagrams BlogLiterately-diagrams]
  +
* [http://hackage.haskell.org/package/diagrams-qrcode diagrams-qrcode]

Revision as of 15:51, 15 May 2014

Contents

1 Potential projects

Looking for something to work on? Try one of these! There are also even more (crazy, potentially impossible) project ideas which can be found on the diagrams Trello board. If you have any questions or want to discuss a potential project, send an email to the mailing list.

1.1 Port cool examples to diagrams

There is actually quite a lot of value in taking some existing cool graphics or animations and reimplementing them using diagrams, both as a way to obtain some cool examples for the gallery, and to help drive new features in diagrams or active. (So examples that we would like to be able to describe in diagrams but cannot easily do are particularly interesting---what feature(s) would need to be added to make them possible?)

Some possible sources of inspiration:

1.2 Include animations in the gallery and user manual

We need some sort of infrastdireructure for including animations in the gallery and/or user manual. See https://github.com/diagrams/diagrams-doc/issues/1 .

1.3 Visualization suite for the Haskell ecosystem

There are potentially tons of visualizations that could benefit both people learning Haskell and Haskell developers. Examples of things we might be able to visualize include:

  • cabal build plans (especially failures)
  • APIs and API diffs
  • algebraic data types
  • memory layout/usage of data structures
  • graph reduction/lazy evaluation
  • types
  • maps, folds, filters, zips, etc.
  • zippers
  • Functor/Applicative/Monad operations/types

But there are probably lots of other things that make sense too. The idea would be to create some useful standalone tools---potentially even exposed as a web service, to remove the necessity for users to build them---to benefit all Haskell users.

This project of course would require creativity and a good sense of design and data visualization. See Edward Tufte for inspiration.

1.4 GUI application for creating diagrams interactively

Having a tight feedback loop between coding and seeing the reflected changes in a diagram is important. Right now some of the backends have a "looped" compilation mode, but it's somewhat clunky and still a lot slower than it could be, probably due to overheads of compilation, linking, etc.

The idea would be to develop a GUI application allowing the user to edit diagrams code (either with an in-application editing pane or in their own editor, perhaps using fsnotify to watch for changes) and see the updated diagram immediately. Additional potential features include:

  • the ability to "zoom in" on a selected subcomponent to display, instead of always displaying everything in the entire file
  • using sliders, input boxes, etc. to interactively display parameterized diagrams, perhaps in a type-directed way (see craftwerk-gtk for inspiration)
  • Interactive editing of diagrams, e.g. dragging a displayed component and having an appropriate translation call automatically added to the code, or some other sort of support for interactively generating points, vectors, scaling factors, etc. using mouse input
  • Support for developing animations (e.g. with a slider for moving back+forth in time)

Perhaps this could be built on top of GTK and diagrams-cairo, or for maximal platform independence perhaps it could use something like threepenny-gui and diagrams-sunroof.

1.5 Path operations

It would be nice if diagrams could support various operations on paths such as intersection and union, curve fitting, and path simplification. See also Diagrams/Dev/Paths, which has quite a bit of information on current efforts to implement path offsets and other path-related things.

A student taking this on would probably already need some experience in computational geometry and paths in particular; implementing path algorithms properly is notoriously tricky (though having an incomplete and buggy implementation that nonetheless works "most of the time" would still be better than nothing!).

For more ideas see http://www.cgal.org/Manual/latest/doc_html/cgal_manual/packages.html.

1.6 Constraint Based Diagrams

Generate diagrams that meet some declarative constraint specification---perhaps something along the lines of http://wadler.blogspot.com/2011/06/combinator-library-for-design-of.html . The idea is to allow users to specify constraints on their diagram layout (e.g. "A should be no further left than B", "C and D should be at least 2 and at most 8 units apart"), probably using simple linear inequalities, and then solve them to generate an appropriate layout.

A large part of the project would be in simply coming up with a good design for the user API and how to collect constraints; the rest would consist in figuring out how to solve the constraints (either directly, or by hooking up to some other library to e.g. solve systems of linear constraints). See also https://groups.google.com/d/msg/diagrams-discuss/WBbhB4RXnck/ekSJOnHdBw8J .

1.7 Search for Interesting Diagrams

Inspired by QuickCheck and SmallCheck, the idea is to probe some function that produces a diagram to explore the range of diagrams it can produce. Instead of looking for failures it would be looking for differences (visually, in path complexity, time, space, etc.). Such a tool could be useful for generating galleries displaying the capabilities of some diagram generating function or debugging some function to find inputs that do not produce output in the expected visual range.

1.8 External Rendering

The idea here would be to allow for special external rendering of some primitive that Diagrams does not support. For instance, it would be nice to be able to express LaTeX expressions and when the backend renders, offload the work externally then incorporate it with the output. There are several dimensions to supporting this well and making it as backend agnostic as possible. Somewhat related is the idea of external layout such as asking GraphViz to layout some structure then doing the rendering based on those positions. At the simplest this is just turning some new primitive into an `Image` primitive on the fly in the `Renderable` instance.

1.9 Variable Precision

It would be nice to be able to trade off precision of the vector output of some backend with the size of that output. For instance the factorization diagrams are rather large when rendered to SVG, but their size could be cut in half by emitting doubles formatted to two significant digits. There is a nice balance that could be struck at a high level where we ensure that we are always within some fraction of what will likely be a pixel in the final output. Then at the level of the backend we would only need to choose the representation that is the smallest for any particular number.

This could be aided by generalized R2.

1.10 Auto-generated "simple" prelude

The diagrams library is extremely polymorphic---much too polymorphic for beginning users, perhaps. The goal of this project would be to write some code to automatically generate a module Diagrams.Prelude.Simple which re-exports things from Diagrams.Prelude but with more monomorphic types. This would require obtaining the types of things exported by Diagrams.Prelude, doing some analysis to determine what "simpler" type to use, then outputting the appropriate code. There are some interesting, nontrivial questions to be worked out in terms of how to generate a "simple" type from a more general one. There may even be room for multiple "levels" with successively more polymorphism.

1.11 Contrib module for graph drawing

We have a contrib module for drawing trees; it would be nice to have something for drawing more general graphs. One idea would be to round-trip graph data through Graphviz to do the layout; then it is just a matter of allowing the user to describe how they want their graph styled and visualized.

1.12 Do a better job combining envelopes

Add extra intensional information to help do a better job with combining envelopes? e.g. inner and outer bounding boxes, circles, etc. e.g. if the outer bound of one lies completely inside the inner bound of another, the resulting combined envelope can be optimized to not actually do a max operation.

1.13 Convert SVG files to diagrams

It's impossible to support all the features of SVGs, but for a nontrivial subset of SVG it should be possible to parse an SVG file and convert it into a Path and/or a Diagram. This would be a really cool way to allow importing components more easily generated with some other tool---for example, use something like Inkscape to create some paths (using some of Inkscape's advanced tools, drawing them freehand, or whatever), export as SVG, then import those paths into a diagram and use/process them further. Note: This is possible now (although not finished). See https://github.com/diagrams/svg-diagrams

1.14 Auto-generate "connect the dots" puzzles

You know those "connect-the-dots" activities for kids? It would be fun to take (say) an SVG as input (this depends on the previous project) and output a "connect-the-dots" version. Fun for the whole family.

1.15 DSL for identifying subdiagrams

It would be extremely useful if subdiagrams could be identified using a small combinator DSL. For example,
isLine `which` (connects isTriangle isTriangle)
to return the line in a diagram connecting two triangles. Or
smallest `which` isCircle
the get the smallest circle. Then we would not always need to name subdiagrams and we would gain the ability to modify diagrams and subdiagrams after they have been created. Things like
(isSquare `which` hasEdge 2) # lw 0.2 # fc red
, and perhaps even,
delete $ isPoly `which` (numSides 5)
become possible. The idea would be to start with something very simple that we could add to incrementally.

1.16 Port potrace to Haskell

See http://potrace.sourceforge.net/ and in particular http://potrace.sourceforge.net/potrace.pdf .

1.17 General curved surfaces in 3D

We have some basic 3D support in the POV-Ray backend, limited to primitives such as boxes, spheres, and cones. It would be good to have a more general, flexible representation of solids, comparable to the flexibility of Cubic Bezier curves in 2D. Examples of suitable representations include bicubic patches, NURBs, and various implicit surface descriptions. The first step is choosing which representation to implement.

A minimal implementation would be able to calculate Envelope and Trace for the new primitives, and to render in at least one Backend (POV-Ray or OpenGL). More interesting methods of constructing surfaces, including CSG, extrusion, and revolution, can follow.

2 Officially supported backends

2.1 Native SVG

A Haskell-native backend generating SVG. As of diagrams-0.6 this is the default "out-of-the-box" diagrams backend.

  • hackage
  • github repo
  • Status: active development
  • Participants: Deepak Jois, Ryan Yates, Felipe Lessa, Brent Yorgey

2.2 Cairo

Full-featured backend using cairo.

2.3 GTK

Backend built on top of the cairo backend for rendering directly to GTK windows.

2.4 Native Postscript

Very similar to the Cairo backend but only outputting EPS.

3 Unofficial backends

3.1 PDF

3.2 GHCJS/canvas

  • github repo
  • Status: active development
  • Participants: Daniil Frumin, Luite Stegeman

3.3 OpenGL

  • github repo
  • Status: active development
  • Participants: Daniel Bergey

3.4 HTML5 canvas

  • github repo
  • Status: dormant
  • Participants: Jan Bracker, Andy Gill, Brent Yorgey

3.5 LaTeX/TikZ

3.6 POV-Ray

A POV-Ray backend for 3D diagrams.

  • github repo
  • Status: Alpha, active development
  • Participants: Daniel Bergey

4 Related packages and tools

4.1 command-line/interactive

See also an earlier project in a similar direction:

4.2 Writing

4.3 Build service

diagrams-builder is a library providing the ability to dynamically interpret diagrams code snippets, including utilities for creating temporary files etc. as needed. Useful for making preprocessing tools for embedding diagrams code in other document formats (e.g. LaTeX).

4.4 Fonts

The SVGFonts package implements Haskell-native font support (for fonts in the SVG-font format) that can be plugged into diagrams.

5 Other projects

5.1 gtk-toy

Michael Sloan's gtk-toy project is a framework for creating interactive gtk/cairo applications. gtk-toy-diagrams provides tools for using diagrams in conjunction with gtk-toy.

5.2 LaTeXgrapher

LaTeXGrapher is a project by Ryan Yates providing a domain-specific language for producing mathematical graphs, backed by the diagrams-postscript backend.

Deepak Jois is working on a logo interpreter written in Haskell, using diagrams as a backend.

6 Packages using diagrams