Maintainer | Michael Sloan <mgsloan at gmail> |
---|---|

Safe Haskell | Safe-Infered |

Stateful domain specific language for diagram paths, modelled after the classic "turtle" graphics language.

- type Turtle = TurtleT Identity
- type TurtleT = StateT TState
- runTurtle :: Turtle a -> Path R2
- runTurtleT :: (Monad m, Functor m) => TurtleT m a -> m (Path R2)
- forward :: Monad m => Double -> TurtleT m ()
- backward :: Monad m => Double -> TurtleT m ()
- left :: Monad m => Double -> TurtleT m ()
- right :: Monad m => Double -> TurtleT m ()
- heading :: Monad m => TurtleT m Double
- setHeading :: Monad m => Double -> TurtleT m ()
- towards :: Monad m => P2 -> TurtleT m ()
- pos :: Monad m => TurtleT m P2
- setPos :: Monad m => P2 -> TurtleT m ()
- penHop :: Monad m => TurtleT m ()
- penUp :: Monad m => TurtleT m ()
- penDown :: Monad m => TurtleT m ()
- isDown :: Monad m => TurtleT m Bool
- closeCurrent :: Monad m => TurtleT m ()

# Documentation

# Turtle control commands

runTurtle :: Turtle a -> Path R2Source

Run the turtle, yielding a path consisting of the traced trails.

runTurtleT :: (Monad m, Functor m) => TurtleT m a -> m (Path R2)Source

A more general way to run the turtle. Returns a computation in the
underlying monad `m`

yielding a path consisting of the traced trails

# Motion commands

forward :: Monad m => Double -> TurtleT m ()Source

Move the turtle forward, along the current heading.

backward :: Monad m => Double -> TurtleT m ()Source

Move the turtle backward, directly away from the current heading.

left :: Monad m => Double -> TurtleT m ()Source

Modify the current heading to the left by the specified angle in degrees.

right :: Monad m => Double -> TurtleT m ()Source

Modify the current heading to the right by the specified angle in degrees.

# State accessors / setters

# Drawing control

isDown :: Monad m => TurtleT m BoolSource

Queries whether the pen is currently drawing a path or not.

closeCurrent :: Monad m => TurtleT m ()Source

Closes the current path, to the last penDown / setPosition Maintains current position - does this make sense?