qfpl / reflex-brick

Build terminal UIs using reflex and brick
BSD 3-Clause "New" or "Revised" License
14 stars 2 forks source link

Reconsider design for the event keys? #6

Closed LightAndLight closed 5 years ago

LightAndLight commented 5 years ago

Instead of RBAnyVtyEvent and RBAnyKey, we might want to try nesting keys.

So we'd have

data RBEvent a where
  RBVtyEvent :: RBEvent (DMap RBVtyEvent Identity)
  RBKey :: RBEvent (DMap RBKey Identity)
  ...

Then, given an ev :: EventSelector RBEvent, we can subscribe to 'any vty event' with select ev RBVtyEvent, and 'any key' with select ev RBKey. To further refine the vty/key events, we fan the result of the 'any vty event' or 'any key event', and select a specific event or keypress.

Is this extra layer of fanning burdensome?