FooBar StateMachines
import qualified Bar as Bar
import qualified Foo as Foo
import Cont
data Stack s = Empty | s ::: Stack s ; infixr 5 :::
data States = FooState Foo.FooState | BarState Bar.BarState
run :: Stack States -> Stack States
run Empty = error "Empty stack"
run (s ::: rest) = proceed (run' s) rest
run' :: States -> Cont
run' (FooState s) = Foo.run s
run' (BarState s) = Bar.run s
proceed :: Cont -> Stack States -> Stack States
proceed (Cont s) rest = undefined ::: rest
proceed (Start s s') rest = undefined ::: undefined ::: rest
proceed (End s) rest = rest
main = print $ Foo.run Foo.FInit
INFO