packages feed

futhark-server 1.2.2.1 → 1.2.3.0

raw patch · 4 files changed

+23/−7 lines, 4 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

+ Futhark.Server: abortServer :: Server -> IO ()

Files

CHANGELOG.md view
@@ -1,5 +1,9 @@ # Revision history for futhark-server +## 1.2.3.0 -- 2024-10-25++* Add `abortServer`.+ ## 1.2.2.1 -- 2023-03-21  * Support GHC 9.6.
futhark-server.cabal view
@@ -1,6 +1,6 @@ cabal-version:      2.4 name:               futhark-server-version:            1.2.2.1+version:            1.2.3.0 synopsis: Client implementation of the Futhark server protocol.  description: Provides an easy way to interact with a running Futhark
src/Futhark/Server.hs view
@@ -1,5 +1,6 @@ {-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE OverloadedStrings #-}+{-# LANGUAGE StrictData #-}  -- | Haskell code for interacting with a Futhark server program.  This -- module presents a low-level interface.  See@@ -66,13 +67,14 @@     -- * Raw     startServer,     stopServer,+    abortServer,     sendCommand,   ) where  import Control.Exception import Control.Monad-import Control.Monad.Except+import Control.Monad.Except (MonadError (..)) import Control.Monad.IO.Class (MonadIO, liftIO) import Data.Text (Text) import qualified Data.Text as T@@ -106,7 +108,7 @@     cfgProgOpts :: [String],     -- | If true, print a running log of server communication to stderr.     cfgDebug :: Bool,-    -- | A function that is invoked on every line of input sent by the+    -- | A function that is invoked on every line of output sent by the     -- server, except the @%%% OK@ and @%%% FAILURE@ prompts.  This     -- can be used to e.g. print or gather logging messages as they     -- arrive, instead of waiting for the command to finish.  The name@@ -147,7 +149,9 @@   case code of     Just (ExitFailure e) ->       error $ "Cannot start " ++ prog ++ ": error " ++ show e-    _ -> do+    Just ExitSuccess ->+      error $ "Cannot start " ++ prog ++ ": terminated immediately, but reported success."+    Nothing -> do       let server =             Server               { serverStdin = stdin,@@ -186,6 +190,12 @@       stderr_s <- readFile $ serverErrLog s       error stderr_s +-- | Terminate the server process.  You'll still need to call+-- 'stopServer' unless used inside 'withServer', which does it for+-- you.+abortServer :: Server -> IO ()+abortServer = P.terminateProcess . serverProc+ -- | Start a server, execute an action, then shut down the server. -- The 'Server' may not be returned from the action. withServer :: ServerCfg -> (Server -> IO a) -> IO a@@ -263,7 +273,8 @@             case code of               Just (ExitFailure x) ->                 "\nServer process exited unexpectedly with exit code: " ++ show x-              _ -> mempty+              Just ExitSuccess -> mempty+              Nothing -> mempty       stderr_s <- readFile $ serverErrLog s       error $         "After sending command "@@ -305,7 +316,8 @@ inOutType f t =   case T.uncons t of     Just ('*', t') -> f True t'-    _ -> f False t+    Just _ -> f False t+    Nothing -> f False t  helpCmd :: Server -> Cmd -> [Text] -> IO (Maybe CmdFailure) helpCmd s cmd args =
src/Futhark/Server/Values.hs view
@@ -1,6 +1,6 @@ {-# LANGUAGE OverloadedStrings #-} --- | Convenience functions builds on top of "Futhark.Data" and+-- | Convenience functions built on top of "Futhark.Data" and -- "Futhark.Server" for passing non-opaque values in and out of a -- server instance. module Futhark.Server.Values (getValue, putValue) where