[xmonad] Help with Actions.Search

Brent Yorgey byorgey at seas.upenn.edu
Sat Oct 1 20:10:48 CEST 2011


Hi Desai,

The problem is that both searchList and searchEngineMap need to be
just top-level definitions, with no indentation, like so:

       ...
       ++ [("M-s " ++ k, S.promptSearch P.defaultXPConfig f) | (k,f) <- searchList ]
       ++ [("M-S-s " ++ k, S.selectSearch f) | (k,f) <- searchList ]
 
searchList :: [(String, S.SearchEngine)]
searchList = [ ("g", S.google)
             , ("h", S.hoohle)
             , ("w", S.wikipedia)
             ]

In the searchList case it does not even make syntactic sense to put
searchList where you have it, at the end of an expression.  In the
case of searchEngineMap, the way you have wrote it is as if you are
setting a field called 'searchEngineMap' within the configuration
record, but the configuration record does not have such a field.
Instead, you simply want to define a new function called
searchEngineMap, which you can do by writing

searchEngineMap method = M.fromList $
                         [ ((0, xK_g), method S.google)
                         , ((0, xK_h), method S.hoogle)
                         , ((0, xK_w), method S.wikipedia)
                         ]              

unindented, by itself.

I think there may be a few other errors in those configuration files
but hopefully this will get you started down the right path.  Feel
free to ask for more help either here on this list, or in the #xmonad
IRC channel on Freenode.  If you are interested, it would probably
also help you a lot to read just the first few chapters of a Haskell
tutorial such as http://learnyouahaskell.com .

-Brent

On Sat, Oct 01, 2011 at 05:04:51AM -0500, Desai Shukla wrote:
> These are my two attempts at getting Actions.Search to work:
> http://sprunge.us/TYfX
> http://sprunge.us/MXGH
> 
> The first paste is with just Haskell code, and the second is with what looks
> like syntactic sugar via the EZConfig module. I'm new I'm new to Haskell and
> Xmonad, and I'm unsure where to put the searchEngineMap method (constructor
> function?) lines in the first paste. I'm unsure where to put the searchList
> type declaration and list in the second. I'm lost. Help is appreciated.
> 
> --
> Desai

> _______________________________________________
> xmonad mailing list
> xmonad at haskell.org
> http://www.haskell.org/mailman/listinfo/xmonad




More information about the xmonad mailing list