{-# LANGUAGE DeriveDataTypeable #-}
{-# LANGUAGE RecordWildCards #-}
module LiveCoding.LiveProgram.Monad.Trans where
import Data.Data
import Control.Monad.Trans.State.Strict
import LiveCoding.LiveProgram
import LiveCoding.Cell.Monad.Trans
runStateL
:: (Data stateT, Monad m)
=> LiveProgram (StateT stateT m)
-> stateT
-> LiveProgram m
runStateL LiveProgram { .. } stateT = LiveProgram
{ liveState = State { stateInternal = liveState, .. }
, liveStep = \State { .. } -> do
(stateInternal, stateT) <- runStateT (liveStep stateInternal) stateT
return State { .. }
}