i was trying to made a function to verify if a Node exists in a list (i'm working with graphs):
buscaNodo :: [(Nodo,Peso)]->Nodo->Bool
buscaNodo _[] = False
buscaNodo ((a,b):ar) n
|(n == a)= True || (buscaNodo ar n)
|(n /= a)= False || (buscaNodo ar n)
|otherwise = False
That function returns me a true always that the node exists in the list; but if it doesn't exists in the list haskell show me an error : Non-exhaustive patterns in function buscaNodo, i need some help please, i was learning haskell recently and dont have the neccesary knowledge for solve that problems by myself. I'm so sorry for my dreadful english. Thank you for all
Nodo,Peso, and the error message you get? These bits of information make it much easier to figure out what the actual problem you have is. - bheklilrnis in that list, then you can do so quite easily with a combination ofmap fstandelem, such asbuscaNodo graph n = elem n $ map fst graph. This doesn't solve the error you're getting, but it would be an alternate solution to what you're trying to do. - bheklilr