diff --git a/checks/Check.hs b/checks/Check.hs index 357d191..f4bad8a 100644 --- a/checks/Check.hs +++ b/checks/Check.hs @@ -337,7 +337,7 @@ checkPlainVarUsage sharedAttr (m, p) = check p where addBK :: BK -> Vars -> m VarsBK addBK bk vs - = do let read = Map.fromAscList $ zip (Set.toAscList $ readVars vs) (repeat bk) + = do let read = setToMap (readVars vs) bk splitUsed <- splitEnds' $ Set.toList $ usedVars vs splitWritten <- concatMapM splitEnds (Map.toList $ writtenVars vs) >>* Map.fromList let used = Map.fromList (zip splitUsed (repeat ([], bk))) @@ -418,8 +418,7 @@ checkPlainVarUsage sharedAttr (m, p) = check p examineVars' <- mapM (filterMapByKeyM (liftM not . isSharedType)) examineVars checkCREW examineVars' where - difference m s = m `Map.difference` (Map.fromAscList $ zip (Set.toAscList - s) (repeat ())) + difference m s = m `Map.difference` setToMap s () isSharedType :: Var -> m Bool isSharedType v = do t <- astTypeOf v diff --git a/common/Utils.hs b/common/Utils.hs index 1ac65dc..5d8a9b6 100644 --- a/common/Utils.hs +++ b/common/Utils.hs @@ -433,3 +433,5 @@ replace (find, repl) big then repl ++ replace (find, repl) (drop (length find) poss) else head poss : replace (find, repl) (tail poss) +setToMap :: Ord k => Set.Set k -> v -> Map.Map k v +setToMap s v = Map.fromAscList $ zip (Set.toAscList s) (repeat v)