Copyright | (c) 2015 Jeffrey Rosenbluth |
---|---|
License | BSD-style (see LICENSE) |
Maintainer | diagrams-discuss@googlegroups.com |
Safe Haskell | None |
Language | Haskell2010 |
Convenient creation of command-line-driven executables for rendering diagrams using the Html5 backend.
defaultMain
creates an executable which can render a single diagram at various options.multiMain
is likedefaultMain
but allows for a list of diagrams from which the user can choose one to render.mainWith
is a generic form that does all of the above but with a slightly scarier type. See Diagrams.Backend.CmdLine. This form can also take a function type that has a suitable final result (any of arguments to the above types) andParseable
arguments.
If you want to generate diagrams programmatically---i.e. if you want to do anything more complex than what the below functions provide---you have several options.
- Use a function with
mainWith
. This may require makingParseable
instances for custom argument types. - Make a new
Mainable
instance. This may require a newtype wrapper on your diagram type to avoid the existing instances. This gives you more control over argument parsing, intervening steps, and diagram creation. - Build option records and pass them along with a diagram to
mainRender
from Diagrams.Backend.CmdLine.
For a tutorial on command-line diagram creation see http://projects.haskell.org/diagrams/doc/cmdline.html.
General form of main
mainWith :: (Mainable d, Parseable (MainOpts d)) => d -> IO () #
Main entry point for command-line diagram creation. This is the method
that users will call from their program main
. For instance an expected
user program would take the following form.
import Diagrams.Prelude import Diagrams.Backend.TheBestBackend.CmdLine d :: Diagram B R2 d = ... main = mainWith d
Most backends should be able to use the default implementation. A different implementation should be used to handle more complex interactions with the user.
Supported froms of main
This data declaration is simply used as a token to distinguish this rendering engine.
Eq Html5 Source # | |
Ord Html5 Source # | |
Read Html5 Source # | |
Show Html5 Source # | |
Backend Html5 V2 Double Source # | |
Renderable (Text Double) Html5 Source # | |
Renderable (DImage Double External) Html5 Source # | |
Renderable (Path V2 Double) Html5 Source # | |
Renderable (Trail V2 Double) Html5 Source # | |
Monoid (Render Html5 V2 Double) Source # | |
Renderable (Segment Closed V2 Double) Html5 Source # | |
type V Html5 Source # | |
type N Html5 Source # | |
data Options Html5 V2 Double Source # | |
type Result Html5 V2 Double Source # | |
data Render Html5 V2 Double Source # | |
type MainOpts [(String, QDiagram Html5 V2 Double Any)] # | |
type MainOpts (QDiagram Html5 V2 Double Any) # | |