[Haskell-cafe] event handler

Alexander Solla alex.solla at gmail.com
Sun Jun 17 00:46:38 CEST 2012


On Sat, Jun 16, 2012 at 3:31 PM, Corentin Dupont
<corentin.dupont at gmail.com>wrote:

> Hi Alexander,
> sorry my initial example was maybe misleading. What I really what to do is
> to associate each event with an arbitrary data type. For example, consider
> the following events:
> NewPlayer
> NewRule
> Message
> User
>
> I want to associate the following data types with each, to pass to there
> respective handlers:
> NewPlayer ---> Player
> NewRule ---> Rule
> Message ---> String
> User ---> String
>
> Message and User have the same data type associated, that's why we can't
> use this type as a key to index the event...
>
>
In that case, you definitely want FunctionalDependencies or TypeFamilies,
and will probably want to drop the constraint (Handler e d) on Event e (if
it doesn't work), and maybe enforce it with explicit exports.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20120616/80498a48/attachment.htm>


More information about the Haskell-Cafe mailing list