serveSpec :: forall goo st. goo -> InitHandler goo st -> ProcessDefinition st -> Process ()
serveSpec x ih (ProcessDefinition { apiHandlers = [h] })
  = do InitOk s0 d0 <- ih x
       recvLoop s0
         where
           recvLoop :: st -> Process ()
           recvLoop st0 = do s' <- (top `castEffect` h :: st -> Process st) st0
                             recvLoop s'


serveSpec :: forall goo st. goo -> InitHandler goo st -> ProcessDefinition st -> Process ()
serveSpec x ih (ProcessDefinition { apiHandlers = [h] })
  = do InitOk s0 d0 <- ih x
       recvLoop s0
         where
           recvLoop :: st -> Process ()
           recvLoop st0 = do s' <- (top `castEffect` h :: st -> Process st) st0
                             recvLoop s'


serveSpec x ih (ProcessDefinition { apiHandlers = [h] })
  = do InitOk s0 d0 <- ih x
       recvLoop s0
         where
           recvLoop :: st -> Process ()
           recvLoop st0 = do s' <- (top `castEffect` h :: st -> Process st) st0
                             recvLoop s'

