<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
</head>
<body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">
Dear Brandon, Ozgur, et al,
<div><br>
</div>
<div>Thanks very much for you explanation. This seems to be a perfectly reasonable explanation; the wrapper-types I used probably explicitly invoke typeOf with undefined. The problem here, however, is that in my actual program, I don't use ADTs, but I use GADTs,
 so as to carry the context (Monad, Typeable1) with the constructor. To get to this context, I must pattern-match with the constructor. It seems hiding contexts (which I really like about GADTs) isn't &quot;available&quot; consistently. Oh well ;)</div>
<div><br>
</div>
<div>Regards,</div>
<div>Philip</div>
<div><br>
</div>
<div><br>
<div>
<div>On 29 Aug 2011, at 01:20, Brandon Allbery wrote:</div>
<br class="Apple-interchange-newline">
<blockquote type="cite">
<div dir="ltr">On Sun, Aug 28, 2011 at 18:44, Philip Holzenspies <span dir="ltr">
&lt;<a href="mailto:pkfh@st-andrews.ac.uk">pkfh@st-andrews.ac.uk</a>&gt;</span> wrote:<br>
<div class="gmail_quote">
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
instance (Typeable1 m, Monad m) =&gt; Typeable (MyADT m) where<br>
&nbsp; &nbsp; &nbsp; &nbsp;typeOf t@(MyADT _)<br>
</blockquote>
<div><br>
</div>
<div>typeOf is usually invoked with an undefined parameter; it should use types, never values. &nbsp;Here you've defined it to deconstruct what it's passed, which means that anything that uses it in the usual way (`typeOf (undefined :: someType)') will immediately
 throw undefined.</div>
<div><br>
</div>
<div>You don't need a deconstructor there; you (correctly) throw away the value, and it doesn't provide any type information not already available from the instance declaration. &nbsp;`typeOf t' should be good enough.</div>
<div><br>
</div>
</div>
-- <br>
brandon s allbery &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<a href="mailto:allbery.b@gmail.com" target="_blank">allbery.b@gmail.com</a><br>
wandering unix systems administrator (available) &nbsp; &nbsp; (412) 475-9364 vm/sms<br>
<br>
</div>
</blockquote>
</div>
<br>
</div>
</body>
</html>