module LiveCoding.Cell.HotCodeSwap where

-- essence-of-live-coding
import LiveCoding.Cell
import LiveCoding.Migrate

hotCodeSwapCell ::
  Cell m a b ->
  Cell m a b ->
  Cell m a b
hotCodeSwapCell :: forall (m :: * -> *) a b. Cell m a b -> Cell m a b -> Cell m a b
hotCodeSwapCell
  (Cell s
newState s -> a -> m (b, s)
newStep)
  (Cell s
oldState s -> a -> m (b, s)
_) =
    Cell
      { cellState :: s
cellState = forall a b. (Data a, Data b) => a -> b -> a
migrate s
newState s
oldState
      , cellStep :: s -> a -> m (b, s)
cellStep = s -> a -> m (b, s)
newStep
      }