@@ -753,18 +753,18 @@ predicateRestrictionFilter attrs (AtomExprPredicate atomExpr) = do
753 --merge attrs into the state attributes
753 --merge attrs into the state attributes
754 rstate <- ask
754 rstate <- ask
755 runExceptT $ do
755 runExceptT $ do
756− aType <- liftE (typeFromAtomExpr attrs atomExpr)
756+ aType <- liftE (typeFromAtomExpr attrs atomExpr)
757 if aType /= BoolAtomType then
757 if aType /= BoolAtomType then
758 throwE (AtomTypeMismatchError aType BoolAtomType)
758 throwE (AtomTypeMismatchError aType BoolAtomType)
760 pure (\tupleIn ->
760 pure (\tupleIn ->
761− pure $ case runReader (evalAtomExpr tupleIn atomExpr) rstate of
761+ case runReader (evalAtomExpr tupleIn atomExpr) rstate of
762− Left _ -> False
762+ Left err -> Left err
763− Right boolAtomValue -> boolAtomValue == BoolAtom True)
763+ Right boolAtomValue -> pure (boolAtomValue == BoolAtom True))
765tupleExprCheckNewAttrName :: AttributeName -> Relation -> Either RelationalError Relation
765tupleExprCheckNewAttrName :: AttributeName -> Relation -> Either RelationalError Relation
766tupleExprCheckNewAttrName attrName rel = if isRight (attributeForName attrName rel) then
766tupleExprCheckNewAttrName attrName rel = if isRight (attributeForName attrName rel) then
767− Left (error "SPAMMIT" $ AttributeNameInUseError attrName)
767+ Left (AttributeNameInUseError attrName)
769 Right rel
769 Right rel
@@ -803,13 +803,15 @@ evalAtomExpr tupIn (FunctionAtomExpr funcName arguments ()) = do
803 func <- either throwE pure (atomFunctionForName funcName functions)
803 func <- either throwE pure (atomFunctionForName funcName functions)
804 let expectedArgCount = length (atomFuncType func) - 1
804 let expectedArgCount = length (atomFuncType func) - 1
805 actualArgCount = length argTypes
805 actualArgCount = length argTypes
807 safeInit [] = [] -- different behavior from normal init
806 safeInit [] = [] -- different behavior from normal init
808− safeInit (_:xs) = safeInit xs
807+ safeInit xs = init xs
809 if expectedArgCount /= actualArgCount then
808 if expectedArgCount /= actualArgCount then
810 throwE (FunctionArgumentCountMismatchError expectedArgCount actualArgCount)
809 throwE (FunctionArgumentCountMismatchError expectedArgCount actualArgCount)
811+ let zippedArgs = zip (safeInit (atomFuncType func)) argTypes
812+ mapM_ (\(expType, eActType) -> do
813+ actType <- either throwE pure eActType
812− mapM_ (\(expType, actType) -> either throwE pure (atomTypeVerify expType actType)) (safeInit (zip (atomFuncType func) argTypes))
814+ either throwE pure (atomTypeVerify expType actType)) zippedArgs
813 evaldArgs <- mapM (liftE . evalAtomExpr tupIn) arguments
815 evaldArgs <- mapM (liftE . evalAtomExpr tupIn) arguments
814 case evalAtomFunction func evaldArgs of
816 case evalAtomFunction func evaldArgs of
815 Left err -> throwE (AtomFunctionUserError err)
817 Left err -> throwE (AtomFunctionUserError err)