wumpus-basic-0.4.0: Common drawing utilities built on wumpus-core.Source codeContentsIndex
Wumpus.Basic.Monads.TurtleClass
PortabilityGHC
Stabilityunstable
Maintainerstephen.tetley@gmail.com
Contents
movement
Description

Turtle monad and monad transformer.

The Turtle monad embodies the LOGO style of imperative drawing - sending commands to update the a cursor.

While Wumpus generally aims for a more compositional, "coordinate-free" style of drawing, some types of diagram are more easily expressed in the LOGO style.

Synopsis
type Coord = (Int, Int)
data TurtleConfig u = TurtleConfig {
xstep :: !u
ystep :: !u
}
regularConfig :: u -> TurtleConfig u
class Monad m => TurtleM m where
getLoc :: m (Int, Int)
setLoc :: (Int, Int) -> m ()
getOrigin :: m (Int, Int)
setOrigin :: (Int, Int) -> m ()
class TurtleM m => TurtleScaleM m u | m -> u where
xStep :: m u
yStep :: m u
askSteps :: TurtleScaleM m u => m (u, u)
setsLoc :: TurtleM m => (Coord -> (a, Coord)) -> m a
setsLoc_ :: TurtleM m => (Coord -> Coord) -> m ()
resetLoc :: TurtleM m => m ()
moveLeft :: TurtleM m => m ()
moveRight :: TurtleM m => m ()
moveUp :: TurtleM m => m ()
moveDown :: TurtleM m => m ()
nextLine :: TurtleM m => m ()
getPos :: (TurtleScaleM m u, Num u) => m (Point2 u)
scaleCoord :: (TurtleScaleM m u, Num u) => (Int, Int) -> m (Point2 u)
Documentation
type Coord = (Int, Int)Source
data TurtleConfig u Source
Constructors
TurtleConfig
xstep :: !u
ystep :: !u
show/hide Instances
regularConfig :: u -> TurtleConfig uSource
class Monad m => TurtleM m whereSource
Methods
getLoc :: m (Int, Int)Source
setLoc :: (Int, Int) -> m ()Source
getOrigin :: m (Int, Int)Source
setOrigin :: (Int, Int) -> m ()Source
show/hide Instances
class TurtleM m => TurtleScaleM m u | m -> u whereSource
Methods
xStep :: m uSource
yStep :: m uSource
show/hide Instances
askSteps :: TurtleScaleM m u => m (u, u)Source
setsLoc :: TurtleM m => (Coord -> (a, Coord)) -> m aSource
setsLoc_ :: TurtleM m => (Coord -> Coord) -> m ()Source
movement
resetLoc :: TurtleM m => m ()Source
moveLeft :: TurtleM m => m ()Source
moveRight :: TurtleM m => m ()Source
moveUp :: TurtleM m => m ()Source
moveDown :: TurtleM m => m ()Source
nextLine :: TurtleM m => m ()Source
getPos :: (TurtleScaleM m u, Num u) => m (Point2 u)Source
scaleCoord :: (TurtleScaleM m u, Num u) => (Int, Int) -> m (Point2 u)Source
Produced by Haddock version 2.6.1