[xmonad] Re: Compile-time verification of keymaps

wagnerdm at seas.upenn.edu wagnerdm at seas.upenn.edu
Wed Mar 24 02:53:36 EDT 2010

Quoting Adam Vogt <vogt.adam at gmail.com>:

> I don't quite understand how -fwarn-overlapping-patterns can be used to
> avoid overlapping keybinds: you suggest replacing the (Map Key (X ()))
> with a function   (Key -> Maybe (X ())) (with the maybe possibly added
> by catching pattern match failures)?  Performance probably doesn't
> matter here, but I believe pattern matches are tried one after the
> other, as compared to Data.Map which is a bit smarter than that.

Something like that, yes, though changing the interface to core  
functionality has historically been a hard sell. Rather, I would  
suggest writing keybindings as a function, then reifying the function  
as a Data.Map in the configuration value both for  
backwards-compatibility and (as you say) for performance reasons. This  
shouldn't be too hard, assuming there's a reasonably short range of  
possible keys, which seems pretty likely.


More information about the xmonad mailing list