Sunday, October 31, 2010

wumpus-basic

Copperbox revision 1837.

I'm reworking the Graphic.Base types so that the functionals are "inside" the DrawingR newtype.

Previously I had:

> type LocGraphic u = Point2 u -> DrawingR (PrimGraphic u)

Now I have

> type LocGraphic u = DrawingR (Point2 u -> PrimGraphic u)

I'm hypothesizing that this change will generally make the code more uniform, however it is only a hypothesis. As far as I can tell, Conal Elliott's Vertigo used this second form (though it avoided wrapping functionals with newtypes).

Quite a lot of code is currently broken and there is quite a lot of old code in Graphic.Base that will need removing when I have everything working again.

Friday, October 29, 2010

wumpus-basic

Copperbox revision 1836.

I've added a new type provisionally called VecGraphic to Basic.Graphic.Base.

VecGraphic models graphics that take an initial point and return a new end point as well as drawing themselves. This is how text works in PostScript - drawing text takes the implicit current point (usually initialized with moveto) draws the text and adds the width vector of the text to the current point.

Unfortunately for Wumpus whilst this is a useful graphic type, Basic.Graphic.Base is becoming very ad-hoc with lots of similar but special purpose types. It would be nice if they were unified somewhat.

Thursday, October 28, 2010

wumpus-fontkit

Copperbox revision 1835.

Initial work on a demo to print tables for the "Core 14" PostScript fonts.

A note to self - Wumpus-Basic provides almost no help in generating tables except for the chains which still remain primitive. This area really needs improving, considerably.

Wednesday, October 27, 2010

wumpus

Copperbox revision 1833.

Updated the parser and data types to use AfmUnit, an new type added to Wumpus-Core.


Copperbox revision 1834.

Added a new type AfmUnit to the PtSise module. AfmUnit represents the measurement units in AFM files.

wumpus-fontkit

Copperbox revision 1832

More work on the parser it now extracts character metrics, which is its purpose.

Note - Subversion said this commit failed, but it seems to have reached the server and been accepted.

Tuesday, October 26, 2010

wumpus

Copperbox revisions 1830 & 1831.

I've deleted wumpus-fresh (revision 1830) and wumpus-shapes (revision 1831).

Wumpus-fresh was rolled into Wumpus-core quite a while ago. Wumpus-shapes has been incorporated into Wumpus-basic.

wumpus-fontkit

Copperbox revisions 1828 and 1829.

Toy-Font-Metrics is now called Wumpus-Fontkit.

The parser in Toy-Font-Metrics was looking quite flaky due to AFM files being very liberal and allowing user defined fields. So, instead of trying to make a general parser with a general syntax tree, I'm now making one just good enough for Wumpus and I've moved the code in with the Wumpus packages.

toy-font-metrics

Copperbox revision 1827.

More work on the parser...

I've specialized the current parser to only work for v2.0 AFM format files. This is the format used by GhostScript. A one size fits all parser will be quite tricky - there are quite big differences between v2.0 and v3.0, and more differences again to v4.1 which appears to be the current revision. In fact the current parser is severely limited as AFM files can have user defined fields, so I think I'll have to make a much laxer parser that puts name-value pairs into a finite map rather than builds a syntax tree.

toy-font-metrics

Copperbox revision 1826.

More work on the parser. Some information can now be extracted from AFM files - AFM version number and the font names.

Monday, October 25, 2010

toy-font-metrics

Copperbox revision 1825.

I've added decent white-space handling courtesy of cut down versions of Parsec's LanguageDef and TokenParser modules / datatypes. Credit and thanks to Daan Leijen - Parsec is a truly exceptional library particularly in the details like the tokenizer / white-space handling and the expression table parser. Its a pity that white-space isn't configurable in the LanguageDef so I could make line oriented parsers (whiteSpace chomps newlines).

toy-font-metrics

Copperbox revision 1824.

Work on the parser combinators...

Because the format of AFM files is simple and I don't want a dependency on Parsec (and have to choose 2.1 or 3.0) TFM now has its own hand-crafted parser combinators.

Sunday, October 24, 2010

toy-font-metrics

Copperbox revision 1823.

