getIdOrName :: [QueryPair] -> [QueryPair] -> [QueryPair] -> NodeIdOrName
getIdOrName ids nns ns2 = case ids of
  (_, Just v) : _ -> Left $ read v
  _ -> case nns of
    (_, Just v) : _ -> Right v
    _ -> case ns2 of
      (_, Just v) : _ -> if isNat v then Left $ read v else Right v
      _ -> error "getIdOrName"
getIdOrName :: [QueryPair] -> [QueryPair] -> [QueryPair] -> NodeIdOrName
getIdOrName ids nns ns2 = case ids of
  (_, Just v) : _ -> Left $ read v
  _ -> case nns of
    (_, Just v) : _ -> Right v
    _ -> case ns2 of
      (_, Just v) : _ -> if isNat v then Left $ read v else Right v
      _ -> error "getIdOrName"
getIdOrName ids nns ns2 = case ids of
  (_, Just v) : _ -> Left $ read v
  _ -> case nns of
    (_, Just v) : _ -> Right v
    _ -> case ns2 of
      (_, Just v) : _ -> if isNat v then Left $ read v else Right v
      _ -> error "getIdOrName"