summaryrefslogtreecommitdiffstats
path: root/man
diff options
context:
space:
mode:
authorDon Stewart <dons@cse.unsw.edu.au>2007-05-04 10:16:49 +0200
committerDon Stewart <dons@cse.unsw.edu.au>2007-05-04 10:16:49 +0200
commitd93284dd514485bdc06c1bb6b984608271804dcb (patch)
tree5eb85dcf427ef8a924fe45d4feb2a61c24ca156b /man
parent7d2c080540f57cfb4bca155cf27b792c7e5d2d8c (diff)
downloadmetatile-d93284dd514485bdc06c1bb6b984608271804dcb.tar
metatile-d93284dd514485bdc06c1bb6b984608271804dcb.zip
Constrain layout messages to be members of a Message class
Using Typeables as the only constraint on layout messages is a bit scary, as a user can send arbitrary values to layoutMsg, whether they make sense or not: there's basically no type feedback on the values you supply to layoutMsg. Folloing Simon Marlow's dynamically extensible exceptions paper, we use an existential type, and a Message type class, to constrain valid arguments to layoutMsg to be valid members of Message. That is, a user writes some data type for messages their layout algorithm accepts: data MyLayoutEvent = Zoom | Explode | Flaming3DGlassEffect deriving (Typeable) and they then add this to the set of valid message types: instance Message MyLayoutEvent Done. We also reimplement the dynamic type check while we're here, to just directly use 'cast', rather than expose a raw fromDynamic/toDyn. With this, I'm much happier about out dynamically extensible layout event subsystem. darcs-hash:20070504081649-9c5c1-954b406e8c21c2ca4428960e4fc1f9ffb17fb296
Diffstat (limited to 'man')
0 files changed, 0 insertions, 0 deletions