I have a question about Haskell. I'm new so I don't understand too well, but if anyone could help me I'd really appreciate. I have this exercise from a book that I bought.
Create a type Question with value contructors Sim or Nao. Make a function that:
- listQuest: receive from a parameter a list of Questions and return 0 for Nao or 1 for Sim corresponding the constructors in the list.
I tried this code:
module Question where
data Question = Yes | No deriving Show
questNum :: Question -> Int
questNum No = 0
questNum Yes = 1
listQuest :: [Question] -> [Int]
listQuest listQuestion = [ questNum quest | quest <- listQuestion ]
I'm lost in the prompt matter. Don't know what to write to use the function.
Thanks for the help