I've started a new project to extract metrics from AFM files. These are the font metrics files that accompany PostScript (Type 1) fonts and are used by still used by GhostScript. All code is very preliminary, little more than stub modules.

Wumpus really needs better font handling, so I've decided to start with AFM files - even though they are rather antiquated, they are a lot simpler than TrueType fonts. At some point Wumpus-Basic will incorporate the work in toy-font-metrics, Wumpus-Core just renders what it is given so it can remain in happy ignorance of font metrics.

wumpus-basic

Copperbox revision 1822.

More work on the Plaintext shape. Multi-line text now seems to work properly under rotation.

Saturday, October 23, 2010

wumpus-basic

Copperbox revision 1821.

Preliminary work implementing multi-line support. Rotation does not work properly for this revision so it will have to be substantially revised, however it merits check-pointing.

A previous version of  Wumpus-Basic had multi-line support but that was too complicated as it tried to simulate right and center alignment. Still there should be code in that revision to fix the problems in this one.

wumpus-basic

Copperbox revision 1820.

I've added margins to Plaintext. This allows visually better anchor positions. 

Friday, October 22, 2010

wumpus-basic

Copperbox revision 1819.

First work updating Plaintext so that it is more like the current shape types. More work needs to be done to accommodate multi-line text.

Thursday, October 21, 2010

wumpus-basic

Copperbox revision 1818.

I've reworked the Coordinate object into a form I think I'm happy with. It now seems operationally close enough to the Shape types (and different to the marks) to make it useful.

wumpus-basic

Copperbox revision 1817.

Initial work on a feature model example. Unfortunately I'm not sure how to do the good bits yet - i.e. decorate groups of connectors with arcs for alternative and or and add repetition labels.

wumpus - new releases

Copperbox revision 1815.

Updates to get Wumpus-Microprint and Wumpus-Tree working with the current Wumpus-Basic.

Copperbox revision 1816.

New release archives for Hackage:
wumpus-basic-0.12.0
wumpus-microprint-0.11.0
wumpus-tree-0.10.0

wumpus-basic

Copperbox revision 1814.

I've implemented radial anchors for diamond.

Wednesday, October 20, 2010

wumpus-basic

Copperbox revision 1813.

I've reworked the internals of the Shape modules as a prelude to adding more shapes. How shapes work with the ShapeCTM has been made more uniform.

wumpus-basic

Copperbox revision 1812.

I've added two new curved arrowheads. The new curved arrowhead draws particularly nicely. The other one is its reverse, which was easy to implement but is less obviously nice.

wumpus-basic

Copperbox revision 1811.

I've moved the control point manufacturing functions out from Paths.Connectors into their own module Paths.ControlPoints so they can be reused elsewhere. Doing so also revealed quite a bit of code duplication in Paths.Connectors.

Tuesday, October 19, 2010

wumpus-basic

Copperbox revision 1810.

More work on connector paths, including a new example which should have been added in the last commit.

wumpus-basic

Copperbox revision 1809.

More arrowheads including reverse triangles and barbs and disks, squares and diamonds.
Also I've started making the Path connectors more systematic.

Monday, October 18, 2010

wumpus-basic

Copperbox revision 1808.

I've made the arrow connector drawing function straight-forwardly monadic again.

Previous I had some rather exotic types for transformations roughly: m (a -> a) but now I'm using simpler types along the lines of m a -> m a.

The new code is perhaps a bit uglier as it uses bind directly, but at least it is now comprehensible.

wumpus-basic

Copperbox revision 1807.

Some preliminary work on re-doing Shapes.

Shapes constructors are now functions from Point -> Shape, so this makes the API more consistent with the rest of Wumpus-Basic. It also means that shapes will have to be made instances of the Affine classes which will add some boiler plate.

wumpus-basic

Copperbox revision 1806.

Work tidying arrowheads. I've removed the DirectionContext reader monad - as the clarity of the arrowhead code has improved generally, DirectionContext was no longer adding anything and the fully pointed code that replaces its use-sites looks better.

Sunday, October 17, 2010

wumpus-basic

Copperbox revision 1805.

More work on arrowheads - I've made a new demo drawing to print all the tip styles and corrected some bugs in a couple of code paths that previously hadn't been exercised.

