uebung2017_2/.ghci

30 lines
1.4 KiB
Plaintext
Raw Normal View History

2017-04-30 21:33:56 +00:00
: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) }
:set -fobject-code