@@ -753,18 +753,18 @@ predicateRestrictionFilter attrs (AtomExprPredicate atomExpr) = do
753753 --merge attrs into the state attributes
754754 rstate <- ask
755755 runExceptT $ do
756− aType <- liftE (typeFromAtomExpr attrs atomExpr)
756+ aType <- liftE (typeFromAtomExpr attrs atomExpr)
757757 if aType /= BoolAtomType then
758758 throwE (AtomTypeMismatchError aType BoolAtomType)
759759 else
760760 pure (\tupleIn ->
761− pure $ case runReader (evalAtomExpr tupleIn atomExpr) rstate of
762− Left _ -> False
763− Right boolAtomValue -> boolAtomValue == BoolAtom True)
761+ case runReader (evalAtomExpr tupleIn atomExpr) rstate of
762+ Left err -> Left err
763+ Right boolAtomValue -> pure (boolAtomValue == BoolAtom True))
764764
765765tupleExprCheckNewAttrName :: AttributeName -> Relation -> Either RelationalError Relation
766766tupleExprCheckNewAttrName attrName rel = if isRight (attributeForName attrName rel) then
767− Left (error "SPAMMIT" $ AttributeNameInUseError attrName)
767+ Left (AttributeNameInUseError attrName)
768768 else
769769 Right rel
770770
@@ -803,13 +803,15 @@ evalAtomExpr tupIn (FunctionAtomExpr funcName arguments ()) = do
803803 func <- either throwE pure (atomFunctionForName funcName functions)
804804 let expectedArgCount = length (atomFuncType func) - 1
805805 actualArgCount = length argTypes
806− safeInit [_] = []
807806 safeInit [] = [] -- different behavior from normal init
808− safeInit (_:xs) = safeInit xs
807+ safeInit xs = init xs
809808 if expectedArgCount /= actualArgCount then
810809 throwE (FunctionArgumentCountMismatchError expectedArgCount actualArgCount)
811810 else do
812− mapM_ (\(expType, actType) -> either throwE pure (atomTypeVerify expType actType)) (safeInit (zip (atomFuncType func) argTypes))
811+ let zippedArgs = zip (safeInit (atomFuncType func)) argTypes
812+ mapM_ (\(expType, eActType) -> do
813+ actType <- either throwE pure eActType
814+ either throwE pure (atomTypeVerify expType actType)) zippedArgs
813815 evaldArgs <- mapM (liftE . evalAtomExpr tupIn) arguments
814816 case evalAtomFunction func evaldArgs of
815817 Left err -> throwE (AtomFunctionUserError err)