{-# 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 :: forall state' state dbgState.
(Typeable state', Typeable state) =>
Debugging dbgState state
-> state' -> Maybe (Debugging dbgState state)
maybeMigrateToDebugging Debugging {dbgState
dbgState :: forall dbgState state. Debugging dbgState state -> dbgState
dbgState :: dbgState
dbgState} state'
state' = do
state
state <- forall a b. (Typeable a, Typeable b) => a -> Maybe b
cast state'
state'
forall (m :: * -> *) a. Monad m => a -> m a
return Debugging {state
dbgState
state :: state
state :: state
dbgState :: dbgState
dbgState :: dbgState
..}
migrationToDebugging :: Migration
migrationToDebugging :: Migration
migrationToDebugging = forall (t :: * -> * -> *).
Typeable t =>
(forall a b c.
(Typeable a, Typeable b, Typeable c) =>
t b c -> a -> Maybe (t b c))
-> Migration
migrationTo2 forall state' state dbgState.
(Typeable state', Typeable state) =>
Debugging dbgState state
-> state' -> Maybe (Debugging dbgState state)
maybeMigrateToDebugging
maybeMigrateFromDebugging ::
(Typeable state', Typeable state) =>
Debugging dbgState state ->
Maybe state'
maybeMigrateFromDebugging :: forall state' state dbgState.
(Typeable state', Typeable state) =>
Debugging dbgState state -> Maybe state'
maybeMigrateFromDebugging Debugging {state
state :: state
state :: forall dbgState state. Debugging dbgState state -> state
state} = forall a b. (Typeable a, Typeable b) => a -> Maybe b
cast state
state
migrationFromDebugging :: Migration
migrationFromDebugging :: Migration
migrationFromDebugging = forall (t :: * -> * -> *).
Typeable t =>
(forall a b c.
(Typeable a, Typeable b, Typeable c) =>
t b c -> Maybe a)
-> Migration
constMigrationFrom2 forall state' state dbgState.
(Typeable state', Typeable state) =>
Debugging dbgState state -> Maybe state'
maybeMigrateFromDebugging
migrationDebugging :: Migration
migrationDebugging :: Migration
migrationDebugging = Migration
migrationToDebugging forall a. Semigroup a => a -> a -> a
<> Migration
migrationFromDebugging