futhark-server 1.0.0.0 → 1.1.0.0
raw patch · 3 files changed
+40/−8 lines, 3 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
+ Futhark.Server: InputType :: Bool -> TypeName -> InputType
+ Futhark.Server: OutputType :: Bool -> TypeName -> OutputType
+ Futhark.Server: [inputConsumed] :: InputType -> Bool
+ Futhark.Server: [inputType] :: InputType -> TypeName
+ Futhark.Server: [outputType] :: OutputType -> TypeName
+ Futhark.Server: [outputUnique] :: OutputType -> Bool
+ Futhark.Server: data InputType
+ Futhark.Server: data OutputType
- Futhark.Server: cmdInputs :: Server -> EntryName -> IO (Either CmdFailure [TypeName])
+ Futhark.Server: cmdInputs :: Server -> EntryName -> IO (Either CmdFailure [InputType])
- Futhark.Server: cmdOutputs :: Server -> EntryName -> IO (Either CmdFailure [TypeName])
+ Futhark.Server: cmdOutputs :: Server -> EntryName -> IO (Either CmdFailure [OutputType])
Files
- CHANGELOG.md +7/−1
- futhark-server.cabal +1/−1
- src/Futhark/Server.hs +32/−6
CHANGELOG.md view
@@ -1,5 +1,11 @@ # Revision history for futhark-server -## 0.1.0.0 -- 2021-06-17+## 1.1.0.0 -- 2021-07-01++* `cmdInputs` and `cmdOutputs` now return `InputType` and `OutputType`+ values instead of just `TypeName`, in order to also capture+ consumption information.++## 1.0.0.0 -- 2021-06-17 * First version. Released on an unsuspecting world.
futhark-server.cabal view
@@ -1,6 +1,6 @@ cabal-version: 2.4 name: futhark-server-version: 1.0.0.0+version: 1.1.0.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
@@ -24,6 +24,8 @@ VarName, TypeName, EntryName,+ InputType (..),+ OutputType (..), cmdRestore, cmdStore, cmdCall,@@ -218,6 +220,30 @@ -- | The name of an entry point. type EntryName = Text +-- | The type of an input of an entry point. If 'inputConsumed', then+-- the value passed in a 'cmdCall' must not be used again (nor any of+-- its aliases).+data InputType = InputType+ { inputConsumed :: Bool,+ inputType :: TypeName+ }++-- | The type of an output of an entry point. If 'outputUnique', then+-- the value returned does not alias any of the inputs. See the+-- Futhark language manual itself for more details - the implications+-- are quite subtle (but you can ignore them unless you manually use+-- type annotations to make some entry point parameters unique).+data OutputType = OutputType+ { outputUnique :: Bool,+ outputType :: TypeName+ }++inOutType :: (Bool -> TypeName -> a) -> Text -> a+inOutType f t =+ case T.uncons t of+ Just ('*', t') -> f True t'+ _ -> f False t+ helpCmd :: Server -> [Text] -> IO (Maybe CmdFailure) helpCmd s cmd = either Just (const Nothing) <$> sendCommand s cmd@@ -245,15 +271,15 @@ cmdRename :: Server -> VarName -> VarName -> IO (Maybe CmdFailure) cmdRename s oldname newname = helpCmd s ["rename", oldname, newname] --- | @inputs entryname@-cmdInputs :: Server -> EntryName -> IO (Either CmdFailure [TypeName])+-- | @inputs entryname@, with uniqueness represented as True.+cmdInputs :: Server -> EntryName -> IO (Either CmdFailure [InputType]) cmdInputs s entry =- sendCommand s ["inputs", entry]+ fmap (map (inOutType InputType)) <$> sendCommand s ["inputs", entry] --- | @outputs entryname@-cmdOutputs :: Server -> EntryName -> IO (Either CmdFailure [TypeName])+-- | @outputs entryname@, with uniqueness represented as True.+cmdOutputs :: Server -> EntryName -> IO (Either CmdFailure [OutputType]) cmdOutputs s entry =- sendCommand s ["outputs", entry]+ fmap (map (inOutType OutputType)) <$> sendCommand s ["outputs", entry] -- | @clear@ cmdClear :: Server -> IO (Maybe CmdFailure)