How to add command line parameters to a diagrams animation?

80 Views Asked by At

With "image" diagrams I can just pass a function that expects parameters (here pDiag) to mainWith and append neccessary parameters to the command like so:
stack exec circle-diagram-exe -- -o circle.png -w 800 9

module DiagramsWithParameters where

import Diagrams.Prelude
import Diagrams.Backend.Cairo.CmdLine

--main = mainWith pDiag
main = mainWith pAnimation

pDiag :: Double -> Diagram B
pDiag d = circle d # fc gold

pAnimation :: Int -> [(Diagram B, Int)]
pAnimation r = replicate r ((circle 0.95 # fc gold), 1)

However with animations I cannot even build:

    • No instance for (Diagrams.Backend.CmdLine.ToResult
                         [(QDiagram B V2 Double Any, Int)])
        arising from a use of ‘mainWith’
    • In the expression: mainWith pAnimation
      In an equation for ‘main’: main = mainWith pAnimation
  |
7 | main = mainWith pAnimation
  |        ^^^^^^^^^^^^^^^^^^^

How can I support command line arguments for my animations?

0

There are 0 best solutions below