-- | Find matching deduplication rule
findDRule :: Ext Record -> [DeduplicationRule] -> Maybe ([CheckAttribute], Attributes, DAction)
findDRule erecord rules = go  rules
  where
    go [] = Nothing
    go (r:rs)
      | checkDRule erecord r = Just (drCheckAttributes r, drOldRecordAttrs r, drAction r)
      | otherwise = go rs

-- | Check if record is matched by rule
findDRule :: Ext Record -> [DeduplicationRule] -> Maybe ([CheckAttribute], Attributes, DAction)
findDRule erecord rules = go  rules
  where
    go [] = Nothing
    go (r:rs)
      | checkDRule erecord r = Just (drCheckAttributes r, drOldRecordAttrs r, drAction r)
      | otherwise = go rs

-- | Check if record is matched by rule
findDRule erecord rules = go  rules
  where
    go [] = Nothing
    go (r:rs)
      | checkDRule erecord r = Just (drCheckAttributes r, drOldRecordAttrs r, drAction r)
      | otherwise = go rs

-- | Check if record is matched by rule