From ba6e32758d41f1117fc125b32008c2f411eec8b1 Mon Sep 17 00:00:00 2001 From: Don Stewart Date: Fri, 4 May 2007 10:16:49 +0200 Subject: 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 darcs-hash:20070504081649-9c5c1-954b406e8c21c2ca4428960e4fc1f9ffb17fb296.gz --- Config.hs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'Config.hs') 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) -- cgit v1.2.3