Personal tools

Diagrams/Dev/Migrate0.6

From HaskellWiki

< Diagrams | Dev
Revision as of 01:11, 22 October 2012 by Byorgey (Talk | contribs)

Jump to: navigation, search

This page describes breaking API changes between diagrams 0.5 and 0.6, along with explanations of how to migrate to the new 0.6 API.

Contents

1 Reorganizations to diagrams-core

  • The modules in diagrams-core have all been renamed to be more consistent with the module naming scheme in the rest of the diagrams universe. For most users this should make no different, unless you are affected by diagrams-core#17 and have explicitly imported Graphics.Rendering.Diagrams.Points. In particular:
    • Graphics.Rendering.Diagrams --> Diagrams.Core
    • Grahpics.Rendering.Diagrams.Core --> Diagrams.Core.Types
    • Graphics.Rendering.Diagrams.* --> Diagrams.Core.*

2 Subdiagrams

TODO: write me

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).

3 Other diagrams-core API changes

TODO: write me

   - '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.
   - '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.


4 StyleParam deleted from Diagrams.Backend.Cairo.Text

The StyleParam type has been removed from Diagrams.Backend.Cairo.Text. Functions that used to take a StyleParam argument now take a Style R2 parameter, determining the style to apply to the text before rendering/querying information about the text. These parameters can be created a variety of ways, but the most direct will likely be by applying style-transforming functions such as font, fontSize, fontSlant, and fontWeight to mempty. This works because there are instances of HasStyle and Monoid for Style v.