matchCandidates def (cand : l) = do
  res <- matchCandidate def cand
  case res of
    Left _ -> matchCandidates def l
    x -> return (x, l)
matchCandidates def (cand : l) = do
  res <- matchCandidate def cand
  case res of
    Left _ -> matchCandidates def l
    x -> return (x, l)
matchCandidates def (cand : l) = do
  res <- matchCandidate def cand
  case res of
    Left _ -> matchCandidates def l
    x -> return (x, l)