expand :: TransMap -> S.Set [String] -> S.Set [String]
expand m s0 = S.foldr' oneItem S.empty s0
  where
    oneItem es s =
      foldr (expandSplit m . flip splitAt es) (s `S.difference` s0) [0..length es - 1]
expand :: TransMap -> S.Set [String] -> S.Set [String]
expand m s0 = S.foldr' oneItem S.empty s0
  where
    oneItem es s =
      foldr (expandSplit m . flip splitAt es) (s `S.difference` s0) [0..length es - 1]
expand m s0 = S.foldr' oneItem S.empty s0
  where
    oneItem es s =
      foldr (expandSplit m . flip splitAt es) (s `S.difference` s0) [0..length es - 1]