使用“图像”图表,我可以只传递一个期望参数(此处pDiag
)的函数,mainWith
并将必要的参数附加到命令中,如下所示:
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)
但是,我什至无法构建动画:
• 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
| ^^^^^^^^^^^^^^^^^^^
如何支持动画的命令行参数?