@@ -706,8 +706,9 @@ unops :: Type -> NUnaryOp -> [Constraint]
706706unops u1 op =
707707 [ EqConst u1
708708 (case op of
709- NNot -> typeFun [typeBool , typeBool ]
710- NNeg -> TMany [typeFun [typeInt, typeInt], typeFun [typeFloat, typeFloat]]
709+ NNot -> typeFun $ typeBool :| [typeBool]
710+ NNeg -> TMany [ typeFun $ typeInt :| [typeInt]
711+ , typeFun $ typeFloat :| [typeFloat] ]
711712 )
712713 ]
713714
@@ -727,46 +728,46 @@ binops u1 op =
727728
728729 where
729730
730- gate = eqCnst [ typeBool, typeBool, typeBool]
731- concatenation = eqCnst [ typeList, typeList, typeList]
731+ gate = eqCnst $ typeBool :| [ typeBool, typeBool]
732+ concatenation = eqCnst $ typeList :| [ typeList, typeList]
732733
733- eqCnst l = [EqConst u1 $ typeFun l ]
734+ eqCnst ne = [EqConst u1 $ typeFun ne ]
734735
735736 inequality =
736737 eqCnstMtx
737- [ [ typeInt , typeInt , typeBool]
738- , [ typeFloat, typeFloat, typeBool]
739- , [ typeInt , typeFloat, typeBool]
740- , [ typeFloat, typeInt , typeBool]
738+ [ typeInt :| [ typeInt , typeBool]
739+ , typeFloat :| [ typeFloat, typeBool]
740+ , typeInt :| [ typeFloat, typeBool]
741+ , typeFloat :| [ typeInt , typeBool]
741742 ]
742743
743744 arithmetic =
744745 eqCnstMtx
745- [ [ typeInt , typeInt , typeInt ]
746- , [ typeFloat, typeFloat, typeFloat]
747- , [ typeInt , typeFloat, typeFloat]
748- , [ typeFloat, typeInt , typeFloat]
746+ [ typeInt :| [ typeInt , typeInt ]
747+ , typeFloat :| [ typeFloat, typeFloat]
748+ , typeInt :| [ typeFloat, typeFloat]
749+ , typeFloat :| [ typeInt , typeFloat]
749750 ]
750751
751752 rUnion =
752753 eqCnstMtx
753- [ [ typeSet , typeSet , typeSet]
754- , [ typeSet , typeNull, typeSet]
755- , [ typeNull, typeSet , typeSet]
754+ [ typeSet :| [ typeSet , typeSet]
755+ , typeSet :| [ typeNull, typeSet]
756+ , typeNull :| [ typeSet , typeSet]
756757 ]
757758
758759 addition =
759760 eqCnstMtx
760- [ [ typeInt , typeInt , typeInt ]
761- , [ typeFloat , typeFloat , typeFloat ]
762- , [ typeInt , typeFloat , typeFloat ]
763- , [ typeFloat , typeInt , typeFloat ]
764- , [ typeString, typeString, typeString]
765- , [ typePath , typePath , typePath ]
766- , [ typeString, typeString, typePath ]
761+ [ typeInt :| [ typeInt , typeInt ]
762+ , typeFloat :| [ typeFloat , typeFloat ]
763+ , typeInt :| [ typeFloat , typeFloat ]
764+ , typeFloat :| [ typeInt , typeFloat ]
765+ , typeString :| [ typeString, typeString]
766+ , typePath :| [ typePath , typePath ]
767+ , typeString :| [ typeString, typePath ]
767768 ]
768769
769- eqCnstMtx mtx = [EqConst u1 $ TMany $ typeFun <$> mtx]
770+ eqCnstMtx mtx = [EqConst u1 $ TMany $ map typeFun mtx]
770771
771772liftInfer :: Monad m => m a -> InferT s m a
772773liftInfer = InferT . lift . lift . lift
0 commit comments