# Pastebin oFaoUzPE compileHaskellSourceCode :: String -> IO (Either String String) compileHaskellSourceCode source = do let fileName = "temp.hs" writeFile fileName source result <- runExceptT $ do let args = ["ghc", fileName] (exitCode, stdout, stderr) <- liftIO $ readProcessWithExitCode "ghc" args "" case exitCode of ExitSuccess -> return stdout ExitFailure _ -> throwError stderr removeFile fileName return result