By the way, if you *really* want to do it your way, you can inspect the typeOf the event directly and look for your &quot;Message&quot; type (using typeRepTyCon from Data.Typeable), then unsafeCoerce into Message () to extract the String.<br>
<br>import Unsafe.Coerce<br>import Data.Typeable<br><br>tyConMessage :: TyCon<br>tyConMessage = typeRepTyCon $ typeOf ( undefined :: Message () )<br><br>getMessageContents :: Event e =&gt; e -&gt; Maybe String<br>getMessageContents e <br>
   | typeRepTyCon (typeOf e) == tyConMessage = Just $ case (unsafeCoerce e :: Message ()) of Message s -&gt; s<br>   | otherwise = Nothing<br><br>But I strongly recommend *not* doing it this way :)<br><br>  -- ryan<br><br>
<div class="gmail_quote">On Mon, Sep 10, 2012 at 4:03 PM, Ryan Ingram <span dir="ltr">&lt;<a href="mailto:ryani.spam@gmail.com" target="_blank">ryani.spam@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">