Safe Haskell | None |
---|---|

Language | Haskell98 |

- plot :: ToPlot p => EC (Layout x y) (p x y) -> EC (Layout x y) ()
- plotLeft :: ToPlot p => EC (LayoutLR x y1 y2) (p x y1) -> EC (LayoutLR x y1 y2) ()
- plotRight :: ToPlot p => EC (LayoutLR x y1 y2) (p x y2) -> EC (LayoutLR x y1 y2) ()
- takeColor :: EC l (AlphaColour Double)
- takeShape :: EC l PointShape
- data CState
- colors :: Lens' CState [AlphaColour Double]
- shapes :: Lens' CState [PointShape]
- type EC l a = StateT l (State CState) a
- execEC :: Default l => EC l a -> l
- liftEC :: Default l1 => EC l1 a -> EC l2 l1
- liftCState :: State CState a -> EC l a

# Documentation

plot :: ToPlot p => EC (Layout x y) (p x y) -> EC (Layout x y) () #

Add a plot to the `Layout`

being constructed.

plotLeft :: ToPlot p => EC (LayoutLR x y1 y2) (p x y1) -> EC (LayoutLR x y1 y2) () #

Add a plot against the left axis to the `LayoutLR`

being constructed.

plotRight :: ToPlot p => EC (LayoutLR x y1 y2) (p x y2) -> EC (LayoutLR x y1 y2) () #

Add a plot against the right axis tof the `LayoutLR`

being constructed.

takeColor :: EC l (AlphaColour Double) #

Pop and return the next color from the state

takeShape :: EC l PointShape #

Pop and return the next shape from the state

The state held when monadically constructing a graphical element

Default CState # | |

(Default a, ToRenderable a) => ToRenderable (EC a b) # | |

shapes :: Lens' CState [PointShape] #

type EC l a = StateT l (State CState) a #

We use nested State monads to give nice syntax. The outer state is the graphical element being constructed (typically a layout). The inner state contains any additional state reqired. This approach means that lenses and the state monad lens operators can be used directly on the value being constructed.

execEC :: Default l => EC l a -> l #

Run the monadic `EC`

computation, and return the graphical
element (ie the outer monad' state)