我一直在尝试使用Haskell来运行一个简单的生产过程。像许多生产过程一样,它涉及到在各个地方改变事物的状态。因此,对于我来说,有一个可以跟踪事物并选择性地将命令运行到交互式Haskell中的脚本文件将非常方便,类似于:
-- to start the process
process <- startProcess
-- to stop process
stopProcess
-- to check how things are going
summary <- checkStuff
summary
-- optionally restart bad processes
restartProcesses (getBadProcesses summary)
-- send summary emails
sendSummaryEmails summary ["abunch@ofemails.com", "thatIwould@rather.com",
"nothaveto@keep.com" "typing@out.com",
"orcopy@pasting.com"]
-- set up something big that I don't want to have to retype/paste every time
studentGrades <- getStudentGrades "John Peterson"
gen <- getStdGen
let (randomTest, gen') = generateRandomTest studentGrades gen
compilePdf randomTest
answers <- getAnswers
gradeTest randomTest answers "John Peterson"
如果像R中的ESS (Emacs speaks statistics)一样,你可以按下一个按钮将这些行发送到repl进程,那就太棒了。也许有单独的按钮用于行、段落和区域。这方面是否已经有了解决方法?
例如,在ESS中,C-Ret
发送行,C-c C-c
发送段落,C-c C-r
发送区域。
C-Ret
) 来完成这个过程比手动输入(10-60 个按键)快上一个数量级,比在 Emacs 中复制粘贴高效 5 倍左右(大约 5 个按键)。 - Mike Flynn:e
或者自己在.ghci
中创建一个命令来帮助即时编辑。 - MarLinn