step
  :: FlowChart (HaltT TestCrank) Status
  -> Resource TestCrank
  -> (ReqData -> ReqData)
  -> TestState (Decision', ReqData)
step s r f = do
  let rd = f newReqData
  case s of
    Decision _ a -> runTestCrank (runHaltT a) r rd >>= \case
      (Left (Halt sc), rd', _) -> return (Done' sc, rd')
      (Left (Error sc e), rd', _) -> return (Error' sc e, rd')
      (Right (Decision l _), rd', _) -> return (Decision' l, rd')
      (Right (Done a'), rd', _) -> runTestCrank (runHaltT a') r rd' <&> \case
        (Left (Halt sc), rd'', _) -> (Done' sc, rd'')
        (Left (Error sc e), rd'', _) -> (Error' sc e, rd'')
        (Right sc, rd'', _) -> (Done' sc, rd'')
    Done _ -> error "can't look past end state of flow chart"
step
  :: FlowChart (HaltT TestCrank) Status
  -> Resource TestCrank
  -> (ReqData -> ReqData)
  -> TestState (Decision', ReqData)
step s r f = do
  let rd = f newReqData
  case s of
    Decision _ a -> runTestCrank (runHaltT a) r rd >>= \case
      (Left (Halt sc), rd', _) -> return (Done' sc, rd')
      (Left (Error sc e), rd', _) -> return (Error' sc e, rd')
      (Right (Decision l _), rd', _) -> return (Decision' l, rd')
      (Right (Done a'), rd', _) -> runTestCrank (runHaltT a') r rd' <&> \case
        (Left (Halt sc), rd'', _) -> (Done' sc, rd'')
        (Left (Error sc e), rd'', _) -> (Error' sc e, rd'')
        (Right sc, rd'', _) -> (Done' sc, rd'')
    Done _ -> error "can't look past end state of flow chart"
step s r f = do
  let rd = f newReqData
  case s of
    Decision _ a -> runTestCrank (runHaltT a) r rd >>= \case
      (Left (Halt sc), rd', _) -> return (Done' sc, rd')
      (Left (Error sc e), rd', _) -> return (Error' sc e, rd')
      (Right (Decision l _), rd', _) -> return (Decision' l, rd')
      (Right (Done a'), rd', _) -> runTestCrank (runHaltT a') r rd' <&> \case
        (Left (Halt sc), rd'', _) -> (Done' sc, rd'')
        (Left (Error sc e), rd'', _) -> (Error' sc e, rd'')
        (Right sc, rd'', _) -> (Done' sc, rd'')
    Done _ -> error "can't look past end state of flow chart"