title: Pluggable AI in Haskell
body: <p>I'm writing a simulation of a card game in Haskell wih multiple AI opponents.
  I'd like to have a main function with someting like <code>GameParameters -&gt; [AIPlayer] -&gt; GameOutcome</code>. But I'd like to think of the main function as a "library-function" so I can write a new AIPlayer with altering anything else. </p>
  
  <p>So I thought of creating a typeclass AIPlayer, so the main function becomes <code>AIPlayer a =&gt; GameParameters -&gt; [a] -&gt; GameOutcome</code>. But this only allows for one type of AI to be inserted. So to insert multiple AIPlayers in one game, I need to define a wrappertype</p>
  
  <pre><code>AIWrapper = P1 AIPlayer1 | P2 AIPlayer2 | ...
  
  instance AIWrapper AIPlayer where
       gameOperation (P1 x) = gameOperation x
       gameOperation (P2 x) = gameOperation x
       ...
  </code></pre>
  
  <p>I don't feel happy with this wrapper type and I feel like there must be something better than this, or am I wrong?</p>