wumpus-basic

Copperbox revision 1804.

Work re-doing marks with the bindR combinator and its variants bindAsk and bindInto. The work seems promising but I'll have to look at other graphics elements such as Shapes before I can say whether or not it is a success.

Saturday, October 16, 2010

wumpus-basic

Copperbox revision 1803.

Some preliminary re-working of AnchorDots and Marks. I've moved and renamed the file Basic.Dots to Basic.Dots.AnchorDots and renamed the file Basic.Dots.Primitive to Basic.Dots.Marks. Marks are dots without anchors, AnchorDots are obviously dots with anchors.

I'm getting more of an idea about what I'm actually doing. As I'm trying to reduce the use of monadic operations in the code, I'm finding that a lot of the operations I'm replacing them with are similar to the regular applicative and monadic composition functions but they have more "static arguments". For the function instance Monad and Applicative work on a single "static argument" - synonymous to the Reader monad. I'm often working with two or more static arguments - the drawing context occupies the first so Applicative and Monad work directly here, but when I have LocGraphics there are two static arguments the drawing context and the start point. Similarly ThetaLocGraphic has three static arguments - the drawing context, the start point and the angle of displacement that the arrow head or whatever is drawn at.

Friday, October 15, 2010

wumpus-basic

Copperbox revision 1802.

I've reworked Arrowheads so they are now newtype wrapped ThetaLocGraphics - functions from Angle -> Point -> Graphic.

The arrow code seems quite pleasant now, though I'm still largely stumped for ideas on how to improve shapes...

wumpus-basic

Copperbox revision 1801.

The previous revision didn't retract the tip of the line underneath the arrowhead. Not doing so spoils the vee of the triangular arrowheads. This revision fixes the problem and tidies up the code.

wumpus-basic

Copperbox revision 1800.

Work on composing operations on the Image and Graphic types.

The code is very sketchy and I'm not quite sure what I've done, or how it works yet. I seem to have got normal functional application "back" by wrapping applicative functors in special applyTransformer functions. The new version of strokeConnector - the arrow building function is much less convoluted (and it can be simplified even more), but the machinery to make it is quite weird - lots of applicative operations and pairing functions.

Thursday, October 14, 2010

wumpus-basic

Copperbox revision 1799.

Changes to the types in Basic.Graphic.Base. As Wumpus-Core now supports grouping Primitives, Wumpus-Basic doesn't have to rely on using Hughes lists to manufacture multi-primitive Graphics, though it still uses Hughes lists for the Writer-like Trace monad.

Wednesday, October 13, 2010

new release - wumpus-core-0.36.0

Copperbox revision 1798.

I've updated the user guide and made a new release archive for Hackage:

wumpus-core-0.36.0

wumpus-core

Copperbox revision 1797.

A round of Haddock comments. I've covered all the exposed modules except the Text Encoder modules.

wumpus-core

Copperbox revision 1796.

I've updated the user guide to account for the changes to transformations on Primitives and the removal of PrimElement.

wumpus-core

Copperbox revision 1795.

I've updated all the demos to refer to Primitive rather than PrimElement and to use the transform classes rather than the removed functions - rotatePrim, scalePrim etc.

Tuesday, October 12, 2010

wumpus-core

Copperbox revision 1794.

Major change.

I've removed the PrimElement data type making the syntax tree shallower and more efficient. The grouping constructor that PrimElement provided is now added to Primitive as PGroup. Its a shame I added PrimElement in the first place, but my thinking was clouded by not wanting to make Primitive a tree (and thus not really living up to its name). Adding PrimElement caused an inefficiency even when SVG hyperlinks weren't used - so its removal is beneficial.

I haven't changed all the examples yet and there are code comments and the user revise, but the few examples tested so far work and the changes were surprisingly trivial.

wumpus-core

Copperbox revision 1793.

I've added some more examples that test whether primitives transform correctly - it looks as though the do, so its a pity I wasted so much thought confusing myself over whether primitives can transform or not.

wumpus-core

Copperbox revision 1792.

More work on transforming primitives - I've now added instances of the Affine classes for Primitives again.

