-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | A live recompiler -- -- Live recompiler for Haskell -- -- -- Usage: -- --
--   halive path/to/myfile.hs [optionally any/extra include/dirs ..] -- [args to app]
--   
-- -- See README @package halive @version 0.1.3 module Halive.Utils isHaliveActive :: MonadIO m => m Bool -- | Takes a unique integer representing your value, along with an IO -- action to create the first instance of your value to be used on -- subsequent recompilations. reacquire :: forall a m. (MonadIO m) => Word32 -> m a -> m a persist :: MonadIO m => Word32 -> a -> m () persistState :: (MonadState s m, MonadIO m) => Word32 -> m () module Halive.FindPackageDBs -- | Extract the sandbox package db directory from the cabal.sandbox.config -- file. Exception is thrown if the sandbox config file is broken. extractKey :: String -> String -> Maybe FilePath mightExist :: FilePath -> IO (Maybe FilePath) addExtraPkgConfs :: DynFlags -> [FilePath] -> DynFlags -- | Get path to sandbox's package DB via the cabal.sandbox.config file getSandboxDb :: IO (Maybe FilePath) updateDynFlagsWithCabalSandbox :: MonadIO m => DynFlags -> m DynFlags -- | Get path to the project's snapshot and local package DBs via 'stack -- path' getStackDb :: IO (Maybe [FilePath]) updateDynFlagsWithStackDB :: MonadIO m => DynFlags -> m DynFlags updateDynFlagsWithGlobalDB :: MonadIO m => DynFlags -> m DynFlags module Halive.SubHalive data FixDebounce DebounceFix :: FixDebounce NoDebounceFix :: FixDebounce data CompliationMode Interpreted :: CompliationMode Compiled :: CompliationMode data GHCSessionConfig GHCSessionConfig :: FixDebounce -> [FilePath] -> [FilePath] -> FilePath -> [Extension] -> CompliationMode -> Maybe (FilePath, String) -> Int -> Maybe ThreadId -> GHCSessionConfig [gscFixDebounce] :: GHCSessionConfig -> FixDebounce [gscImportPaths] :: GHCSessionConfig -> [FilePath] [gscPackageDBs] :: GHCSessionConfig -> [FilePath] [gscLibDir] :: GHCSessionConfig -> FilePath [gscLanguageExtensions] :: GHCSessionConfig -> [Extension] [gscCompilationMode] :: GHCSessionConfig -> CompliationMode -- | Allow API users to block until a given file is compiled, to work -- around a bug where the GHC API crashes while loading libraries if the -- main thread is doing work (possibly due to accessing said libraries in -- some way) [gscStartupFile] :: GHCSessionConfig -> Maybe (FilePath, String) [gscVerbosity] :: GHCSessionConfig -> Int [gscMainThreadID] :: GHCSessionConfig -> Maybe ThreadId defaultGHCSessionConfig :: GHCSessionConfig logIO :: MonadIO m => String -> m () withGHCSession :: ThreadId -> GHCSessionConfig -> Ghc a -> IO a gatherErrors :: GhcMonad m => SourceError -> m [String] newtype CompiledValue CompiledValue :: Dynamic -> CompiledValue getCompiledValue :: Typeable a => CompiledValue -> Maybe a fileContentsStringToBuffer :: (MonadIO m) => Maybe String -> m (Maybe (StringBuffer, UTCTime)) -- | We return the uncoerced HValue, which lets us send polymorphic values -- back through channels recompileExpressionInFile :: FilePath -> Maybe String -> String -> Ghc (Either [String] CompiledValue) catchExceptions :: ExceptionMonad m => m (Either [String] a) -> m (Either [String] a) -- | Outputs any value that can be pretty-printed using the default style output :: (GhcMonad m, Outputable a) => a -> m () logHandler :: IORef String -> LogAction instance GHC.Show.Show Halive.SubHalive.CompiledValue instance GHC.Classes.Eq Halive.SubHalive.CompliationMode instance GHC.Classes.Eq Halive.SubHalive.FixDebounce module Halive.FileListener type FileEventChan = TChan Event data ShouldReadFile ReadFileOnEvents :: ShouldReadFile JustReportEvents :: ShouldReadFile data FileEventListener FileEventListener :: TChan (Either Event String) -> TVar (Maybe UTCTime) -> MVar () -> FileEventListener [felEventTChan] :: FileEventListener -> TChan (Either Event String) [felIgnoreNextEventsNear] :: FileEventListener -> TVar (Maybe UTCTime) [felStopMVar] :: FileEventListener -> MVar () atomicallyIO :: MonadIO m => STM a -> m a readTChanIO :: MonadIO m => TChan a -> m a writeTChanIO :: MonadIO m => TChan a -> a -> m () tryReadTChanIO :: MonadIO m => TChan a -> m (Maybe a) fileModifiedPredicate :: FilePath -> Event -> Bool eventListenerForFile :: MonadIO m => FilePath -> ShouldReadFile -> m FileEventListener eventListenerForDirectory :: MonadIO m => FilePath -> [String] -> m FileEventListener killFileEventListener :: MonadIO m => FileEventListener -> m () modifiedWithExtensionPredicate :: [String] -> Event -> Bool forkDirectoryListenerThread :: FilePath -> [String] -> TChan (Either Event String) -> IO (MVar ()) forkFileListenerThread :: FilePath -> ShouldReadFile -> TChan (Either Event String) -> TVar (Maybe UTCTime) -> IO (MVar ()) setIgnoreTimeNow :: MonadIO m => FileEventListener -> m () setIgnoreTime :: MonadIO m => FileEventListener -> UTCTime -> m () readFileEvent :: MonadIO m => FileEventListener -> m (Either Event String) onFileEvent :: MonadIO m => FileEventListener -> m () -> m () onTChanRead :: MonadIO m => TChan a -> m () -> m () -- | Creates a getter for a set of resources that will be rebuilt whenever -- the file changes. Takes a filename and an action to create a resource -- based on that file. getWatchedResource <- makeWatchedResource -- "resources/shapes.frag" $ do shader <- createShaderProgram -- "resourcesshapes.vert" "resourcesshapes.frag" useProgram shader -- -- uTime <- getShaderUniform shader "uTime" -- -- (quadVAO, quadVertCount) <- makeScreenSpaceQuad shader return -- (quadVAO, quadVertCount, uTime) Then use (quadVAO, quadVertCount, -- uResolution, uMouse, uTime) <- getWatchedResource in main loop makeWatchedResource :: FilePath -> IO a -> IO (IO a) instance GHC.Show.Show Halive.FileListener.ShouldReadFile instance GHC.Classes.Eq Halive.FileListener.ShouldReadFile module Halive.Recompiler data CompilationRequest CompilationRequest :: FilePath -> String -> TChan CompilationResult -> Maybe String -> CompilationRequest [crFilePath] :: CompilationRequest -> FilePath [crExpressionString] :: CompilationRequest -> String [crResultTChan] :: CompilationRequest -> TChan CompilationResult -- | This is intentionally lazy, since we want to evaluate the string on -- the SubHalive thread (as it may be e.g. a TextSeq that needs -- conversion) In the future, we may want to pass GHC's StringBuffer type -- here instead, and construct those in a smarter way. [crFileContents] :: CompilationRequest -> Maybe String type CompilationResult = Either [String] CompiledValue withGHC :: MonadIO m => GHCSessionConfig -> (TChan CompilationRequest -> m b) -> m b startGHC :: MonadIO m => GHCSessionConfig -> m (TChan CompilationRequest) data Recompiler Recompiler :: TChan CompilationResult -> FileEventListener -> ThreadId -> Recompiler [recResultTChan] :: Recompiler -> TChan CompilationResult [recFileEventListener] :: Recompiler -> FileEventListener [recListenerThread] :: Recompiler -> ThreadId recompilerForExpression :: MonadIO m => TChan CompilationRequest -> FilePath -> String -> Bool -> m Recompiler data RecompilerConfig RecompilerConfig :: Maybe (FilePath, [String]) -> String -> FilePath -> Bool -> RecompilerConfig [rccWatchAll] :: RecompilerConfig -> Maybe (FilePath, [String]) [rccExpression] :: RecompilerConfig -> String [rccFilePath] :: RecompilerConfig -> FilePath [rccCompileImmediately] :: RecompilerConfig -> Bool recompilerWithConfig :: MonadIO m => TChan CompilationRequest -> RecompilerConfig -> m Recompiler killRecompiler :: MonadIO m => Recompiler -> m () renameRecompilerForExpression :: MonadIO m => Recompiler -> TChan CompilationRequest -> FilePath -> String -> m Recompiler module Halive.Concurrent -- | Kill all threads registered to be killed. Meant to be called at the -- beginning of your program to clean up threads from the last execution -- before continuing killThreads :: IO () -- | Register a thread to be killed when killThreads is called registerThread :: ThreadId -> IO () -- | Fork a thread and register it to be killed when killThreads is called forkIO' :: IO () -> IO ThreadId -- | Fork an OS thread and register it to be killed when killThreads is -- called forkOS' :: IO () -> IO ThreadId