@@ -55,11 +55,16 @@ unify ctxt env topx topy
5555 | fst (bnames!!i) == x || snd (bnames!!i) == x = return []
5656
5757 un' fn bnames (App fx ax) (App fy ay)
58− = do hf <- un' True bnames fx fy
59− let ax' = normalise ctxt env (substNames hf ax)
60− let ay' = normalise ctxt env (substNames hf ay)
61− ha <- un' False bnames ax' ay'
62− combine bnames hf ha
58+ = mplus (do hf <- un' True bnames fx fy
59+ let ax' = normalise ctxt env (substNames hf ax)
60+ let ay' = normalise ctxt env (substNames hf ay)
61+ ha <- un' False bnames ax' ay'
62+ combine bnames hf ha)
63+ (do ha <- un' False bnames ax ay
64+ let fx' = normalise ctxt env (substNames ha fx)
65+ let fy' = normalise ctxt env (substNames ha fy)
66+ hf <- un' False bnames fx' fy'
67+ combine bnames hf ha)
6368
6469 un' fn bnames x (Bind n (Lam t) (App y (P Bound n' _)))
6570 | n == n' = un' False bnames x y