summaryrefslogtreecommitdiffstats
path: root/Config.hs
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 /Config.hs
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 'Config.hs')
-rw-r--r--Config.hs4
1 files changed, 2 insertions, 2 deletions
diff --git a/Config.hs b/Config.hs
index 841b3ee..196515d 100644
--- a/Config.hs
+++ b/Config.hs
@@ -154,8 +154,8 @@ keys = M.fromList $
, ((modMask, xK_j ), raise GT)
, ((modMask, xK_k ), raise LT)
- , ((modMask, xK_h ), layoutMsg Shrink)
- , ((modMask, xK_l ), layoutMsg Expand)
+ , ((modMask, xK_h ), sendMessage Shrink)
+ , ((modMask, xK_l ), sendMessage Expand)
, ((modMask .|. shiftMask, xK_c ), kill)