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 :: 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 :: forall (m :: * -> *) a b s.
Data s =>
s -> (s -> a -> m (b, s)) -> Cell m a b
Cell
  { cellState :: s
cellState = s -> s -> s
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
  }