check OpApp op exp1 exp2 funDef state isLeft checkExp1 checkExp1 isLef

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
check (OpApp op exp1 exp2) funDef state | isLeft checkExp1 = checkExp1
| isLeft checkExp2 = checkExp2
| otherwise = case op of
Index -> if((fromRight2 checkExp1/= TArrInt)&&(fromRight2 checkExp2/=TInt))
then Left(MismatchExtend TArrInt TInt (fromRight2 checkExp1) (fromRight2 checkExp2) (show (OpApp op exp1 exp2)))
else checkExp2
Equal -> if((fromRight2 checkExp1)/=(fromRight2 checkExp2))
then Left(MismatchExtend TArrInt TInt (fromRight2 checkExp1) (fromRight2 checkExp2) (show (OpApp op exp1 exp2)))
else checkExp2
_ -> if((fromRight2 checkExp1/= TInt)||(fromRight2 checkExp2/=TInt))
then Left(MismatchExtend TInt TInt (fromRight2 checkExp1) (fromRight2 checkExp2) (show (OpApp op exp1 exp2)))
else checkExp2
where
checkExp1 = check exp1 funDef state
checkExp2 = check exp2 funDef state