<br><br><div class="gmail_quote">On Wed, Aug 29, 2012 at 12:01 PM, Philip Holzenspies <span dir="ltr">&lt;<a href="mailto:pkfh@st-andrews.ac.uk" target="_blank">pkfh@st-andrews.ac.uk</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

Dear GHCers,<br>
<br>
I&#39;m performing traversals over GHC-API results (HsSyn et al). For this purpose, I&#39;m using SYB generics.<br>
<br>
I found that I couldn&#39;t use &quot;ext1Q&quot; for a function with type &quot;Data x =&gt; Bag x -&gt; String&quot;, i.e. that this function was never applied. The source of Bag&#39;s instance of the Data class seems to explain why:<br>


<br>
<br>
instance Data a =&gt; Data (Bag a) where<br>
  gfoldl k z b = z listToBag `k` bagToList b -- traverse abstract type abstractly<br>
  toConstr _   = abstractConstr $ &quot;Bag(&quot;++show (typeOf (undefined::a))++&quot;)&quot;<br>
  gunfold _ _  = error &quot;gunfold&quot;<br>
  dataTypeOf _ = mkNoRepType &quot;Bag&quot;<br></blockquote><div><br>Btw, where is this instance defined?<br><br><br>Thanks,<br>Pedro<br> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">


<br>
<br>
Is there a rationale to not allow gunfolds and to keep toConstr abstract? More to the point for my needs, is there a reason to not allow dataCast1 casting of Bags?<br>
<br>
Regards,<br>
Philip<br>
_______________________________________________<br>
Glasgow-haskell-users mailing list<br>
<a href="mailto:Glasgow-haskell-users@haskell.org">Glasgow-haskell-users@haskell.org</a><br>
<a href="http://www.haskell.org/mailman/listinfo/glasgow-haskell-users" target="_blank">http://www.haskell.org/mailman/listinfo/glasgow-haskell-users</a><br>
</blockquote></div><br>