Previously I saw this as controversial and removed the instances, however now I'm happy that if the code actually works (not properly tested yet), then having instances of these classes is valid, modulo the caveat that the stroke width of lines won't be scaled and possibly other minor distinctions.

wumpus-core

Copperbox revision 1791.

Initial work on changing the transformations on Primitives.

Previously primitives had rather "special" interpretations of transformation - rotations on ellipses or text labels were about their respective origins (center for ellipse, baseline-left for text). There was reasoning behind this Primitives weren't considered to be in an Affine space and it was important to have angled text - say if you want to create a graph where the baseline are all angled at 45deg you would want to rotate all labels individually about their center. However, now that I've written more code this has begun to seem naive, a better strategy is to have constructors for angled versions of ellipses and text labels and make rotation follow the standard affine interpretation.

In this revision, I've put in the new constructors for angled labels and ellipses and have changed the rotation behaviour of primitives, these changes are easy - most of the work is going to be creating examples to show that the new behaviour works as intended.

Monday, October 11, 2010

wumpus-core

Copperbox revision 1788?

The latest commit "failed" on transmission but seems to have shown up anyway but the new file Core.GraphicProps seems in limbo, so I'm a bit stumped...

Copperbox revision 1789.

I've committed a trivial change to another file which has worked...

Copperbox revision 1790.

I decided to check out a new copy of Copperbox to start afresh. This commit just changed some of white space to make sure Core.GraphicProps is in the repository and can be modified - it is in the repository and it can be modified!

wumpus-core

Copperbox revisions 1787 and 1786.

I've removed the dependency on the algebra package (for the Semigroup class, providing append). BoundingBox exports the equivalent function boundaryUnion.

wumpus-core

Copperbox revision 1784.

I've moved the utility modules into their own directory. Ideally I'd like to move more modules out of the Wumpus.Core top-level - there are still 22 modules here - but this would mean modules further down in the hierarchy would have to depend on ones higher up. There is some scope for moving the Text Encoder modules into their own directory as they have no dependencies on the Graphic types.

Update! - Copperbox revision 1785.

I've moved the Text modules into their own directory. There are now 17 modules in the top level directory which is more manageable.

wumpus-core

Copperbox revision 1781.

I've made PrimCTM its own module. This is a prelude before I start on reworking transformations on Primitives.

Update! - Copperbox revisions 1782 and 1783.

I've changed the name of PrimCTM.hs to TrafoInternal.hs and added the AffineTrans data type to it.

new release: wumpus-basic

Copperbox revision 1780.

I've reverted the changes to Shapes.Plain and made a new release of just wumpus-basic - revision 0.11.0.

I think I'll have to rework the transformations on primitives in Wumpus-Core before I can improve Shapes in Wumpus-Basic, so as a lot has changed in Wumpus-Basic since version 0.10.0 an interim release seems like a good idea. Wumpus-Microprint and Wumpus-Tree work with Basic version 0.11.0 only the .cabal file needs a version bump, so I am not making new-release of those two.

Sunday, October 10, 2010

wumpus-basic

Copperbox revision 1779.

I've changed Plaintext to accommodate multi-line text, however, the changes cause a lot of problems. The type of Plaintext changes as it must access the drawing context for font-size and this stops (pseudo-)affine transformations working on it.

"Must access the drawing context" is not strictly true - with more careful coding I could probably avoid reading the drawing context until Plaintext is drawn. That said, the current code at least flags up problems I'll have to do some thinking about: what objects should support the pseudo affine transformations and how should I use lifters? Currently all drawing uses the lifters draw and drawi extensively, maybe this is not opportune.

Saturday, October 9, 2010

wumpus-basic

Copperbox revision 1778.

I've updated the demos to work with the changes to the Path data type.

wumpus-basic

Copperbox revision 1777.

I've changed the Path data type to disallow empty paths. This makes the API much more pleasant as quite a lot of functions operating on paths can changed from partial functions (using the Maybe type) to total functions.

Friday, October 8, 2010

wumpus-basic

Copperbox revision 1776.

I've reworked the Arrow01.hs demo so it actually draws something worthwhile...

wumpus-basic

Copperbox revision 1775.

