Portability | GHC |
---|---|
Stability | highly unstable |
Maintainer | stephen.tetley@gmail.com |
Writer monad with imperative turtle style movement to build LocGraphics.
- data LocTrace u a
- data LocTraceT u m a
- runLocTrace :: Num u => LocTrace u a -> (a, Vec2 u, LocGraphic u)
- evalLocTrace :: Num u => LocTrace u a -> a
- execLocTrace :: Num u => LocTrace u a -> LocGraphic u
- runLocTraceT :: (Monad m, Num u) => LocTraceT u m a -> m (a, Vec2 u, LocGraphic u)
- evalLocTraceT :: (Monad m, Num u) => LocTraceT u m a -> m a
- execLocTraceT :: (Monad m, Num u) => LocTraceT u m a -> m (LocGraphic u)
- liftLocTraceT :: Monad m => m a -> LocTraceT u m a
- class Monad m => LocTraceM m where
- class LocTraceM m => LocForkTraceM m where
- hmoveBy :: (LocTraceM m, Num u, u ~ MonUnit (m ())) => u -> m ()
- vmoveBy :: (LocTraceM m, Num u, u ~ MonUnit (m ())) => u -> m ()
LocTrace monads
LocTrace is a writer state monad.
The writer accumulates a LocGraphic the state is a cumulative displacement vector (called a cursor below).
Monad (LocTrace u) | |
Functor (LocTrace u) | |
Applicative (LocTrace u) | |
InterpretUnit u => LocForkTraceM (LocTrace u) | |
InterpretUnit u => LocTraceM (LocTrace u) |
LocTrace is a writer state monad.
The writer accumulates a LocGraphic the state is a cumulative displacement vector.
Monad m => Monad (LocTraceT u m) | |
Monad m => Functor (LocTraceT u m) | |
Monad m => Applicative (LocTraceT u m) | |
(LocTraceM m, InterpretUnit u) => LocForkTraceM (LocTraceT u m) | |
(Monad m, InterpretUnit 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
.
insertl :: MonUnit (m ()) ~ u => LocGraphic u -> m ()Source
insertl_ :: MonUnit (m ()) ~ u => LocImage u a -> m ()Source
InterpretUnit u => LocTraceM (LocTrace u) | |
(Monad m, InterpretUnit u) => LocTraceM (LocTraceT u m) | |
InterpretUnit u => LocTraceM (RefTrace u z) | |
InterpretUnit u => LocTraceM (GenPathSpec st u) | Note - location probably should return Point2 not Vec2 hence
this uses TODO - sort out LocTraceM class. |
(Monad m, InterpretUnit 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.
InterpretUnit u => LocForkTraceM (LocTrace u) | |
(LocTraceM m, InterpretUnit u) => LocForkTraceM (LocTraceT u m) |