stepsToQCBuilder :: GateToQCBuilder g => Builder -> Seq (Step g) -> Builder
stepsToQCBuilder nl =
    Foldable.foldMap (\step -> stepToQCBuilder step <> nl)
  where
    stepToQCBuilder (Step items) =
        builderFromList (fromChar ';') itemToQCBuilder (Foldable.toList items)
    itemToQCBuilder (IGate g) = gateToQCBuilder g
    itemToQCBuilder (IComponent compId touched) =
        fromChar 'C' <> fromShow compId <> fromChar ' ' <> touchedToQCBuilder touched
stepsToQCBuilder :: GateToQCBuilder g => Builder -> Seq (Step g) -> Builder
stepsToQCBuilder nl =
    Foldable.foldMap (\step -> stepToQCBuilder step <> nl)
  where
    stepToQCBuilder (Step items) =
        builderFromList (fromChar ';') itemToQCBuilder (Foldable.toList items)
    itemToQCBuilder (IGate g) = gateToQCBuilder g
    itemToQCBuilder (IComponent compId touched) =
        fromChar 'C' <> fromShow compId <> fromChar ' ' <> touchedToQCBuilder touched
stepsToQCBuilder nl =
    Foldable.foldMap (\step -> stepToQCBuilder step <> nl)
  where
    stepToQCBuilder (Step items) =
        builderFromList (fromChar ';') itemToQCBuilder (Foldable.toList items)
    itemToQCBuilder (IGate g) = gateToQCBuilder g
    itemToQCBuilder (IComponent compId touched) =
        fromChar 'C' <> fromShow compId <> fromChar ' ' <> touchedToQCBuilder touched