{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE RecordWildCards #-}
module LiveCoding.Migrate.Debugger where
import Data.Data
import LiveCoding.Debugger
import LiveCoding.Migrate.Migration
maybeMigrateToDebugging
:: (Typeable state', Typeable state)
=> Debugging dbgState state
-> state'
-> Maybe (Debugging dbgState state)
maybeMigrateToDebugging Debugging { dbgState } state' = do
state <- cast state'
return Debugging { .. }
migrationToDebugging :: Migration
migrationToDebugging = migrationTo2 maybeMigrateToDebugging
maybeMigrateFromDebugging
:: (Typeable state', Typeable state)
=> Debugging dbgState state
-> Maybe state'
maybeMigrateFromDebugging Debugging { state } = cast state
migrationFromDebugging :: Migration
migrationFromDebugging = constMigrationFrom2 maybeMigrateFromDebugging
migrationDebugging :: Migration
migrationDebugging = migrationToDebugging <> migrationFromDebugging