I've renamed the safe fonts to use underscore for the word separator rather than use camelCase. Generally constants in Wumpus use underscore - the safe fonts used to be functions, but they have been constants for a while.

wumpus-basic

Copperbox revision 1774.

I've removed the old code in the Arrows module and changed all the arrowhead constructors to make elements of the new type Arrowhead.

The Petri net example has been updated to use the new code, other examples might be broken at the moment...

Thursday, October 7, 2010

wumpus-basic

Copperbox revision 1773.

I've reimplemented connectors so that arrowheads are configurable - previously every (right) arrowhead had its own path function and there weren't any left arrows (!). I haven't yet removed the old code or migrated the demos, that will have to wait until tomorrow.

wumpus-basic

Copperbox revision 1772.

I've renamed the ConnImage type to ConnectorImage, likewise other types and that had a Conn- prefix now have a Connector- prefix. This is a prelude to reworking the arrowhead types. 

wumpus-basic

Copperbox revision 1771.

I've replaced FreeLabel with a new element Plaintext. Plaintext isn't a Shape as it doesn't generate a path, but it does have some Shape-like properties - it can be rotated and translated, and it generates anchor points.

The down side to these changes to Shape and the introduction of the new Plaintext type is that labelling shapes is now more complicated, I'll have to look into a plumbing function to see if I can make Shapes and Plaintext labels in the same expression.Also, at some point Plaintext should be extended to handle multi-line text.

wumpus-basic

Copperbox revision 1770.

I've reworked Shapes to support rounded corners for appropriate shapes - rectangle, diamond... This has forced changes to the Shape types and as a consequence FreeLabel no longer works and is currently removed. Also Coordinate (which is just a filled disk not a path) has been made a different type with its own drawing function.

Wednesday, October 6, 2010

wumpus - new releases

Copperbox revision 1769.

New releases for the Wumpus libraries.

Wumpus-Core gets a fix for the PostScript stroke attribute separator bug and updates to the user guide which was a bit off the pace. 

The changes to Wumpus-Basic an the main reasons for the new releases. As the organization of Basic.Graphic has changed quite a lot I'm making a release now rather than have a huge change when I actually add some new functionality.

The updates to Wumpus-Tree and Wumpus-Microprint just track changes to Wumpus-Basic.

wumpus-core-0.35.0
wumpus-basic-0.10.0
wumpus-microprint-0.10.0
wumpus-tree-0.9.0

wumpus-core

Copperbox revision 1768.

I've updated the user guide...

I'd quite like to make a release with the stroke attribute separator bug fix, but as that was only a one character change it would be fitting to add some more improvements.

wumpus

Copperbox revision 1767.

Wumpus-Tree and Wumpus-Microprint have been updated to work with the latest Wumpus-Basic.

Also I've changed the portability tag line in numerous source files to "GHC".

Tuesday, October 5, 2010

wumpus-basic

Copperbox revision 1766.

I've worked through the demos and they should all run now.

Also, I've done some tidying up of Basic.Graphic removing the functions localLG and lgappend. They can be recreated with Applicative notation slightly more verbosely, so not having them as functions is something of a loss, however, I felt they were adding more "concepts" to the Graphic.Base API so that swung the balance in favour of removing them.

wumpus-basic

Copperbox revision 1765.

I've merged the modules Basic.Graphic.BaseClasses and Basic.Graphic.BaseTypes into one module Basic.Graphic.Base. This is so DrawingR can be a instance of DrawingCtxM without having to be an orphan (previously BaseClasses depended on BaseTypes).

Also, I've renamed the methods in DrawingCtxM and removed the non-overloaded functions pureDF, askDF etc. This has percolated a lot of changes through the code. Again not all the demos have been updated yet.

wumpus-basic

Copperbox revision 1764.

In DrawingContext, I've renamed the field labels primary_colour to stroke_colour and secondary_colour to fill_colour. Also I've renamed the setters accordingly, though not all examples have been tested yet so some might fail.

wumpus-basic

Copperbox revision 1763.

