combineAlls :: [Concept] -> AtomicDefMap -> [Concept]
combineAlls cs atomics =
  -- TODO how to simplify this lambda?
  let (noCombine:toCombine) = groupWith (\x -> case x of (All r _) -> Just r
                                                         _ -> Nothing) cs
      getConcept (All _ c) = normalize c atomics
      combine [c] = normalize c atomics
      combine cs2@(All r _:_) = All r . (`normalize` atomics) $ And (map getConcept cs2)
  in noCombine ++ map combine toCombine
combineAlls :: [Concept] -> AtomicDefMap -> [Concept]
combineAlls cs atomics =
  -- TODO how to simplify this lambda?
  let (noCombine:toCombine) = groupWith (\x -> case x of (All r _) -> Just r
                                                         _ -> Nothing) cs
      getConcept (All _ c) = normalize c atomics
      combine [c] = normalize c atomics
      combine cs2@(All r _:_) = All r . (`normalize` atomics) $ And (map getConcept cs2)
  in noCombine ++ map combine toCombine
combineAlls cs atomics =
  -- TODO how to simplify this lambda?
  let (noCombine:toCombine) = groupWith (\x -> case x of (All r _) -> Just r
                                                         _ -> Nothing) cs
      getConcept (All _ c) = normalize c atomics
      combine [c] = normalize c atomics
      combine cs2@(All r _:_) = All r . (`normalize` atomics) $ And (map getConcept cs2)
  in noCombine ++ map combine toCombine