\begin{comment}
\begin{code}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE ExistentialQuantification #-}

module LiveCoding.LiveProgram.HotCodeSwap where

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

\end{code}
\end{comment}
\begin{code}
hotCodeSwap
  :: LiveProgram m
  -> LiveProgram m
  -> LiveProgram m
hotCodeSwap :: LiveProgram m -> LiveProgram m -> LiveProgram m
hotCodeSwap
  (LiveProgram s
newState s -> m s
newStep)
  (LiveProgram s
oldState s -> m s
_)
  = LiveProgram :: forall (m :: * -> *) s. Data s => s -> (s -> m s) -> LiveProgram m
LiveProgram
  { liveState :: s
liveState = s -> s -> s
forall a b. (Data a, Data b) => a -> b -> a
migrate s
newState s
oldState
  , liveStep :: s -> m s
liveStep  = s -> m s
newStep
  }
\end{code}