Added a new setToMap function to Utils
This commit is contained in:
parent
014f83d65d
commit
4f0ebbc672
|
@ -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
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue
Block a user