How to compare two Strings in Haskell?

Asked

Viewed 388 times

4

buscaLivroNome :: Livro -> Nome -> String
buscaLivroNome [] _ = "Nao Encontrado"
buscaLivroNome ((codigo,nome1,preco, autor, ano):resto) nome2 | nome1 == nome2 = "Livro Encontrado" | otherwise = buscaLivroNome resto nome2

I need to compare the strings nome1 and nome2 are equal, but is returning this error:

Exception: Prelude.read: no parse

  • 1

    Information is missing from your question, such as the complete type of Livro and of Nome, in addition, the function read is not being called anywhere in your code.

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.