Misleading documentation for XMonad.Actions.Search

The documentation for (!>) in XMonad.Actions.Search is misleading. The documentation says "> multiEngine = intelligent (wikipedia !> mathworld !> (prefixAware google))", but this syntax doesn't provide the expected behaviour. See *XMonad.Actions.Search> use (wikipedia !> hoogle !> prefixAware google) "hoogle:foo" "http://www.google.com/search?num=100&q=hoogle%3Afoo" compared to: *XMonad.Actions.Search> use (wikipedia !> (hoogle !> (prefixAware google))) "hoogle:foo" "http://www.haskell.org/hoogle/?q=foo" I propose changing the documentation from <snip>"intelligent (wikipedia !> mathworld !> (prefixAware google))"</snip> to <snip>"intelligent (wikipedia !> (mathworld !> (prefixAware google)))"</snip>

On Sun, Mar 20, 2011 at 4:54 PM, Mats Rauhala
The documentation for (!>) in XMonad.Actions.Search is misleading. The documentation says "> multiEngine = intelligent (wikipedia !> mathworld !> (prefixAware google))", but this syntax doesn't provide the expected behaviour.
See
*XMonad.Actions.Search> use (wikipedia !> hoogle !> prefixAware google) "hoogle:foo" "http://www.google.com/search?num=100&q=hoogle%3Afoo"
compared to:
*XMonad.Actions.Search> use (wikipedia !> (hoogle !> (prefixAware google))) "hoogle:foo" "http://www.haskell.org/hoogle/?q=foo"
I propose changing the documentation from <snip>"intelligent (wikipedia !> mathworld !> (prefixAware google))"</snip> to <snip>"intelligent (wikipedia !> (mathworld !> (prefixAware google)))"</snip>
I never use this particular functionality (nor did I write it; Michal Trybus apparently did), but is this *desired* behavior? I mean, adding a infixity declaration would seem to bring the code back into correspondence with the documentation rather than the other way around. If you add hunk ./XMonad/Actions/Search.hs 327 +infixr 7 !> + Then GHCi seems to give the documentation's results: *XMonad.Actions.Search Control.Monad Data.Char Data.List> use (wikipedia !> hoogle !> prefixAware google) "hoogle:foo" Loading package X11-1.5.0.0 ... linking ... done. Loading package utf8-string-0.3.6 ... linking ... done. Loading package xmonad-0.10 ... linking ... done. "http://www.haskell.org/hoogle/?q=foo" -- gwern http://www.gwern.net

Excerpts from Gwern Branwen's message of Mon Mar 21 16:00:51 -0600 2011:
On Sun, Mar 20, 2011 at 4:54 PM, Mats Rauhala
wrote: The documentation for (!>) in XMonad.Actions.Search is misleading. The documentation says "> multiEngine = intelligent (wikipedia !> mathworld !> (prefixAware google))", but this syntax doesn't provide the expected behaviour. ..
I never use this particular functionality (nor did I write it; Michal Trybus apparently did), but is this *desired* behavior? I mean, adding a infixity declaration would seem to bring the code back into correspondence with the documentation rather than the other way around. If you add
hunk ./XMonad/Actions/Search.hs 327 +infixr 7 !> +
Then GHCi seems to give the documentation's results:
*XMonad.Actions.Search Control.Monad Data.Char Data.List> use (wikipedia !> hoogle !> prefixAware google) "hoogle:foo" Loading package X11-1.5.0.0 ... linking ... done. Loading package utf8-string-0.3.6 ... linking ... done. Loading package xmonad-0.10 ... linking ... done. "http://www.haskell.org/hoogle/?q=foo"
I've also not used this before, but may now that I'm aware of it. Yes, adding the infix declaration seems a preferable solution. Something else to note and fix is that as it stands in the current darcs version, wikipedia and wiktionary don't work properly with any of these intelligent searches. (Probably because their urls contain the ':' character.) Haven't looked much at the code, but if it's not an obvious fix... Rather than making the parsing even more complicated, hopefully there will be alternate urls that will work. If I get a chance I'll check that out later this week. Or it could just be noted in the docs and then yank them from the `multi' foldr1. regards, wmw

On Mon, Mar 21, 2011 at 7:52 PM, Wirt Wolff
Something else to note and fix is that as it stands in the current darcs version, wikipedia and wiktionary don't work properly with any of these intelligent searches. (Probably because their urls contain the ':' character.)
I don't follow. At least with the infixr, output seems correct: *XMonad.Actions.Search Control.Monad Data.Char Data.List> use (wikipedia !> hoogle !> prefixAware google) "wiki:foo" "http://en.wikipedia.org/wiki/Special:Search?go=Go&search=foo" *XMonad.Actions.Search Control.Monad Data.Char Data.List> use (wikipedia !> hoogle !> prefixAware google) "hoogle:foo" "http://www.haskell.org/hoogle/?q=foo" *XMonad.Actions.Search Control.Monad Data.Char Data.List> use multi "wiki:foo" "http://en.wikipedia.org/wiki/Special:Search?go=Go&search=foo" *XMonad.Actions.Search Control.Monad Data.Char Data.List> use multi "wikt:foo" "http://en.wiktionary.org/wiki/Special:Search?go=Go&search=foo" The URLs seem to work when I use them. -- gwern http://www.gwern.net
participants (3)
-
Gwern Branwen
-
Mats Rauhala
-
Wirt Wolff