collapse :: Eq a => Multipath a (Sym, Size) -> Maybe (SizeChangeGraph a (Sym, Size))
collapse multipath
  | not (null multipath) = foldM compose (head multipath) (tail multipath)
  | otherwise            = Nothing
collapse :: Eq a => Multipath a (Sym, Size) -> Maybe (SizeChangeGraph a (Sym, Size))
collapse multipath
  | not (null multipath) = foldM compose (head multipath) (tail multipath)
  | otherwise            = Nothing
collapse multipath
  | not (null multipath) = foldM compose (head multipath) (tail multipath)
  | otherwise            = Nothing