the data shall be passed to the callback of the corresponding event.<br><br>I have trouble making it correctly typed.<br>Here is my try:<br><i><br>type Player = Int --dummy types for the example<br>type Rule = Int<br>data EventEnum = NewPlayer | NewRule deriving Eq<br>

triggerEvent e d es = do<br> &nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsplet r = lookup e es<br> case r of <br> &nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbspNothing -&gt; return ()<br> &nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbspJust (H h) -&gt; h d</i><br><br>The trouble is that I want the user to be only able to add an event that is compatible with its handler:<br>

For example the event NewPlayer should have a handler of type Player -&gt; IO (). The data passed when triggering this event should be only of type Player.<br>How can I do that? It sound like dependant typing...<br><br></blockquote>