Copyright | (c) 2015 Diagrams team (see LICENSE) |
---|---|
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 PGF backend.
- mainWith :: (Mainable d, Parseable (MainOpts d)) => d -> IO ()
- defaultMain :: Diagram PGF -> IO ()
- mainWithSurf :: Surface -> Diagram PGF -> IO ()
- onlineMain :: OnlineTex (Diagram PGF) -> IO ()
- onlineMainWithSurf :: Surface -> OnlineTex (Diagram PGF) -> IO ()
- multiMain :: [(String, Diagram PGF)] -> IO ()
- module Diagrams.Backend.PGF
General form of main
The mainWith
method unifies all of the other forms of main
and is
now the recommended way to build a command-line diagrams program. It
works as a direct replacement for defaultMain
or multiMain
as well
as allowing more general arguments. For example, given a function that
produces a diagram when given an Int
and a
, Colour
DoublemainWith
will produce a program that looks for additional number and color arguments.
... definitions ... f :: Int -> Colour Double -> Diagram PGF f i c = ... main = mainWith f
We can run this program as follows:
$ ghc --make mydiagram # output image.tex built by `f 20 red` $ ./MyDiagram -o image.tex -w 200 20 red
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 forms of main
mainWithSurf :: Surface -> Diagram PGF -> IO () Source #
Allows you to pick a surface the diagram will be rendered with. (This
onlineMain :: OnlineTex (Diagram PGF) -> IO () Source #
Same as defaultMain
but takes an online pgf diagram.
onlineMainWithSurf :: Surface -> OnlineTex (Diagram PGF) -> IO () Source #
Same as mainWithSurf
but takes an online pgf diagram.
module Diagrams.Backend.PGF
Orphan instances
Parseable TexFormat Source # | |
ToResult d => ToResult (OnlineTex d) Source # | |
TypeableFloat n => Mainable [(String, QDiagram PGF V2 n Any)] Source # | |
TypeableFloat n => Mainable (OnlineTex (QDiagram PGF V2 n Any)) Source # | |
TypeableFloat n => Mainable (Surface, QDiagram PGF V2 n Any) Source # | |
TypeableFloat n => Mainable (Surface, OnlineTex (QDiagram PGF V2 n Any)) Source # | |
TypeableFloat n => Mainable (QDiagram PGF V2 n Any) Source # | |