wumpus-drawing-0.2.0: High-level drawing objects built on Wumpus-Basic.

PortabilityGHC
Stabilityunstable
Maintainerstephen.tetley@gmail.com

Wumpus.Drawing.Chains.Base

Contents

Description

Generate points in an iterated chain.

Synopsis

Documentation

type PointChain u = [Point2 u]Source

A PointChain is a list of points.

The list is typically inifinte so some attention must be given to choosing a chain drawing function and using it appropriately.

type LocChain u = LocDrawingInfo u (PointChain u)Source

A LocChain is a function from a starting point to a PointChain.

The list is often expected to be inifinte, but if it was a Stream it would loose the ability to use list comprehensions.

type ConnectorChain u = ConnectorCF u (PointChain u)Source

A ConnectorChain is a function from a start- and end-point to a Chain.

Unrolling chains

unchain :: (Num u, OPlus a) => Int -> LocCF u (ImageAns u a) -> LocCF u (ImageAns u a) -> LocChain u -> LocCF u (ImageAns u a)Source

unchain : unroll_count * alt_fun * draw_fun * chain -> LocCF

Unroll the chain, applying the draw_fun to each point producing a LocCF (usually a LocGraphic). If the chain does not produce any points the alt_fun is applied to the start point.

Note - commonly a Chain may be infinite, so it is only unrolled a finite number of times - the unrool_count.

This function has a very general type signature commonly it will be used at these types:

 unchain :: (Num u, OPlus a) => 
     Int -> LocImage u a -> LocImage u a -> LocChain u -> LocImage u a

 unchain :: Num u => 
     Int -> LocGraphic u -> LocGraphic u -> LocChain u -> LocGraphic u

unchainU :: (Num u, OPlus a) => LocCF u (ImageAns u a) -> LocCF u (ImageAns u a) -> LocChain u -> LocCF u (ImageAns u a)Source

unchain : alt_fun * draw_fun * chain -> LocCF

Unsafe version of unchain - this function assumes the chain is finite which is not usually the case.

This function has a very general type signature commonly it will be used at these type:

 unchainU :: (Num u, OPlus a) => 
     LocImage u a -> LocImage u a -> LocChain u -> LocImage u a

 unchainU :: Num u => 
     LocGraphic u -> LocGraphic u -> LocChain u -> LocGraphic u

** WARNING ** - if the chain is infinite this function will not terminate.

unchainZip :: (Num u, OPlus a) => LocCF u (ImageAns u a) -> [LocCF u (ImageAns u a)] -> LocChain u -> LocCF u (ImageAns u a)Source

unchainZip : alt_fun * [draw_fun] * chain -> LocCF

Unroll the chain, zipping the list of draw_funs to the list of points producing a LocCF (usually a LocGraphic). If the chain does not produce any points the alt_fun is applied to the start point.

This function has a very general type signature commonly it will be used at these types:

 unchainZip :: (Num u, OPlus a) => 
     LocImage u a -> [LocImage u a] -> LocChain u -> LocImage u a

 unchainZip :: Num u => 
     LocGraphic u -> [LocGraphic u] -> LocChain u -> LocGraphic u

** WARNING ** - the list of drawing functions should be finite. If both the list of drawing functions and the chain are infinite this function will not terminate.

unchainZipWith :: (Num u, OPlus a) => LocCF u (ImageAns u a) -> (s -> LocCF u (ImageAns u a)) -> [s] -> LocChain u -> LocCF u (ImageAns u a)Source

unchainZipWith : alt_fun * (a -> draw_fun) * [a] * chain -> LocCF

Version of unchainZip where the list is some data rather than a drawing function and the (a -> draw_fun) builder is applied to each element as part of the unrolling.

Approximately this function is a zipWith to the zip of unchainZip.

This function has a very general type signature commonly it will be used at these type:

 unchainZipWith :: (Num u, OPlus a) => 
     LocImage u a -> (s -> LocImage u a) -> [s] -> LocChain u -> LocImage u a

 unchainZipWith :: Num u => 
     LocGraphic u -> (s -> LocGraphic u) -> [s] -> LocChain u -> LocGraphic u

** WARNING ** - if the chain and list are infinite this function will not terminate.

unconnectorChain :: (Num u, OPlus a) => ConnectorCF u (ImageAns u a) -> LocCF u (ImageAns u a) -> ConnectorChain u -> ConnectorCF u (ImageAns u a)Source

unconnectorChain : alt_fun * draw_fun * conn_chain -> ConnectorCF

Unroll the chain produced between the implicit start and end points. Apply the draw_fun to each point producing a ConnectorCF (usually a ConnectorGraphic). If the chain does not produce any points, the alt_fun is applied to the start and end points.

This function has a very general type signature commonly it will be used at these types:

 unconnectorChain :: (Num u, OPlus a) => 
     ConnectorImage u a -> LocImage u a -> ConnectorChain u -> ConnectorImage u a

 unconnectorChain :: Num u => 
     ConnectorGraphic u -> LocGraphic u -> ConnectorChain u -> ConnectorGraphic u

Building chains

liftChainF :: (Point2 u -> PointChain u) -> LocChain uSource

liftChainF : (point -> [point]) -> LocChain

Lift a pure chain generating function inot a LocChain.