Now, I'm still learning haskell (to configure my xmonad wm), so bear with me.
I've written this function:
doesNameBeginWith :: String -> Query Bool
doesNameBeginWith str = fmap ( str `isPrefixOf`) (stringProperty "WM_NAME")
Which will check the start of the WM_NAME X property against my str. I can compose it like this:
isMusic = doesNameBeginWith "MPD:" <||> doesNameBeginWith "ncmpcpp"
It works. Now I want to write a functions with this signature:
[String] -> Query Bool
so that I can call it like this:
isMusic = doesNameBeginWith ["MPD:", "ncmpcpp"]
The idea was to use foldr1 to parse the string list, but I can't figure out the sintax to get the head of the list... something like this:
doesNameBeginWith :: [String] -> Query Bool
doesNameBeginWith str = foldr1 (<||>) . fmap ( (head str) `isPrefixOf`) (stringProperty "WM_NAME")
EDIT 1: as leftaroundabout suggested, I can combine two functions to get what I want:
doesNameBeginWithL :: [String] -> Query Bool
doesNameBeginWithL = foldr1 (<||>) . map doesNameBeginWith
But I'm still hoping for a more direct way and to understand how list heads could be used in this situation!
EDIT 2: Thank you all again for your answers, all of them have been quite informative! :)