I have a list of tuples
type Sales = (String, String, Integer)
testData :: [Sales]
testData = [("Jack", "Hill", 2), ("Susan", "Smith", 5), ("Steve", "Johnson", 6)
How can I write a function that would search through the list of tuples given the first and last names and output the number, and let me edit that number?
I'm trying to have something like:
recordSale "Jack" "Hill" -- and the function return 2
And another which would do:
addSale "Jack" "Hill" -- and it would add 1 to the database corresponding to the name
So far I've tried
recordSale tData Fname Lname= find (\(Fname, Lname, _) tData
recordSale tData Fname Lname = [(Fname, Lname, map (\tData -> tData + 1) sales) | (Fname, Lname, sales) <- tData]
nothing seems to work though, and most help I find only works with tuples with 2 elements, not 3.