<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Oct 29, 2014 at 10:33 AM, Michael Snoyman <span dir="ltr"><<a href="mailto:michael@snoyman.com" target="_blank">michael@snoyman.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div><br></div><div>A completely different approach that might be better for your use case *and* might be useful in other cases would be to keep a stack of the `TypeRep`s we converted through when creating the SomeException. However, that would require a breaking change to SomeException, which I really *don't* want to propose.</div></div></div></div></blockquote><div><br></div><div>We already keep all the TypeReps, they just aren't generically accessible.  If we added a function to the Exception class like</div><div><br></div><div>  typeRepStack :: a -> [TypeRep]</div><div><br></div><div>it should work.  A more-or-less sensible default is typeRepStack a = [typeOf a], which would work for all terminal exception types.  A mid-level type in a hierarchy would need a different value though, something like</div><div><br></div><div>   typeRepStack se@(SomeException e) = typeOf se : typeRepStack e</div><div><br></div><div><br></div></div></div></div>