avoid unnecessary variants

This commit is contained in:
Krasimir Angelov
2025-05-18 07:46:56 +02:00
parent 3a1990fd1d
commit 68ae919afa
@@ -501,7 +501,7 @@ resolveOverloads scope c t0 q args mb_ty = do
arg_tys <- mapCM (checkArg g) c1 args
let v_ttys = mapC (\c (t,ty) -> (t,eval g [] c ty [])) c2 ttys
try (\(fun,fun_ty) -> reapply2 scope c3 fun fun_ty arg_tys mb_ty)
(\ttys -> fmap (\(ts,ty) -> (FV ts,ty)) (snd (minimum g ttys)))
(\ttys -> fmap (\(ts,ty) -> (mkFV ts,ty)) (snd (minimum g ttys)))
v_ttys
where
checkArg g c (ImplArg arg) = do
@@ -515,6 +515,9 @@ resolveOverloads scope c t0 q args mb_ty = do
let v = eval g (scopeEnv scope) c2 arg []
return (arg,v,arg_ty)
mkFV [t] = t
mkFV ts = FV ts
minimum g [] = (maxBound,err)
where
err = evalError (pp "Overload resolution failed")