Efficient way to “keep turning the crank” on a stateful computation
问题 I have a stateful process that is modelled as an i -> RWS r w s a . I want to feed it an input cmds :: [i] ; currently I do that wholesale: let play = runGame theGame . go where go [] = finished go ((v, n):cmds) = do end1 <- stepWorld end2 <- ite (SBV.isJust end1) (return end1) $ stepPlayer (v, n) ite (SBV.isJust end2) (return end2) $ go cmds I can try searching for an input of a predetermined size like this: result <- satWith z3{ verbose = True } $ do cmds <- mapM sCmd [1..inputLength]