Commits

Alex Suraci committed e644ec8

traitMatch updates, and fixed unions matching if their bases match

  • Participants
  • Parent commits a7d7e90

Comments (0)

Files changed (1)

File src/Atomy/Types.hs

     keyParticleN ["dynamic-needed"] [string t]
 
 traitMatch :: Trait -> Trait -> Bool
-traitMatch (Unary _ x) (Unary _ y) = x == y
-traitMatch x@(Unary _ _) (Union _ yx yy) =
+traitMatch (Unary x) (Unary y) = x == y
+traitMatch x@(Unary _) (Union yx yy) =
     traitMatch x yx || traitMatch x yy
-traitMatch (Unary _ _) (Intersection _ _ _) =
+traitMatch (Unary _) (Intersection _ _) =
     False -- TODO?
-traitMatch (Union _ xx xy) y@(Unary _ _) =
-    traitMatch y xx || traitMatch y xy
-traitMatch (Union _ _ _) (Intersection _ _ _) =
+traitMatch (Union xx xy) y@(Unary _) =
+    traitMatch xx y || traitMatch xy y
+traitMatch (Union _ _) (Intersection _ _) =
     False -- TODO?
-traitMatch (Union _ xx xy) (Union _ yx yy) =
+traitMatch (Union xx xy) (Union yx yy) =
     or
         [ traitMatch xx yx
         , traitMatch xx yy
         , traitMatch xy yx
-        , traitMatch xy yy
         ]
-traitMatch (Intersection _ _ _) (Unary _ _) =
+traitMatch (Intersection _ _) (Unary _) =
     False -- TODO?
-traitMatch (Intersection _ _ _) (Union _ _ _) =
+traitMatch (Intersection _ _) (Union _ _) =
     False -- TODO?
-traitMatch (Intersection _ xx xy) (Intersection _ yx yy) =
+traitMatch (Intersection xx xy) (Intersection yx yy) =
     traitMatch xx yx && traitMatch xy yy
 
 unary :: Int -> Trait