How to keep the stacktrace when rethrowing an exception out of catch-context?
问题 TL;DR: how to raise a previously caught exception later on, while preserving the original exception's stacktrace. Since I think this is useful with the Result monad or computation expression, esp. since that pattern is often used for wrapping an exception without throwing it, here's a worked out example of that: type Result<'TResult, 'TError> = | Success of 'TResult | Fail of 'TError module Result = let bind f = function | Success v -> f v | Fail e -> Fail e let create v = Success v let