[Haskell-beginners] firering event in netwire

Nathan Hüsken nathan.huesken at posteo.de
Sat Sep 29 04:07:42 CEST 2012

I believe I can now at least partly answer my own question:
Assuming my input is a list of Key events:

data KeyEvent = KeyDown Int | KeyUp Int

than the event wire:

keyDown code = when (`elem` KeyDown code) :: Event () (->) [KeyEvent]

would produce when the key with the given code is pressed down.

On 09/28/2012 08:19 PM, Nathan Hüsken wrote:
> Hey,
> I have a few question about the usage of netwire:
> How do I fire events?
> For example my main wire should take keyboard events as input and output
> some state (which is than somehow outputed).
> I see that there is an event type, which has the some type as the
> identiy wire. I am just not sure how to use it?
> Or asked differently, how is the "keyDown" event defined, that was
> talked of in an earlier mail?
> Thanks!
> Nathan
> _______________________________________________
> Beginners mailing list
> Beginners at haskell.org
> http://www.haskell.org/mailman/listinfo/beginners

More information about the Beginners mailing list