<html><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">Hello,<div><br></div><div>How can I parameterize the type of the following data class so that any type can be a Candidate?</div><div><pre><div class="line" id="LC23">&nbsp;&nbsp;<span class="kr">type</span> <span class="kt">Candidate</span> <span class="ow">=</span> <span class="kt">String</span></div><div class="line" id="LC24"></div></pre></div><div><pre><div class="line" id="LC30">&nbsp;&nbsp;<span class="kr">data</span> <span class="kt">Poll</span> <span class="ow">=</span> <span class="kt">Poll</span> <span class="p">[</span><span class="kt">Candidate</span><span class="p">]</span> <span class="p">[</span><span class="kt">Ballot</span><span class="p">]</span></div><div class="line" id="LC31"></div></pre></div><div><br></div><div>My initial thought was to simply put a type variable in place of Candidate, but that clearly won't work:</div><div><br></div><div><div><pre><div class="line" id="LC30">&nbsp;&nbsp;<span class="kr">data</span> <span class="kt">Poll</span> <span class="ow">=</span> <span class="kt">Poll</span> <span class="p">[</span><span class="kt">a</span><span class="p">]</span> <span class="p">[</span><span class="kt">Ballot</span><span class="p">]</span></div></pre></div></div><div><span class="Apple-style-span" style="font-family: 'Lucida Grande'; "><pre>&gt;&gt;  Not in scope: type variable `a'</pre><pre><font class="Apple-style-span" face="Helvetica"><span class="Apple-style-span" style="white-space: normal;"><div>For context: I am building a voting library that addresses the issue of polarized American politics by implementing the Virtual Round Robin electoral method with a Maximum Majority Voting algorithm for breaking cycles. &nbsp;The beginnings of the library are available at <a href="http://github.com/canadaduane/votelib/blob/master/vote.hs">http://github.com/canadaduane/votelib/blob/master/vote.hs</a></div></span></font></pre><pre><span class="Apple-style-span" style="font-family: Helvetica; white-space: normal; ">What is a good approach to the parameterized type issue? &nbsp;Thank you,</span></pre><pre><span class="Apple-style-span" style="font-family: Helvetica; white-space: normal; ">Duane Johnson</span></pre></span></div><div><br></div><div><br></div></body></html>