I've added a DirectionContext monad - this is a reader monad with line direction as the context. Its intended to make creating paths easier when the path needs displacing by a line angle. For instance, arrow tips are easy to think about if drawn on a left-to-right horizontal line, its more complicated to think about them on a line of some parametric angular direction. DirectionContext abstracts the direction and provides two morphisms perpendicular and parallel that are analogous to the vector constructors vvec and hvec.

wumpus-basic

Copperbox revision 1762.

Work on arrow tips - mostly recoding how to make triangles whilst regarding line angle. I had forgotten how the original code I wrote for this worked.

Monday, October 4, 2010

wumpus-core

Copperbox revision 1761.

Wumpus-Core bug fix...

wumpus-core-0.34.0 has a bug in the PostScript output code. In the file OutputPostScript, line 464 uses *hcat* - this should be *vcat*. If more than one stroke property changes invalid PostScript will be generated. As this is a single character bug, I will update the Hackage distribution only when I have some other changes/fixes.

wumpus-basic

Copperbox revision 1760.

Initial work on round cornered paths. The new function roundEvery can be used to draw round cornered polygons when supplied with a list of the vertex points.

Sunday, October 3, 2010

wumpus-basic

Copperbox revision 1759.

I've reworked the implementation of connectors so they build Paths directly rather than use the PathM monad. There are a few simple connectors, when I add more connectors I'll have to work out a naming scheme. Also there might be a need to compose connectors which isn't addressed at the moment.

wumpus-basic

Copperbox revision 1758.

Paths.Connectors compiles again, however it is due to be reworked substantially.

wumpus-basic

Copperbox revision 1757.

First round of work re-doing paths...

The base data types now have an explicit representation of the empty path and they cache the start and end points as well as the length.

Constructing paths via a monad turns out to be good. I'd been wanting to get rid of the PathM monad but monadic construction handles the path start point nicely - the run function supplies the start point. Without the start point being abstracted, snoc-ing doesn't have good semantics - for instance, the hline combinator cannot work on the empty path because it has no Y-position to take.


I haven't looked at the Connectors module yet, and as the the base types have changed it is currently broken. Connectors seem quite different to paths as the start and end points are known from the start (monadic paths only 'know' the start point).

Saturday, October 2, 2010

wumpus - new releases

Copperbox revision 1756.

New releases for Hackage:

wumpus-core-0.34.0
wumpus-basic-0.9.0
wumpus-microprint-0.9.0
wumpus-tree-0.8.0

wumpus-basic

Copperbox revision 1755.

Updates to three of the examples that had stopped compiling due to changes with chains.

wumpus-core

Copperbox revision 1754.

A round of haddock doc improvements.

I'm going to make a release over the weekend, and some of the documentation in Wumpus-Core was getting out of date.

Friday, October 1, 2010

wumpus

I've been without internet access for a few days, so while I've still been working on Wumpus there's been a gap where I haven't made any commits. I've now committed all the new code:

Copperbox revision 1749 - Wumpus-Basic
Added ScalingContext to Basic.Graphic for drawings such as Trees or Turtle drawings that work with some coordinate space (e.g. integer coordinates for turtle) that gets scaled to Drawing coordinates.

Copperbox revision 1750 - Wumpus-Tree
Added a new drawing style for "family trees" - here the connector is drawn as a horizontal line with vertical ticks to the parent and child nodes.

Copperbox revisions 1751 & 1752 - Wumpus-Microprint
Changed the capitalization of the module hierarchy to use a lower 'p' for Microprint, so the first commit deleted the old source modules, the second commit adds the old ones back plus a new module for tokenizing input. This new tokenizer is preferred over the previous teletype style.

Copperbox revision 1753 - Poor Small Chart
Changes to the Sparkline implementation. The new implementation is closer to the latest drawing style supported by Wumpus-Basic, but it is not strictly an improvement as the new types are too complicated. Chart drawing needs a substantial rethink.

Blog Archive

About Me

My photo
Disambiguating biog as there are a few Stephen Tetley's in the world. I'm neither a cage fighter or yachtsman. I studied Fine Art in the nineties (foundation Bradford 1992, degree Cheltenham 1992 - 95) then Computing part-time at Leeds Met graduating in 2003. I'm the Stephen Tetley on Haskell Cafe and Stackoverflow.