
9 Feb
2009
9 Feb
'09
11:24 a.m.
mail:
Henri Ducrocq
writes: | For example | className =? "Google Mail" --> doShift "1" | className =? "Google Calendar" --> doShift "1" | would become | className <some regexp matching operator> "Google .*" doShift "1" | | How to do this in Haskell? I couldn't find any examples of this in the config | archive.. You can use one of the haskell regex libraries and define an operator for the managehook like so:
import Text.Regex.Posix ((=~))
q ~? x = fmap (=~ x) q
and then your example is simply
className ~? "Google .*" --> doShift "1"
Having someone interested write an extension module of regex combinators for this kind of thing would be useful. -- Don