"org.simantics.pythonlink.PythonContext"\r
\r
class PythonCompatible a where\r
- setPythonVariable :: String -> a -> <Python, Proc> ()\r
- getPythonVariable :: String -> <Python, Proc> a\r
+ setPythonVariable :: String -> a -> <Python> ()\r
+ getPythonVariable :: String -> <Python> a\r
\r
importJava "org.simantics.pythonlink.NDArray" where\r
data NDArray\r
instance Show NDArray where\r
show = ndarrayToString\r
\r
+instance Eq NDArray where\r
+ (==) = ndarrayEquals\r
+\r
importJava "org.simantics.pythonlink.PythonContext" where\r
data PythonContext\r
\r
@JavaName close\r
closePythonContext :: PythonContext -> <Proc> ()\r
\r
- executePythonStatement :: String -> <Python, Proc> ()\r
+ executePythonStatement :: String -> <Python> ()\r
\r
- setPythonIntegerVariable :: String -> Integer -> <Python, Proc> ()\r
- setPythonIntegerArrayVariable :: String -> Vector Integer -> <Python, Proc> ()\r
- setPythonDoubleVariable :: String -> Double -> <Python, Proc> ()\r
- setPythonDoubleArrayVariable :: String -> Vector Double -> <Python, Proc> ()\r
- setPythonStringVariable :: String -> String -> <Python, Proc> ()\r
- setPythonStringArrayVariable :: String -> Vector String -> <Python, Proc> ()\r
- setPythonNDArrayVariable :: String -> NDArray -> <Python, Proc> ()\r
+ setPythonIntegerVariable :: String -> Integer -> <Python> ()\r
+ setPythonIntegerArrayVariable :: String -> Vector Integer -> <Python> ()\r
+ setPythonDoubleVariable :: String -> Double -> <Python> ()\r
+ setPythonDoubleArrayVariable :: String -> Vector Double -> <Python> ()\r
+ setPythonStringVariable :: String -> String -> <Python> ()\r
+ setPythonStringArrayVariable :: String -> Vector String -> <Python> ()\r
+ setPythonNDArrayVariable :: String -> NDArray -> <Python> ()\r
\r
- getPythonIntegerVariable :: String -> <Python, Proc> Integer\r
- getPythonIntegerArrayVariable :: String -> <Python, Proc> Vector Integer\r
- getPythonDoubleVariable :: String -> <Python, Proc> Double\r
- getPythonDoubleArrayVariable :: String -> <Python, Proc> Vector Double\r
- getPythonStringVariable :: String -> <Python, Proc> String\r
- getPythonStringArrayVariable :: String -> <Python, Proc> Vector String\r
- getPythonNDArrayVariable :: String -> <Python, Proc> NDArray\r
+ getPythonIntegerVariable :: String -> <Python> Integer\r
+ getPythonIntegerArrayVariable :: String -> <Python> Vector Integer\r
+ getPythonDoubleVariable :: String -> <Python> Double\r
+ getPythonDoubleArrayVariable :: String -> <Python> Vector Double\r
+ getPythonStringVariable :: String -> <Python> String\r
+ getPythonStringArrayVariable :: String -> <Python> Vector String\r
+ getPythonNDArrayVariable :: String -> <Python> NDArray\r
\r
importJava "org.simantics.pythonlink.Python" where\r
- openPythonContext :: () -> <Proc> PythonContext\r
+ openPythonContext :: <Proc> PythonContext\r
\r
- runPythonF :: (() -> <Python, Proc> a) -> <Proc> a\r
- runWithPythonContextF :: PythonContext -> (() -> <Python, Proc> a) -> <Proc> a\r
+ runPythonF :: (() -> <Python, e> a) -> <Proc, e> a\r
+ runWithPythonContextF :: PythonContext -> (() -> <Python, e> a) -> <Proc, e> a\r
\r
-runPython :: (<Python, Proc> a) -> <Proc> a\r
+runPython :: (<Python, e> a) -> <Proc, e> a\r
runPython v = runPythonF (\_ -> v)\r
\r
-runWithPythonContext :: PythonContext -> (<Python, Proc> a) -> <Proc> a\r
+runWithPythonContext :: PythonContext -> (<Python, e> a) -> <Proc, e> a\r
runWithPythonContext python v = runWithPythonContextF python (\_ -> v) \r
\r
+instance (VecComp a, PythonCompatible (Vector a)) => PythonCompatible [a] where\r
+ setPythonVariable n v = setPythonVariable n (vector v)\r
+ getPythonVariable = vectorToList . getPythonVariable\r
+ \r
instance PythonCompatible Double where\r
setPythonVariable = setPythonDoubleVariable\r
getPythonVariable = getPythonDoubleVariable\r
instance PythonCompatible (Vector Double) where\r
setPythonVariable = setPythonDoubleArrayVariable\r
getPythonVariable = getPythonDoubleArrayVariable\r
- \r
+\r
instance PythonCompatible Integer where\r
setPythonVariable = setPythonIntegerVariable\r
getPythonVariable = getPythonIntegerVariable\r