Haskell tuple evaluation : I'm writing a function of the following type:

        match :: [(String,a)] -> Maybe (String, a, a)

I want the function to traverse the list of tuples, and determine if there are any tuples in which the first element (a string) is the same. If so, I want to return a tuple containing that string, as well as the second element in each of those matching tuples. If there are no matching tuples, return "Nothing". If there is more than one matching, return the first one it finds.

For example:

        match [("x", 3), ("y", 4), ("z", 5"), ("x", 6)] = ("x", 3, 6)
        match [("x", 3), ("y", 4), ("z", 5")] = Nothing

I'm thinking:

        match (x:xs) = if (fst x) = (fst xs) return (fst x, snd x, snd xs)
        --if no matches, return Nothing

Thank you for any help!!

