partitionAss
  :: Set (Predicate, Bool) -- ^ The joint query.
  -> [Map Predicate Bool] -- ^ All possiblement assignments.
  -> ([Map Predicate Bool], [Map Predicate Bool]) -- ^ A probability in [0.0, 1.0]
partitionAss query = partition valid
  where
    -- Check if an assignment fits the query:
    valid ass = Set.foldr' (\(k, v) acc -> acc && case Map.lookup k ass of Just b -> v == b; _ -> False) True query

-- | Direct method of computing joint probabilities for Markov logic (does not
-- scale!).
partitionAss
  :: Set (Predicate, Bool) -- ^ The joint query.
  -> [Map Predicate Bool] -- ^ All possiblement assignments.
  -> ([Map Predicate Bool], [Map Predicate Bool])
partitionAss query = partition valid
  where
    -- Check if an assignment fits the query:
    valid ass = Set.foldr' (\(k, v) acc -> acc && case Map.lookup k ass of Just b -> v == b; _ -> False) True query

-- | Direct method of computing joint probabilities for Markov logic (does not
-- scale!).
partitionAss query = partition valid
  where
    -- Check if an assignment fits the query:
    valid ass = Set.foldr' (\(k, v) acc -> acc && case Map.lookup k ass of Just b -> v == b; _ -> False) True query

-- | Direct method of computing joint probabilities for Markov logic (does not
-- scale!).