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

PortabilityGHC
Stabilityhighly unstable
Maintainerstephen.tetley@gmail.com

Wumpus.Drawing.Basis.LocTrace

Contents

Description

Writer monad with imperative turtle style movement to build LocGraphics.

Synopsis

LocTrace monads

data LocTrace u a Source

LocTrace is a writer state monad.

The writer accumulates a LocGraphic the state is a cumulative displacement vector (called a cursor below).

data LocTraceT u m a Source

LocTrace is a writer state monad.

The writer accumulates a LocGraphic the state is a cumulative displacement vector.

Instances

Monad m => Monad (LocTraceT u m) 
Monad m => Functor (LocTraceT u m) 
Monad m => Applicative (LocTraceT u m) 
(LocTraceM m, Num u) => LocForkTraceM (LocTraceT u m) 
(Monad m, Num u) => LocTraceM (LocTraceT u m) 

runLocTrace :: Num u => LocTrace u a -> (a, Vec2 u, LocGraphic u)Source

evalLocTrace :: Num u => LocTrace u a -> aSource

Forget the generated LocImage, just return the answer.

execLocTrace :: Num u => LocTrace u a -> LocGraphic uSource

Forget the answer, just return the generated LocImage.

runLocTraceT :: (Monad m, Num u) => LocTraceT u m a -> m (a, Vec2 u, LocGraphic u)Source

evalLocTraceT :: (Monad m, Num u) => LocTraceT u m a -> m aSource

Forget the generated LocImage, just return the answer.

execLocTraceT :: (Monad m, Num u) => LocTraceT u m a -> m (LocGraphic u)Source

Forget the answer, just return the generated LocImage.

liftLocTraceT :: Monad m => m a -> LocTraceT u m aSource

LocTrace classes

class Monad m => LocTraceM m whereSource

insertl analogue to Writer monad tell.

Methods

insertl :: MonUnit (m ()) ~ u => LocGraphic u -> m ()Source

insertl_ :: MonUnit (m ()) ~ u => LocImage u a -> m ()Source

moveBy :: MonUnit (m ()) ~ u => Vec2 u -> m ()Source

location :: MonUnit (m ()) ~ u => m (Vec2 u)Source

Instances

Num u => LocTraceM (LocTrace u) 
(Floating u, InterpretUnit u) => LocTraceM (PathSpec u) 
(Monad m, Num u) => LocTraceM (LocTraceT u m) 
Num u => LocTraceM (RefTrace u z) 
(Monad m, Floating u, InterpretUnit u) => LocTraceM (PathSpecT u m) 
(Monad m, Num u) => LocTraceM (RefTraceT u z m) 

class LocTraceM m => LocForkTraceM m whereSource

Add operations for branching (fork at the current point) and resetting to the start point.

Not all drawings that support tracing support branching. For instance Paths can be built by tracing but they always need a cumulative progression of next point they cannot resrt to the start point and go in a differnt direction.

Methods

reset :: m ()Source

branch :: m a -> m aSource

Instances

Derived operations

hmoveBy :: (LocTraceM m, Num u, u ~ MonUnit (m ())) => u -> m ()Source

Move the cursor horizontally.

vmoveBy :: (LocTraceM m, Num u, u ~ MonUnit (m ())) => u -> m ()Source

Move the cursor vertically.