<div dir="ltr"><br><div class="gmail_extra">On Mon, Jan 28, 2013 at 5:43 PM, Bob Hutchison <span dir="ltr">&lt;<a href="mailto:hutch-lists@recursive.ca" target="_blank">hutch-lists@recursive.ca</a>&gt;</span> wrote:<br><div class="gmail_quote">
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><br>
Now, this is how I got caught: it seems to be impossible to have collections of things with a common type class if they have different types. How is it that I&#39;ve written that many lines of code in Haskell and I&#39;m just noticing this now? (If I wasn&#39;t so annoyed, I&#39;d look for something clever to reflect how loc count obviously doesn&#39;t mean much… but clever seems to be beyond me today).<br>

<br>
Is this true? Are there any GHC extensions that will let me around this?<br></blockquote><div><br></div><div style>I just encountered this recently myself. There is a GADT extension [1][2] that may help. The greater abstraction appears to lie in existential types [3].</div>
<div style><br></div><div style>That being said, I&#39;m a beginner as well and haven&#39;t yet used these extensions. So far I have found that my code is simplified by redefining heterogeneous types in terms of homogeneous functions.  If I have a class that implements common methods, I will reorganize lists by common function types rather than by class.</div>
<div style><br></div><div style>Cheers,</div><div style>Darren</div><div style><br></div><div style><br></div><div style>---</div><div style>[1] <a href="http://www.haskell.org/haskellwiki/GADT">http://www.haskell.org/haskellwiki/GADT</a><br>
</div><div style>[2] <a href="http://www.haskell.org/haskellwiki/GADTs_for_dummies">http://www.haskell.org/haskellwiki/GADTs_for_dummies</a></div><div style>[3] <a href="http://www.haskell.org/haskellwiki/Existential_type">http://www.haskell.org/haskellwiki/Existential_type</a></div>
<div style><br></div></div></div></div>