on master help sign in
some simple attribute adjustments
commit7bfa060697db70bbb8cff1c44417673557220ba5 authorAgentM <agentm@themactionfaction.com> dateSat 30 May 2015, 11:10 (11 years ago) parent98ee637
1 file changed+4−5
ProjectM36/Attribute.hs+4−5
ProjectM36/Attribute.hs+4−5
@@ -70,12 +70,9 @@ attributeForName attrName attrs = case V.find ((attrName ==) . attributeName) at
7070 Just attr -> Right attr
7171
7272attributesForNames :: S.Set AttributeName -> Attributes -> Attributes
73−attributesForNames attrNameSet attrs = V.foldr folder V.empty attrs
73+attributesForNames attrNameSet attrs = V.filter filt attrs
7474 where
75− folder attr acc = if S.member (attributeName attr) attrNameSet then
76− acc `V.snoc` attr
77− else
78− acc
75+ filt attr = S.member (attributeName attr) attrNameSet
7976
8077attributeNameSet :: Attributes -> S.Set AttributeName
8178attributeNameSet attrVec = S.fromList $ V.toList $ V.map (\(Attribute name _) -> name) attrVec
@@ -117,3 +114,5 @@ verifyAttributes attrs = if collapsedAttrs /= attrs then
117114 where
118115 collapsedAttrs = vectorUniqueify attrs
119116
117+attributesEqual :: Attributes -> Attributes -> Bool
118+attributesEqual attrs1 attrs2 = V.null (attributesDifference attrs1 attrs2)