@@ -29,7 +29,7 @@ testBasicAtomFunction = TestCase $ do
29 funcAtomExpr = FunctionAtomExpr "mkTest" [NakedAtomExpr (IntegerAtom 3)] ()
29 funcAtomExpr = FunctionAtomExpr "mkTest" [NakedAtomExpr (IntegerAtom 3)] ()
30 tupleExprs = [TupleExpr (M.singleton "x" funcAtomExpr)]
30 tupleExprs = [TupleExpr (M.singleton "x" funcAtomExpr)]
31 expectedResult = mkRelationFromList (V.fromList attrs) [[IntegerAtom 3]]
31 expectedResult = mkRelationFromList (V.fromList attrs) [[IntegerAtom 3]]
32− result <- executeRelationalExpr sess conn (MakeRelationFromExprs (Just (map NakedAttributeExpr attrs)) tupleExprs)
32+ result <- executeRelationalExpr sess conn (MakeRelationFromExprs (Just (map NakedAttributeExpr attrs)) (TupleExprs () tupleExprs))
34 assertEqual "simple atom function equality" expectedResult result
34 assertEqual "simple atom function equality" expectedResult result
@@ -40,7 +40,7 @@ testExceptionAtomFunction = TestCase $ do
40 executeTutorialD sess conn "addatomfunction \"mkTest\" Integer -> Either AtomFunctionError Integer \"\"\"(\\(IntegerAtom x:xs) -> (error (show 1))) :: [Atom] -> Either AtomFunctionError Atom\"\"\""
40 executeTutorialD sess conn "addatomfunction \"mkTest\" Integer -> Either AtomFunctionError Integer \"\"\"(\\(IntegerAtom x:xs) -> (error (show 1))) :: [Atom] -> Either AtomFunctionError Atom\"\"\""
41 let attrs = [Attribute "x" IntegerAtomType]
41 let attrs = [Attribute "x" IntegerAtomType]
42 funcAtomExpr = FunctionAtomExpr "mkTest" [NakedAtomExpr (IntegerAtom 3)] ()
42 funcAtomExpr = FunctionAtomExpr "mkTest" [NakedAtomExpr (IntegerAtom 3)] ()
43− tupleExprs = [TupleExpr (M.singleton "x" funcAtomExpr)]
43+ tupleExprs = TupleExprs () [TupleExpr (M.singleton "x" funcAtomExpr)]
44 result <- executeRelationalExpr sess conn (MakeRelationFromExprs (Just (map NakedAttributeExpr attrs)) tupleExprs)
44 result <- executeRelationalExpr sess conn (MakeRelationFromExprs (Just (map NakedAttributeExpr attrs)) tupleExprs)
45 assertBool "catch error exception from script" (case result of
45 assertBool "catch error exception from script" (case result of
46 Left (UnhandledExceptionError _) -> True
46 Left (UnhandledExceptionError _) -> True
@@ -57,7 +57,7 @@ testNoArgumentAtomFunction = TestCase $ do
57 executeTutorialD sess conn "addatomfunction \"mkTest\" Either AtomFunctionError Integer \"\"\"(\\x -> pure (IntegerAtom 5)) :: [Atom] -> Either AtomFunctionError Atom\"\"\""
57 executeTutorialD sess conn "addatomfunction \"mkTest\" Either AtomFunctionError Integer \"\"\"(\\x -> pure (IntegerAtom 5)) :: [Atom] -> Either AtomFunctionError Atom\"\"\""
58 let attrs = [Attribute "x" IntegerAtomType]
58 let attrs = [Attribute "x" IntegerAtomType]
59 funcAtomExpr = FunctionAtomExpr "mkTest" [] ()
59 funcAtomExpr = FunctionAtomExpr "mkTest" [] ()
60− tupleExprs = [TupleExpr (M.singleton "x" funcAtomExpr)]
60+ tupleExprs = TupleExprs () [TupleExpr (M.singleton "x" funcAtomExpr)]
61 expectedResult = mkRelationFromList (V.fromList attrs) [[IntegerAtom 5]]
61 expectedResult = mkRelationFromList (V.fromList attrs) [[IntegerAtom 5]]
62 result <- executeRelationalExpr sess conn (MakeRelationFromExprs (Just (map NakedAttributeExpr attrs)) tupleExprs)
62 result <- executeRelationalExpr sess conn (MakeRelationFromExprs (Just (map NakedAttributeExpr attrs)) tupleExprs)
63 assertEqual "no argument scripted function" expectedResult result
63 assertEqual "no argument scripted function" expectedResult result
@@ -66,7 +66,7 @@ testArgumentTypeMismatch :: Test
66testArgumentTypeMismatch = TestCase $ do
66testArgumentTypeMismatch = TestCase $ do
67 (sess, conn) <- dateExamplesConnection emptyNotificationCallback
67 (sess, conn) <- dateExamplesConnection emptyNotificationCallback
68 executeTutorialD sess conn "addatomfunction \"mkTest\" Integer -> Either AtomFunctionError Integer \"\"\"(\\(IntegerAtom x:_) -> pure $ TextAtom \"wrong type\") :: [Atom] -> Either AtomFunctionError Atom\"\"\""
68 executeTutorialD sess conn "addatomfunction \"mkTest\" Integer -> Either AtomFunctionError Integer \"\"\"(\\(IntegerAtom x:_) -> pure $ TextAtom \"wrong type\") :: [Atom] -> Either AtomFunctionError Atom\"\"\""
69− let tupleExprs = [TupleExpr (M.singleton "x" funcAtomExpr)]
69+ let tupleExprs = TupleExprs () [TupleExpr (M.singleton "x" funcAtomExpr)]
70 funcAtomExpr = FunctionAtomExpr "mkTest" [NakedAtomExpr (IntegerAtom 3)] ()
70 funcAtomExpr = FunctionAtomExpr "mkTest" [NakedAtomExpr (IntegerAtom 3)] ()
71 attrs = [Attribute "x" IntegerAtomType]
71 attrs = [Attribute "x" IntegerAtomType]
72 expectedResult = Left (AtomTypeMismatchError IntegerAtomType TextAtomType)
72 expectedResult = Left (AtomTypeMismatchError IntegerAtomType TextAtomType)
@@ -80,7 +80,7 @@ testPolymorphicReturnType = TestCase $ do
80 let funcAtomExpr = FunctionAtomExpr "fromMaybe" [NakedAtomExpr (IntegerAtom 5),
80 let funcAtomExpr = FunctionAtomExpr "fromMaybe" [NakedAtomExpr (IntegerAtom 5),
81 NakedAtomExpr maybeAtom] ()
81 NakedAtomExpr maybeAtom] ()
82 maybeAtom = ConstructedAtom "Just" (maybeAtomType IntegerAtomType) [IntegerAtom 3]
82 maybeAtom = ConstructedAtom "Just" (maybeAtomType IntegerAtomType) [IntegerAtom 3]
83− relExpr = MakeRelationFromExprs Nothing [TupleExpr (M.singleton "x" funcAtomExpr)]
83+ relExpr = MakeRelationFromExprs Nothing (TupleExprs () [TupleExpr (M.singleton "x" funcAtomExpr)])
84 mRelType <- typeForRelationalExpr sess conn relExpr
84 mRelType <- typeForRelationalExpr sess conn relExpr
85 case mRelType of
85 case mRelType of
86 Left err -> assertFailure (show err)
86 Left err -> assertFailure (show err)
@@ -94,7 +94,7 @@ testPolymorphicReturnType = TestCase $ do
94 let failFuncAtomExpr = FunctionAtomExpr "fromMaybe" [NakedAtomExpr (IntegerAtom 5),
94 let failFuncAtomExpr = FunctionAtomExpr "fromMaybe" [NakedAtomExpr (IntegerAtom 5),
95 NakedAtomExpr mismatchAtom] ()
95 NakedAtomExpr mismatchAtom] ()
96 mismatchAtom = ConstructedAtom "Just" (maybeAtomType TextAtomType) [TextAtom "fail"]
96 mismatchAtom = ConstructedAtom "Just" (maybeAtomType TextAtomType) [TextAtom "fail"]
97− failRelExpr = MakeRelationFromExprs Nothing [TupleExpr (M.singleton "x" failFuncAtomExpr)]
97+ failRelExpr = MakeRelationFromExprs Nothing (TupleExprs () [TupleExpr (M.singleton "x" failFuncAtomExpr)])
98 mFailRes <- executeRelationalExpr sess conn failRelExpr
98 mFailRes <- executeRelationalExpr sess conn failRelExpr
99 let expectedErr = Left (AtomFunctionTypeVariableMismatch "a" IntegerAtomType TextAtomType)
99 let expectedErr = Left (AtomFunctionTypeVariableMismatch "a" IntegerAtomType TextAtomType)
100 assertEqual "expected type variable mismatch" expectedErr mFailRes
100 assertEqual "expected type variable mismatch" expectedErr mFailRes
@@ -106,9 +106,9 @@ testScriptedTypeVariable = TestCase $ do
106 executeTutorialD sess conn "addatomfunction \"idTest\" a -> Either AtomFunctionError a \"(\\\\(x:_) -> pure x) :: [Atom] -> Either AtomFunctionError Atom\""
106 executeTutorialD sess conn "addatomfunction \"idTest\" a -> Either AtomFunctionError a \"(\\\\(x:_) -> pure x) :: [Atom] -> Either AtomFunctionError Atom\""
107 let attrs = [Attribute "x" IntegerAtomType]
107 let attrs = [Attribute "x" IntegerAtomType]
108 funcAtomExpr = FunctionAtomExpr "idTest" [NakedAtomExpr (IntegerAtom 3)] ()
108 funcAtomExpr = FunctionAtomExpr "idTest" [NakedAtomExpr (IntegerAtom 3)] ()
109− tupleExprs = [TupleExpr (M.singleton "x" funcAtomExpr)]
109+ tupleExprs = TupleExprs () [TupleExpr (M.singleton "x" funcAtomExpr)]
110 expectedResult = mkRelationFromList (V.fromList attrs) [[IntegerAtom 3]]
110 expectedResult = mkRelationFromList (V.fromList attrs) [[IntegerAtom 3]]
111 result <- executeRelationalExpr sess conn (MakeRelationFromExprs (Just (map NakedAttributeExpr attrs)) tupleExprs)
111 result <- executeRelationalExpr sess conn (MakeRelationFromExprs (Just (map NakedAttributeExpr attrs)) tupleExprs)
113 assertEqual "id function equality" expectedResult result
113 assertEqual "id function equality" expectedResult result