mupd :: String -> String -> Double -> Results -> Results
mupd tn cn v r = case M.lookup tn r of
                   Just vs -> M.insert tn ((v,cn) : vs) r
                   Nothing -> M.insert tn ((v,cn) : []) r

-- combineRs :: [String] -> [Results] -> Results
-- combineRs ls rs = 
--   foldr (\k -> M.insert k (mid k rs)) M.empty ls
-- 
-- mid :: String -> [Results] -> [(Double,String)]
-- mid k rs = foldr cc [] (fmap (M.lookup k) rs)
-- 
-- cc :: Maybe [a] -> [a] -> [a]
-- cc (Just as) bs = as ++ bs
-- cc _ bs = bs
mupd :: String -> String -> Double -> Results -> Results
mupd tn cn v r = case M.lookup tn r of
                   Just vs -> M.insert tn ((v,cn) : vs) r
                   Nothing -> M.insert tn ((v,cn) : []) r

-- combineRs :: [String] -> [Results] -> Results
-- combineRs ls rs = 
--   foldr (\k -> M.insert k (mid k rs)) M.empty ls
-- 
-- mid :: String -> [Results] -> [(Double,String)]
-- mid k rs = foldr cc [] (fmap (M.lookup k) rs)
-- 
-- cc :: Maybe [a] -> [a] -> [a]
-- cc (Just as) bs = as ++ bs
-- cc _ bs = bs
mupd tn cn v r = case M.lookup tn r of
                   Just vs -> M.insert tn ((v,cn) : vs) r
                   Nothing -> M.insert tn ((v,cn) : []) r

-- combineRs :: [String] -> [Results] -> Results
-- combineRs ls rs = 
--   foldr (\k -> M.insert k (mid k rs)) M.empty ls
-- 
-- mid :: String -> [Results] -> [(Double,String)]
-- mid k rs = foldr cc [] (fmap (M.lookup k) rs)
-- 
-- cc :: Maybe [a] -> [a] -> [a]
-- cc (Just as) bs = as ++ bs
-- cc _ bs = bs