module LiveCoding.GHCi where
import Control.Concurrent
import Foreign.Store
import LiveCoding.LiveProgram
import LiveCoding.RuntimeIO
import LiveCoding.RuntimeIO.Launch
livelaunch _ = return $ unlines
[ "launchedProgram <- launch liveProgram"
, "save launchedProgram"
]
livestop _ = return "stop launchedProgram"
load :: Launchable m => LiveProgram m -> IO (LaunchedProgram m)
load _ = readStore $ Store 0
save :: Launchable m => LaunchedProgram m -> IO ()
save = writeStore $ Store 0
liveinit _ = return $ unlines
[ "programVar <- newMVar liveProgram"
, "threadId <- myThreadId"
, "save LaunchedProgram { .. }"
]
livereload _ = return $ unlines
[ ":reload"
, "launchedProgram <- load liveProgram"
, "update launchedProgram liveProgram"
]
livestep _ = return "stepLaunchedProgram launchedProgram"