下一个简单的代码在GHCi中可以正常工作(显示带有图形的窗口),但是在GHC中编译后,当从命令行运行它时,什么也没有发生。为什么会这样呢?
import Graphics.Gnuplot.Simple
main :: IO ()
main = do
plotFunc [] (linearScale 1000 (-10.0::Double,10.0)) (\x -> x^2)
Run Code Online (Sandbox Code Playgroud)
GHC 8.2.2 gnuplot 0.5.5.1
打开窗口后不要立即退出程序,因为那样会关闭它。
例如,等待用户:
import Graphics.Gnuplot.Simple
main :: IO ()
main = do
plotFunc [] (linearScale 1000 (-10.0::Double,10.0)) (\x -> x^2)
putStrLn "Press enter to exit."
getLine
return ()
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
65 次 |
| 最近记录: |