newGate :: (Ord g, Monad m, Gate g) => g -> BuilderT g m Ref
newGate !gate = do
    dedup <- use bs_dedup
    case M.lookup gate dedup of
        Nothing -> do
            ref <- nextRef
            insertGate ref gate
            return ref
        Just ref -> do
            return ref
newGate :: (Ord g, Monad m, Gate g) => g -> BuilderT g m Ref
newGate !gate = do
    dedup <- use bs_dedup
    case M.lookup gate dedup of
        Nothing -> do
            ref <- nextRef
            insertGate ref gate
            return ref
        Just ref -> do
            return ref
newGate !gate = do
    dedup <- use bs_dedup
    case M.lookup gate dedup of
        Nothing -> do
            ref <- nextRef
            insertGate ref gate
            return ref
        Just ref -> do
            return ref