-
Notifications
You must be signed in to change notification settings - Fork 20
/
ghci
26 lines (22 loc) · 1.35 KB
/
ghci
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
:def vis \_ -> return $ "GHC.Vis.vis"
:def mvis \_ -> return $ "GHC.Vis.mvis"
:def svis \_ -> return $ "GHC.Vis.svis"
:def view \x -> return $ "GHC.Vis.view (" ++ x ++ ") " ++ show x
:def eval \x -> return $ "GHC.Vis.eval \"" ++ x ++ "\""
:def switch \_ -> return $ "GHC.Vis.switch"
:def update \_ -> return $ "GHC.Vis.update"
:def clear \_ -> return $ "GHC.Vis.clear"
:def restore \_ -> return $ "GHC.Vis.restore"
:def timeBack \_ -> return $ "GHC.Vis.history (+1)"
:def timeForward \_ -> return $ "GHC.Vis.history (\\x -> x - 1)"
:def export \x -> return $ "GHC.Vis.export " ++ show x
:def setDepth \x -> return $ "GHC.Vis.setDepth (" ++ x ++ ")"
-- Evaluate one step and update values in ghc-vis
:def su \x -> return $ ":step " ++ x ++ "\n:update"
-- Continue to next breakpoint and update values in ghc-vis
:def cu \_ -> return $ ":continue\n:update"
-- Keep evaluating and updating on any key pressed, quit with q
:def asu \x -> getChar >>= \c -> case c of { 'q' -> return ""; _ -> return $ ":step " ++ x ++ "\n:update\n:asu" }
-- :tsu t x
-- Evaluate one step of expression x every t seconds until any key is pressed
:def tsu \x -> (System.Timeout.timeout (round $ 1000000 * (read . head $ words x :: Double)) getChar) >>= \c -> case c of { Just _ -> return ""; _ -> return $ ":step " ++ (unwords . tail $ words x) ++ "\n:update\n:tsu " ++ (head $ words x) }