packages feed

wumpus-core 0.13.1 → 0.14.0

raw patch · 16 files changed

+505/−59 lines, 16 filesdep −data-aviarydep −dlistbinary-addedPVP ok

version bump matches the API change (PVP)

Dependencies removed: data-aviary, dlist

API changes (from Hackage documentation)

- Wumpus.Core.Picture: ellipse :: (Ellipse t, Fractional u) => t -> Point2 u -> u -> u -> Primitive u
+ Wumpus.Core.Picture: ellipse :: (Ellipse t, Fractional u) => t -> u -> u -> Point2 u -> Primitive u
- Wumpus.Core.Picture: zellipse :: (Num u) => Point2 u -> u -> u -> Primitive u
+ Wumpus.Core.Picture: zellipse :: (Num u) => u -> u -> Point2 u -> Primitive u

Files

CHANGES view
@@ -1,5 +1,17 @@  +0.13.1 to 0.14.0:++  * Added draft user guide. +  +  * Argument order changed for @ellipse@ and @zellispe@ in+    Wumpus.Core.Picture. +  +  * Removed dependency on Data.Aviary.+  +  * Removed DList dependency.++ 0.13.0 to 0.13.1:    * Wumpus.Core.SVG changed path_s to path_c - \'S\' was the 
demo/Picture.hs view
@@ -134,8 +134,8 @@   where     pic :: Picture Double     pic = p1 -//- p2-    p1 = scale 6 12 $ frame $ ellipse (plum, LineWidth 2) zeroPt 4 6-    p2 = scale 6 12 $ frame $ ellipse (peru, LineWidth 2) zeroPt 6 6+    p1 = scale 6 12 $ frame $ ellipse (plum, LineWidth 2) 4 6 zeroPt+    p2 = scale 6 12 $ frame $ ellipse (peru, LineWidth 2) 6 6 zeroPt   -- Note the movement of the plum square won't be regarded by 
+ doc-src/Guide.lhs view
@@ -0,0 +1,297 @@+\documentclass{article}
+
+%include polycode.fmt
+\usepackage{comment}
+\usepackage{amssymb}
+\usepackage{alltt}
+\usepackage[dvips]{graphicx}
+
+\newcommand{\wumpuscore}{\texttt{wumpus-core} }
+
+\begin{document}
+
+\title{\wumpuscore Guide}
+\author{Stephen Tetley}
+\maketitle
+
+%-----------------------------------------------------------------
+
+
+
+
+%-----------------------------------------------------------------
+\section{About \wumpuscore}
+%-----------------------------------------------------------------
+
+\wumpuscore is a Haskell library for generating 2D vector 
+pictures. It was written with portability as a priority, so it has 
+no dependencies on foreign (i.e. C) libraries. It supports output 
+to PostScript and SVG (Scalable Vector Graphics). 
+
+\wumpuscore is rather primitive, the basic drawing objects are 
+paths and text labels. A secondary library \texttt{wumpus-extra}
+has been prototyped containing some higher level objects 
+(arrowheads, etc.), but hasn't been officially released - the code 
+needs more thought before being put into the wild. Previews are 
+available from the \texttt{copperbox} project repository 
+hosted by Googlecode.
+
+Although \wumpuscore is heavily inspired by PostScript it avoids 
+PostScript's notion of an (implicit) current point and the 
+movements \texttt{lineto}, \texttt{moveto} etc., instead 
+\wumpuscore aims for a more \emph{coordinate free} style.
+
+
+%-----------------------------------------------------------------
+\section{Exposed modules}
+%-----------------------------------------------------------------
+
+\wumpuscore exports the following modules:
+
+\begin{description}
+\item[\texttt{Wumpus.Core.}]
+Top-level import module, re-exports the exposed modules. Exports 
+as opaque some of the internal data types, where the export is 
+necessary for writing type signatures to user functions but access
+to the objects themselves is hidden by \emph{smart} constructors.
+
+\item[\texttt{Wumpus.Core.AffineTrans.}]
+The standard affine transformations (scaling, rotation, 
+translation) implemented as type classes, with a of derived 
+operations - reflections about the X or Y axes, rotations through
+common angles. 
+
+\item[\texttt{Wumpus.Core.BoundingBox.}]
+Data type representing bounding boxes and operations on them. 
+This module is potentially important for defining higher-level
+graphics objects (arrowheads and the like).
+
+\item[\texttt{Wumpus.Core.Colour.}]
+Colour types (RGB, grayscale and HSB) and conversion between 
+them. Some named colours, which should be hidden or import
+qualified if a more extensive package of colours (e.g. the named
+SVG colours) is used. RGB is the default format, where black is 
+\texttt{(0.0, 0.0, 0.0)}, and white is \texttt{(1.0, 1.0, 1.0)}.
+
+\item[\texttt{Wumpus.Core.FontSize.}]
+Various calculations for font size metrics. Generally not useful 
+to a user but exposed so that variations of the standard Label 
+type are possible.
+
+\item[\texttt{Wumpus.Core.Geometry.}]
+Usual types an operations from affine geometry - points, vectors 
+and frames. The \texttt{Pointwise} type class which is essential
+for defining transformable drawable types. 
+
+\item[\texttt{Wumpus.Core.GraphicsState.}]
+Data types modelling the attributes of PostScript's graphics 
+state (stroke style, dash pattern, etc.). Note \wumpuscore 
+annotates primitives - paths, text labels - with their rendering 
+style. PostScript has a mutable graphics state, changing via 
+inheritance how the curent object is drawn.
+
+\item[\texttt{Wumpus.Core.OutputPostScript.}]
+Functions to write PostScript or encapsulated PostScript files.
+
+\item[\texttt{Wumpus.Core.OutputSVG.}]
+Functions to write SVG files.
+
+\item[\texttt{Wumpus.Core.Picture.}]
+Operations to build \emph{pictures} - paths and labels within
+an affine frame. Type classes overloading convenience 
+constructors for building paths, labels, ellipses... The 
+constructors are convenient in that attributes - colour, line
+width, etc. - may be specified or not. The technique is due to 
+Iavor S. Diatchki's XML-Light.
+
+\item[\texttt{Wumpus.Core.PictureLanguage.}]
+Composition operators for pictures. The operators are somewhat 
+analogue to the usual operators or pretty-printing libraries, 
+but work in 2D rather than largely horizontally with some 
+vertical concatenation.
+
+\item[\texttt{Wumpus.Core.TextEncoder.}]
+Types for handling non-ASCII character codes. This module is
+perhaps under-cooked thou it appears adequate for Latin 1...
+
+\item[\texttt{Wumpus.Core.TextLatin1.}]
+A instance of the TextEncoder type for mapping Latin 1 characters
+to the PostScript and SVG escape characters.
+\end{description}
+
+%-----------------------------------------------------------------
+\section{Drawing model}
+%-----------------------------------------------------------------
+
+\wumpuscore has two main drawable primitives \emph{paths}
+and text \emph{labels}, ellipses are also a primitive although 
+this is a concession to efficiency when drawing dots (which would 
+otherwise require 4 to 8 Bezier arcs to describe). Paths are made 
+from straight sections or Bezier curves, they can be open and 
+\emph{stroked} to produce a line; or closed and \emph{stroked}, 
+\emph{filled} or \emph{clipped}. Labels represent a single 
+horizontal line of text - multiple lines must be composed from 
+multiple labels.
+
+Primitives are attributed with drawing styles - font name and 
+size for labels; line width, colour, etc. for paths - and 
+place within a picture. The function \texttt{frame} lifts a 
+primitive to a picture within the standard affine frame (the 
+standard frame has origin at (0,0) and unit bases for the X and
+Y axes). The function \texttt{frameMulti} places one or more 
+primitives in a frame - this will produce more efficient 
+PostScript and should be preferred for creating scatter-plots 
+and the like.
+
+\begin{figure}
+\centering
+\includegraphics{WorldFrame.eps}
+\caption{The world frame, with origin at the bottom left.}
+\end{figure}
+
+\wumpuscore uses the same picture frame as PostScript with 
+the origin at the bottom left, see Figure 1. This contrasts to SVG 
+where the origin at the top-left. When \wumpuscore generates SVG, 
+the whole picture is produced within a matrix transformation 
+[ 1.0, 0.0, 0.0, -1.0, 0.0, 0.0 ] that changes the picture to use 
+PostScript coordinates. This has the side-effect that text is 
+otherwise drawn upside down, so \wumpuscore adds a rectifying 
+transform to each text element.
+
+Once labels and paths are assembled as a \emph{Picture} they are
+transformable with the usual affine transformations (scaling, 
+rotation, translation) and multiple pictures can be composed with
+the operations provided by the \texttt{PictureLanguage} module.
+The operations should be largely familiar from pretty-printing 
+libraries although here they are extended to 2 dimensions.
+
+Once assembled into pictures graphics properties (e.g. colour) 
+are opaque - it is not possible to write a transformation function
+that turns a picture blue. In some ways this is a limitation - 
+for instance, the \texttt{Diagrams} library appears to support 
+some notion of attribute overriding; however it is conceptually 
+simple. If one wanted to make blue arrows or red arrows with 
+\wumpuscore one would make colour a parameter of the arrow 
+creating function.
+
+%-----------------------------------------------------------------
+\section{Affine transformations}
+%-----------------------------------------------------------------
+
+For affine transformations Wumpus uses the \texttt{Matrix3} data 
+type to represent 3x3 matrices in row-major form. The constructor
+ \texttt{(M3'3 a b c  d e f  g h i)} builds this matrix:
+
+\begin{displaymath}
+\begin{array}{ccc}
+a & b & c\\
+d & e & f\\
+g & h & i
+\end{array}
+\end{displaymath}
+
+Note, in practice the elements \emph{g} and \emph{h} are 
+superflous. They are included in the data type to make it match 
+the typical representation from geometry texts. Also, typically 
+matrices will implicitly created with functions from the 
+\texttt{Core.Geometry} and \texttt{Core.AffineTrans} modules.
+
+For example a translation matrix moving 10 units in the X-axis and
+20 in the Y-axis will be encoded as 
+ \texttt{(M3'3 1.0 0.0 10.0   0.0 1.0 20.0  0.0  0.0 1.0)}
+
+\begin{displaymath}
+\begin{array}{ccc}
+1.0 & 0.0 & 10.0\\
+0.0 & 1.0 & 20.0\\
+0.0 & 0.0 & 1.0
+\end{array}
+\end{displaymath}
+
+Affine transformations are communicated to PostScript as 
+\texttt{concat} commands. Effectively \wumpuscore performs no
+transformations itself, delegating all the work to PostScript or
+SVG. This means transformations can generally be located in the 
+output if a picture needs to be debugged, though as this might 
+not be very helpful in practice. Internally \wumpuscore only 
+performs the transformation on the pictures bounding box - it 
+needs to do this so transformed pictures can still be composed 
+with the picture language operations.
+
+PostScript uses column-major form and uses a six element matrix
+rather than a nine element one. The translation matrix above 
+would produce this concat command:
+
+\begin{verbatim}
+[1.0 0.0 0.0 1.0 10.0 20.0] concat
+\end{verbatim}
+
+Similarly, it would be communicated to SVG via a 
+\texttt{<g ...> </g>} element:
+
+\begin{verbatim}
+<g transform="matrix(1.0, 0.0, 0.0, 1.0, 10.0, 20.0)"> ... </g>
+\end{verbatim}
+
+
+
+
+%-----------------------------------------------------------------
+\section{Font handling}
+%-----------------------------------------------------------------
+
+Font handling is quite primitive in \wumpuscore. The bounding box 
+of text label is only estimated - based on the length of the 
+label's string rather than the metrics of the individual letters 
+encoded in the font. Accessing the glyph metrics in a font would 
+require a font loader to read TrueType font files. This would be 
+a significant effort, probably larger than the effort put into 
+\wumpuscore itself; for \wumpuscore's intended use - producing 
+diagrams and pictures rather than high quality text - its 
+primitive font handling is not such a draw back.
+
+
+In both PostScript and SVG mis-named fonts can cause somewhat
+inscrutable printing anomalies - usually falling back to a default 
+font but not always. Paricularly note, that PostScript fonts may
+only support glyphs in a limited set of sizes 
+(10, 12, 18, 24, 26), for labels at other sizes the text should
+be drawn at a regular size then scaled once it has been lifted 
+with the \texttt{frame} function to the Picture type.
+
+The following table lists PostScript fonts and their SVG 
+equivalents. The unreleased package \texttt{wumpus-extra} has
+a module \texttt{SafeFonts} encoding this list to avoid 
+typographical slips...
+
+
+
+\begin{tabular}{ l l }
+PostScript name   & SVG name      \\
+\hline
+Times-Roman       & Times New Roman \\
+Times-Italic      & Times New Roman - style="italic" \\
+Times-Bold        & Times New Roman - font-weight="bold" \\
+Times-BoldItalic  & Times New Roman - style="italic", font-weight="bold" \\
+Helvetica         & Helvetica \\
+Helvetica-Oblique & Helvetica - style="italic" \\
+Helvetica-Bold    & Helvetica - font-weight="bold" \\
+Helvetica-Bold-Oblique & Helvetica - style="italic", font-weight="bold" \\
+Courier           & Courier New \\
+Courier-Oblique   & Courier New - style="italic" \\
+Courier-Bold      & Courier New - font-weight="bold" \\
+Courier-Bold-Oblique & Courier New - style="italic", font-weight="bold" \\
+Symbol & Symbol \\
+\hline
+\end{tabular}
+
+
+
+
+%-----------------------------------------------------------------
+\section{Acknowledgments}
+%-----------------------------------------------------------------
+
+PostScript is a registered trademark of Adobe Systems Inc.
+
+\end{document}
+ doc-src/Makefile view
@@ -0,0 +1,11 @@++all: guide++guide: Guide.lhs+	lhs2TeX -o out/Guide.tex Guide.lhs+	dos2unix out/*.tex+	latex --output-directory=./out Guide.tex+	dvips -o ./out/Guide.ps ./out/Guide.dvi+	dvipdfm -o ./out/Guide.pdf ./out/Guide.dvi +	cp ./out/Guide.pdf ../doc+
+ doc-src/WorldFrame.eps view
@@ -0,0 +1,40 @@+%!PS-Adobe-3.0 EPSF-3.0
+%%BoundingBox: 4 4 117 97
+%%CreationDate: (13:27:26 5 May 2010)
+%%EndComments
+gsave
+4.0 5.40625 translate
+[0.75 0.0 0.0 0.75 0.0 0.0] concat
+/Helvetica findfont
+10 scalefont
+setfont
+0.0 0.0 moveto
+((0,0)) show
+96.0 0.0 moveto
+((100,0)) show
+0.0 114.0 moveto
+((0,100)) show
+96.0 114.0 moveto
+((100,100)) show
+0.5 setlinewidth
+newpath
+10.0 10.0 moveto
+110.0 10.0 lineto
+stroke
+1.0 setlinewidth
+0.5 setlinewidth
+newpath
+10.0 10.0 moveto
+10.0 110.0 lineto
+stroke
+1.0 setlinewidth
+1.5 setlinewidth
+newpath
+11.0 11.0 moveto
+110.0 110.0 lineto
+stroke
+1.0 setlinewidth
+[1.333333 0.0 0.0 1.333333 0.0 0.0] concat
+grestore
+showpage
+%%EOF
+ doc/Guide.pdf view

binary file changed (absent → 55456 bytes)

src/Wumpus/Core.hs view
@@ -34,7 +34,7 @@ -- -- * "Wumpus.Core.PictureLanguage" ----- * "Wumpus.Core.TextEncoding"+-- * "Wumpus.Core.TextEncoder" -- -- -- Named colours ( black, white etc.) are hidden from 
src/Wumpus/Core/Geometry.hs view
@@ -87,9 +87,8 @@    ) where -import Wumpus.Core.Utils ( CMinMax(..), PSUnit(..) )+import Wumpus.Core.Utils ( CMinMax(..), PSUnit(..), oo ) -import Data.Aviary  import Data.AffineSpace import Data.VectorSpace@@ -392,7 +391,7 @@   (M3'3 a b c d e f _ _ _) *# (V2 m n) = V2 (a*m+b*n+c*0) (d*m+e*n+f*0)  -instance Num a => MatrixMult(Point2 a) where+instance Num a => MatrixMult (Point2 a) where   (M3'3 a b c d e f _ _ _) *# (P2 m n) = P2 (a*m+b*n+c*1) (d*m+e*n+f*1)  --------------------------------------------------------------------------------
src/Wumpus/Core/OutputPostScript.hs view
@@ -38,7 +38,6 @@ import Wumpus.Core.TextLatin1 import Wumpus.Core.Utils -import Data.Aviary ( appro )  import MonadLib hiding ( Label ) 
src/Wumpus/Core/OutputSVG.hs view
@@ -50,7 +50,6 @@ import Wumpus.Core.TextLatin1 import Wumpus.Core.Utils -import Data.Aviary ( (#) )  import MonadLib hiding ( Label ) @@ -127,7 +126,7 @@ clipPath :: PSUnit u => Path u -> SvgM Element clipPath p = do     name <- newClipLabel-    return $ element_clippath ps # add_attr (attr_id name)+    return $ element_clippath ps `rap` add_attr (attr_id name)   where     ps = closePath $ pathInstructions p @@ -146,7 +145,7 @@  path :: PSUnit u => PathProps -> Path u -> SvgM Element path (c,dp) p = -    return $ element_path ps # add_attrs (fill_a : stroke_a : opts)+    return $ element_path ps `rap` add_attrs (fill_a : stroke_a : opts)   where     (fill_a,stroke_a,opts) = drawProperties c dp     ps                     = svgPath dp p @@ -162,9 +161,9 @@ label :: (Ord u, PSUnit u) => LabelProps -> Label u -> SvgM Element label (c,FontAttr _ fam style sz) (Label pt entxt) = do       str <- encodedText entxt-     let tspan_elt = element_tspan str # add_attrs [ attr_fill c ]-     return $ element_text tspan_elt # add_attrs text_xs -                                     # add_attrs (fontStyle style)+     let tspan_elt = element_tspan str `rap` add_attrs [ attr_fill c ]+     return $ element_text tspan_elt `rap` add_attrs text_xs +                                     `rap` add_attrs (fontStyle style)   where     P2 x y    = coordChange pt     text_xs   = [ attr_x x@@ -214,9 +213,9 @@ ellipse :: PSUnit u => EllipseProps -> Point2 u -> u -> u -> SvgM Element ellipse (c,dp) (P2 x y) w h      | w == h    = return $ element_circle  -                         # add_attrs (circle_attrs  ++ style_attrs)+                         `rap` add_attrs (circle_attrs  ++ style_attrs)     | otherwise = return $ element_ellipse -                         # add_attrs (ellipse_attrs ++ style_attrs)+                         `rap` add_attrs (ellipse_attrs ++ style_attrs)   where     circle_attrs  = [attr_cx x, attr_cy y, attr_r w]     ellipse_attrs = [attr_cx x, attr_cy y, attr_rx w, attr_ry h]
src/Wumpus/Core/Picture.hs view
@@ -378,8 +378,8 @@ --------------------------------------------------------------------------------  mkEllipse :: Num u -          => PSRgb -> DrawEllipse -> Point2 u -> u -> u -> Primitive u-mkEllipse c dp pt hw hh = PEllipse (c,dp) pt hw hh+          => PSRgb -> DrawEllipse -> u -> u -> Point2 u -> Primitive u+mkEllipse c dp hw hh pt = PEllipse (c,dp) pt hw hh   ellipseDefault :: EllipseProps@@ -404,7 +404,7 @@ -- will be wider too.  -- class Ellipse t where-  ellipse :: Fractional u => t -> Point2 u -> u -> u -> Primitive u+  ellipse :: Fractional u => t -> u -> u -> Point2 u -> Primitive u  instance Ellipse ()             where ellipse () = zellipse instance Ellipse DrawEllipse    where ellipse dp = mkEllipse psBlack dp@@ -455,7 +455,7 @@   -- | Create a black, filled ellipse. -zellipse :: Num u => Point2 u -> u -> u -> Primitive u+zellipse :: Num u => u -> u -> Point2 u -> Primitive u zellipse = uncurry mkEllipse ellipseDefault  
src/Wumpus/Core/PictureInternal.hs view
@@ -58,11 +58,12 @@ import Wumpus.Core.TextEncodingInternal import Wumpus.Core.Utils -import Data.Aviary  import Data.AffineSpace import Data.Semigroup +import Control.Applicative ( liftA2 )+ import Text.PrettyPrint.Leijen  @@ -71,21 +72,26 @@ -- colour, line-width etc. It is parametric on the unit type  -- of points (typically Double). -- --- Wumpus\'s Picture, being a leaf attributed tree, is not --- ideally matched to PostScript\'s picture representation, --- which might be considered a node attributed tree if you --- recast graphics state updates as syntactic commands --- encountered during top-down evaluation.--- --- Currently this mismatch means that the PostScript code --- generated by Wumpus has significant overuse of PostScript's--- @gsave@ and @grestore@.+-- Wumpus\'s leaf attributed tree, is not directly matched to +-- PostScript\'s picture representation, which might be +-- considered a node attributed tree (if you consider graphics+-- state changes less imperatively - setting attributes rather +-- than global state change). ----- At some point a tree-rewriting step might be added to --- coalesce some of the repeated graphics state updates.+-- Considered as a node-attributed tree PostScript precolates +-- graphics state updates downwards in the tree (vis-a-vis +-- inherited attributes in an attibute grammar), where a +-- graphics state change deeper in the tree overrides a higher +-- one.+-- +-- Wumpus on the other hand, simply labels each leaf with its+-- drawing attributes - there is no attribute inheritance.+-- When it draws the PostScript picture it does some +-- optimization to avoid generating excessive graphics state +-- changes in the PostScript code. -- -- Apropos the constructors, Picture is a simple non-empty --- leaf-labelled rose tree via +-- leaf-labelled rose tree via: --  -- > Single (aka leaf) | Picture (OneList tree) --@@ -291,7 +297,7 @@ -- Helpers for the affine transformations  rotatePicture :: (Real u, Floating u) => Radian -> Picture u -> Picture u-rotatePicture = bigphi transformPicture rotate rotate+rotatePicture = liftA2 transformPicture rotate rotate   rotatePictureAbout :: (Real u, Floating u) 
src/Wumpus/Core/PostScript.hs view
@@ -90,11 +90,9 @@ import Wumpus.Core.Colour import Wumpus.Core.GraphicsState import Wumpus.Core.TextEncoder-import Wumpus.Core.Utils ( PSUnit(..), roundup, parens, hsep )+import Wumpus.Core.Utils -import Data.Aviary -import qualified Data.DList as DL import MonadLib  import Data.List ( foldl' )@@ -161,7 +159,7 @@  type PostScript = String -type PsOutput = DL.DList Char+type PsOutput = H Char  type WumpusM a = PsT Id a @@ -206,7 +204,7 @@  -- | Drop state and result, take the Writer trace. runWumpus :: TextEncoder -> WumpusM a -> String-runWumpus = (DL.toList . snd) `oo` pstId+runWumpus = (toListH . snd) `oo` pstId  -------------------------------------------------------------------------------- -- "Deltas" of the graphics state@@ -267,11 +265,11 @@ tell s = puts ((),s)  writeChar :: WriterM m PsOutput => Char -> m ()-writeChar = tell . DL.singleton +writeChar = tell . showChar    write :: WriterM m PsOutput => String -> m ()-write = tell . DL.fromList +write = tell . showString    writeln :: WriterM m PsOutput => String -> m ()
src/Wumpus/Core/SVG.hs view
@@ -106,7 +106,6 @@ import Wumpus.Core.TextEncoder import Wumpus.Core.Utils -import Data.Aviary  import MonadLib hiding ( version ) import Text.XML.Light
src/Wumpus/Core/Utils.hs view
@@ -51,10 +51,12 @@   , sequenceA   , (<:>)  -+  -- * Hughes list+  , H+  , toListH    -  -- * One type - non-empty list type+  -- * OneList type - non-empty list type   , OneList(..)   , mkList2   , onesmapM_@@ -62,6 +64,15 @@   , toListWithM   , fromListErr ++  -- * specs etc. from Data.Aviary+  , appro+  , oo+  , ooo+  , oooo+  , rap++   ) where  @@ -232,8 +243,14 @@ (<:>) :: Applicative f => f a -> f [a] -> f [a] (<:>) a b = (:) <$> a <*> b +--------------------------------------------------------------------------------+-- Hughes list +type H a = [a] -> [a] +toListH :: H a -> [a]+toListH = ($ [])+ --------------------------------------------------------------------------------  infixr 5 :+@@ -268,3 +285,62 @@ fromListErr msg []     = error msg fromListErr _   [a]    = One a fromListErr msg (a:xs) = a :+ fromListErr msg xs++++--------------------------------------------------------------------------------+++-- | A variant of the @D2@ or dovekie combinator - the argument+-- order has been changed to be more satisfying for Haskellers:+--+-- > (appro comb f g) x y+--+-- > (f x) `comb` (g y)+-- +-- @on@ from Data.Function is similar but less general, where +-- the two intermediate results are formed by applying the same +-- function to the supplied arguments:+--+-- > on = (appro comb f f)+--+appro :: (c -> d -> e) -> (a -> c) -> (b -> d) -> a -> b -> e+appro comb f g x y = comb (f x) (g y) +++--------------------------------------------------------------------------------+-- Specs - blackbird, bunting, ...++-- Alleviate your composing-sectioning mania with specs!+--+-- E.g.:+-- (abs .) . (*) ==> abs `oo` (*)+--+-- The family name /specs/ (glasses, specs, lunettes) is a +-- visual pun when infix directives @`oo`@ are included. The +-- @o@\'s of individual combinators are a fraternal nod to +-- Clean and ML who use @o@ as function composition. Naturally+-- we don\'t defined @o@ here and waste a good variable on a +-- redundant combinator.++-- | Compose an arity 1 function with an arity 2 function.+-- B1 - blackbird+oo :: (c -> d) -> (a -> b -> c) -> a -> b -> d+oo f g = (f .) . g++-- | Compose an arity 1 function with an arity 3 function.+-- B2 - bunting+ooo :: (d -> e) -> (a -> b -> c -> d) -> a -> b -> c -> e+ooo f g = ((f .) .) . g++-- | Compose an arity 1 function with an arity 4 function.+oooo :: (e -> f) -> (a -> b -> c -> d -> e) -> a -> b -> c -> d -> f+oooo f g = (((f .) .) .) . g  ++++-- ($) reversed - aka T - aka (#)+--+infixl 1 `rap`+rap :: a -> (a -> b) -> b+rap a f = f a
wumpus-core.cabal view
@@ -1,5 +1,5 @@ name:             wumpus-core-version:          0.13.1+version:          0.14.0 license:          BSD3 license-file:     LICENSE copyright:        Stephen Tetley <stephen.tetley@gmail.com>@@ -28,7 +28,7 @@   THE DRAWBACKS...   .   For actually drawing pictures, diagrams, etc. Wumpus is very -  low level. I am working on a complementary package +  low level. I\'ve worked on a complementary package    @wumpus-extra@ with higher-level stuff (polygons, arrows etc.)   but it is too unstable for Hackage. Preview releases can be   found at <http://code.google.com/p/copperbox/> though.@@ -45,13 +45,13 @@   appears okay for Latin 1 but I\'m not sure about other    character sets, and I may have to revise it significantly.   .-  /There is no documentation/ - the graphics model used by -  Wumpus is different to PostScript or SVG, and Wumpus really -  needs a manual. Unfortunately there isn\'t one yet, and I will -  be focusing on @wumpus-extra@ for the foreseeable future; so a-  manual won\'t be written soon. If you want FFI-free vector-  graphics and Wumpus seems to otherwise fit the task, please -  email me and I will try to help.+  With revision 0.14.0, I've added the first draft of a user +  guide. Source for the guide is included as well as the PDF as +  there is an extra example picture. @wumpus-extra@ hasn\'t +  received any more attention unfortunately, so Wumpus is still +  really a bit too primitive for general use. However, if you +  want FFI-free vector graphics and Wumpus seems to otherwise +  fit the task, please email me and I will try to help.   .   \[1\] Because the output is simple, straight-line PostScript    code, it is possible to use GraphicsMagick or a similar tool to @@ -59,28 +59,38 @@   .   Changelog:   .-  0.13.0 to 0.13.1:+  0.13.1 to 0.14.0:   .-  * Wumpus.Core.SVG changed path_s to path_c - \'S\' was the -    wrongSVG command to match PostScript\'s @curveto@.+  * Added draft user guide.    .+  * Argument order changed for @ellipse@ and @zellispe@ in+    Wumpus.Core.Picture. +  .+  * Removed dependency on Data.Aviary.+  .+  * Removed DList dependency.+  . build-type:         Simple-stability:          highly unstable+stability:          unstable cabal-version:      >= 1.2  extra-source-files:   CHANGES,   LICENSE,   demo/LabelPic.hs,-  demo/Picture.hs+  demo/Picture.hs,+  doc/Guide.pdf,+  doc-src/Guide.lhs,+  doc-src/Makefile,+  doc-src/WorldFrame.eps  + library   hs-source-dirs:     src   build-depends:      base < 5, containers, old-time,                       wl-pprint, vector-space, -                      monadLib, xml, dlist, algebra, -                      data-aviary > 0.1.0+                      monadLib, xml, algebra                            exposed-modules:     Wumpus.Core,