@@ -8,6 +8,9 @@ import qualified Data.Set as S
88empty :: AttributeNames
99empty = AttributeNames S.empty
1010
11+all :: AttributeNames
12+all = InvertedAttributeNames S.empty
13+
1114--check that the attribute names are actually in the attributes
1215projectionAttributesForAttributeNames :: Attributes -> AttributeNames -> Either RelationalError Attributes
1316projectionAttributesForAttributeNames attrs (AttributeNames attrNameSet) = do
@@ -21,12 +24,13 @@ projectionAttributesForAttributeNames attrs (InvertedAttributeNames unselectedAt
2124 if not $ S.null nonExistentAttributeNames then
2225 Left $ AttributeNamesMismatchError nonExistentAttributeNames
2326 else
24− return $ A.attributesForNames (A.nonMatchingAttributeNameSet unselectedAttrNameSet (A.attributeNameSet attrs)) attrs
25−
26−attributeNameSet :: AttributeNames -> S.Set AttributeName
27−attributeNameSet (AttributeNames nameSet) = nameSet
28−attributeNameSet (InvertedAttributeNames nameSet) = nameSet
29−
27+ return $ A.attributesForNames (A.nonMatchingAttributeNameSet unselectedAttrNameSet (A.attributeNameSet attrs)) attrs
28+projectionAttributesForAttributeNames attrs (UnionAttributeNames namesA namesB) = do
29+ attrsA <- projectionAttributesForAttributeNames attrs namesA
30+ attrsB <- projectionAttributesForAttributeNames attrs namesB
31+ pure (A.union attrsA attrsB)
32+
3033invertAttributeNames :: AttributeNames -> AttributeNames
3134invertAttributeNames (AttributeNames names) = InvertedAttributeNames names
32−invertAttributeNames (InvertedAttributeNames names) = AttributeNames names
35+invertAttributeNames (InvertedAttributeNames names) = AttributeNames names
36+invertAttributeNames (UnionAttributeNames namesA namesB) = UnionAttributeNames (invertAttributeNames namesA) (invertAttributeNames namesB)