rval :: Exp a -> Action Var
rval act = do
    (xs, res) <- capture act
    case res of
        _ | not $ null xs -> error $ "An R-value may not emit any statements: " ++ show xs
        Value [Var_ x] -> return x
        _ -> error $ "An R-value must be a single value, found: " ++ show (fromValue res)
rval :: Exp a -> Action Var
rval act = do
    (xs, res) <- capture act
    case res of
        _ | not $ null xs -> error $ "An R-value may not emit any statements: " ++ show xs
        Value [Var_ x] -> return x
        _ -> error $ "An R-value must be a single value, found: " ++ show (fromValue res)
rval act = do
    (xs, res) <- capture act
    case res of
        _ | not $ null xs -> error $ "An R-value may not emit any statements: " ++ show xs
        Value [Var_ x] -> return x
        _ -> error $ "An R-value must be a single value, found: " ++ show (fromValue res)