Untitled
unknown
haskell
4 years ago
432 B
21
Indexable
match :: Eq a => Maybe a -> Maybe a -> (All, Sum Int)
match (Just x) (Just y)
| x == y = (All True, Sum 1)
| otherwise = (All False, Sum 0)
match Nothing Nothing = (All True, Sum 1)
match _ _ = (All True, Sum 0)
instance Eq PartialSampleEquivalence where
PartialSampleEquivalence (a1, a2, a3) == PartialSampleEquivalence (b1, b2, b3) =
r && n > 0
where
(All r, Sum n) = match a1 b1 <> match a2 b2 <> match a3 b3Editor is loading...