wumpus-basic-0.1.1: Common drawing utilities built on wumpus-core.Source codeContentsIndex
Wumpus.Basic.Monads.TurtleMonad
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 very easily expressed in the LOGO style.

Synopsis
data Coord = Coord !Int !Int
data Turtle a
data TurtleT m a
class Monad m => TurtleM m where
getLoc :: m Coord
setLoc :: Coord -> m ()
runTurtle :: Turtle a -> (a, (Int, Int))
runTurtleT :: Monad m => TurtleT m a -> m (a, (Int, Int))
setsLoc :: TurtleM m => (Coord -> (a, Coord)) -> m a
setsLoc_ :: TurtleM m => (Coord -> Coord) -> m ()
reset :: TurtleM m => m ()
moveLeft :: TurtleM m => m ()
moveRight :: TurtleM m => m ()
moveUp :: TurtleM m => m ()
moveDown :: TurtleM m => m ()
nextLine :: TurtleM m => m ()
wander :: TurtleM m => m a -> m (a, Coord, Coord)
Documentation
data Coord Source
Constructors
Coord !Int !Int
show/hide Instances
data Turtle a Source
show/hide Instances
data TurtleT m a Source
show/hide Instances
class Monad m => TurtleM m whereSource
Methods
getLoc :: m CoordSource
setLoc :: Coord -> m ()Source
show/hide Instances
runTurtle :: Turtle a -> (a, (Int, Int))Source
runTurtleT :: Monad m => TurtleT m a -> m (a, (Int, Int))Source
setsLoc :: TurtleM m => (Coord -> (a, Coord)) -> m aSource
setsLoc_ :: TurtleM m => (Coord -> Coord) -> m ()Source
movement
reset :: 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
wander :: TurtleM m => m a -> m (a, Coord, Coord)Source
No longer sure about this combinator...
Produced by Haddock version 2.6.1