stupid newbie question about `removeKeysP`

Hi, I'm slowly going nuts here. This is my complete xmonad.hs file: ------------------------------------------- import XMonad import XMonad.Config.Gnome import XMonad.Util.EZConfig main = xmonad gnomeConfig {terminal = "urxvtcd" } `removeKeysP` ["M-b","M-."] ------------------------------------------- And when I try to use it I get these errors: ------------------------------------------- xmonad.hs:5:7: Couldn't match expected type `XConfig l' against inferred type `IO ()' In the first argument of `removeKeysP', namely `xmonad (gnomeConfig {terminal = "urxvtcd"})' In the expression: xmonad (gnomeConfig {terminal = "urxvtcd"}) `removeKeysP` ["M-b", "M-."] In the definition of `main': main = xmonad (gnomeConfig {terminal = "urxvtcd"}) `removeKeysP` ["M-b", "M-."] Please check the file for errors. ------------------------------------------- Where have I gone wrong? /Jonas

Try this (untested code, note the '$'):
main = xmonad $ gnomeConfig
{terminal = "urxvtcd"
}
`removeKeysP` ["M-b","M-."]
Which is equivalent to, or a shorthand for:
main = xmonad (gnomeConfig
{terminal = "urxvtcd"
}
`removeKeysP` ["M-b","M-."])
`removeKeysP` is in your code applied to the arguments:
arg1: xmonad gnomeConfig {terminal = "urxvtcd"}
arg2: ["M-b","M-."]
Hope that helps.
/Anders
On Wed, May 5, 2010 at 21:37, Jonas Bygdén
Hi, I'm slowly going nuts here. This is my complete xmonad.hs file: ------------------------------------------- import XMonad import XMonad.Config.Gnome import XMonad.Util.EZConfig main = xmonad gnomeConfig {terminal = "urxvtcd" } `removeKeysP` ["M-b","M-."] ------------------------------------------- And when I try to use it I get these errors: ------------------------------------------- xmonad.hs:5:7: Couldn't match expected type `XConfig l' against inferred type `IO ()' In the first argument of `removeKeysP', namely `xmonad (gnomeConfig {terminal = "urxvtcd"})' In the expression: xmonad (gnomeConfig {terminal = "urxvtcd"}) `removeKeysP` ["M-b", "M-."] In the definition of `main': main = xmonad (gnomeConfig {terminal = "urxvtcd"}) `removeKeysP` ["M-b", "M-."] Please check the file for errors. ------------------------------------------- Where have I gone wrong? /Jonas _______________________________________________ xmonad mailing list xmonad@haskell.org http://www.haskell.org/mailman/listinfo/xmonad

On 05/05/10 at 10:04pm, Anders Engström wrote:
Try this (untested code, note the '$'): main = xmonad $ gnomeConfig {terminal = "urxvtcd" } `removeKeysP` ["M-b","M-."]
Which is equivalent to, or a shorthand for: main = xmonad (gnomeConfig {terminal = "urxvtcd" } `removeKeysP` ["M-b","M-."])
`removeKeysP` is in your code applied to the arguments: arg1: xmonad gnomeConfig {terminal = "urxvtcd"} arg2: ["M-b","M-."]
Hope that helps. /Anders
On Wed, May 5, 2010 at 21:37, Jonas Bygdén
wrote: Hi, I'm slowly going nuts here. This is my complete xmonad.hs file: ------------------------------------------- import XMonad import XMonad.Config.Gnome import XMonad.Util.EZConfig main = xmonad gnomeConfig {terminal = "urxvtcd" } `removeKeysP` ["M-b","M-."] ------------------------------------------- And when I try to use it I get these errors: ------------------------------------------- xmonad.hs:5:7: Couldn't match expected type `XConfig l' against inferred type `IO ()' In the first argument of `removeKeysP', namely `xmonad (gnomeConfig {terminal = "urxvtcd"})' In the expression: xmonad (gnomeConfig {terminal = "urxvtcd"}) `removeKeysP` ["M-b", "M-."] In the definition of `main': main = xmonad (gnomeConfig {terminal = "urxvtcd"}) `removeKeysP` ["M-b", "M-."] Please check the file for errors. ------------------------------------------- Where have I gone wrong? /Jonas _______________________________________________ xmonad mailing list xmonad@haskell.org http://www.haskell.org/mailman/listinfo/xmonad
_______________________________________________ xmonad mailing list xmonad@haskell.org http://www.haskell.org/mailman/listinfo/xmonad
Don't you still need a 'do' somewhere in there? main = do xmonad $ gnomeConfig { terminal = "urxvtcd" } `removeKeysP` ["M-b", "M-."] should compile. I think all on one line looks more readable though: main = do xmonad $ gnomeConfig { terminal = "urxvtcd" } `removeKeysP` ["M-b", "M-."] Apologies if this doesn't work, I haven't compiled it myself. -- patrick brisbin

Actually, you don't need "do". Since xmonad with argument applied
becomes IO () and main is IO (). When you only have one statement
after do, it is an identity operation.
Actually, I cheated and looked at the docs which had this example:
main = xmonad $ defaultConfig { terminal = "urxvt" }
`removeKeysP` ["M-S-" ++ [n] | n <- ['1'..'9']]
On Wed, May 5, 2010 at 22:12, Patrick Brisbin
On 05/05/10 at 10:04pm, Anders Engström wrote:
Try this (untested code, note the '$'): main = xmonad $ gnomeConfig {terminal = "urxvtcd" } `removeKeysP` ["M-b","M-."]
Which is equivalent to, or a shorthand for: main = xmonad (gnomeConfig {terminal = "urxvtcd" } `removeKeysP` ["M-b","M-."])
`removeKeysP` is in your code applied to the arguments: arg1: xmonad gnomeConfig {terminal = "urxvtcd"} arg2: ["M-b","M-."]
Hope that helps. /Anders
On Wed, May 5, 2010 at 21:37, Jonas Bygdén
wrote: Hi, I'm slowly going nuts here. This is my complete xmonad.hs file: ------------------------------------------- import XMonad import XMonad.Config.Gnome import XMonad.Util.EZConfig main = xmonad gnomeConfig {terminal = "urxvtcd" } `removeKeysP` ["M-b","M-."] ------------------------------------------- And when I try to use it I get these errors: ------------------------------------------- xmonad.hs:5:7: Couldn't match expected type `XConfig l' against inferred type `IO ()' In the first argument of `removeKeysP', namely `xmonad (gnomeConfig {terminal = "urxvtcd"})' In the expression: xmonad (gnomeConfig {terminal = "urxvtcd"}) `removeKeysP` ["M-b", "M-."] In the definition of `main': main = xmonad (gnomeConfig {terminal = "urxvtcd"}) `removeKeysP` ["M-b", "M-."] Please check the file for errors. ------------------------------------------- Where have I gone wrong? /Jonas _______________________________________________ xmonad mailing list xmonad@haskell.org http://www.haskell.org/mailman/listinfo/xmonad
_______________________________________________ xmonad mailing list xmonad@haskell.org http://www.haskell.org/mailman/listinfo/xmonad
Don't you still need a 'do' somewhere in there?
main = do xmonad $ gnomeConfig { terminal = "urxvtcd" } `removeKeysP` ["M-b", "M-."]
should compile.
I think all on one line looks more readable though:
main = do xmonad $ gnomeConfig { terminal = "urxvtcd" } `removeKeysP` ["M-b", "M-."]
Apologies if this doesn't work, I haven't compiled it myself.
-- patrick brisbin _______________________________________________ xmonad mailing list xmonad@haskell.org http://www.haskell.org/mailman/listinfo/xmonad

On 05/05/10 at 10:26pm, Anders Engström wrote:
Actually, you don't need "do". Since xmonad with argument applied becomes IO () and main is IO (). When you only have one statement after do, it is an identity operation.
Thanks. Though I don't /completely/ understand it, I'll try to remember it :). -- patrick brisbin

Thanks Anders,
I've been staring myself blind at that very example that you included here
from the docs and couldn't understand what I did wrong - until you told me
the $ was missing.
Thanks again.
2010/5/5 Anders Engström
Actually, you don't need "do". Since xmonad with argument applied becomes IO () and main is IO (). When you only have one statement after do, it is an identity operation.
Actually, I cheated and looked at the docs which had this example: main = xmonad $ defaultConfig { terminal = "urxvt" } `removeKeysP` ["M-S-" ++ [n] | n <- ['1'..'9']]
On Wed, May 5, 2010 at 22:12, Patrick Brisbin
wrote: On 05/05/10 at 10:04pm, Anders Engström wrote:
Try this (untested code, note the '$'): main = xmonad $ gnomeConfig {terminal = "urxvtcd" } `removeKeysP` ["M-b","M-."]
Which is equivalent to, or a shorthand for: main = xmonad (gnomeConfig {terminal = "urxvtcd" } `removeKeysP` ["M-b","M-."])
`removeKeysP` is in your code applied to the arguments: arg1: xmonad gnomeConfig {terminal = "urxvtcd"} arg2: ["M-b","M-."]
Hope that helps. /Anders
On Wed, May 5, 2010 at 21:37, Jonas Bygdén
wrote: Hi, I'm slowly going nuts here. This is my complete xmonad.hs file: ------------------------------------------- import XMonad import XMonad.Config.Gnome import XMonad.Util.EZConfig main = xmonad gnomeConfig {terminal = "urxvtcd" } `removeKeysP` ["M-b","M-."] ------------------------------------------- And when I try to use it I get these errors: ------------------------------------------- xmonad.hs:5:7: Couldn't match expected type `XConfig l' against inferred type `IO ()' In the first argument of `removeKeysP', namely `xmonad (gnomeConfig {terminal = "urxvtcd"})' In the expression: xmonad (gnomeConfig {terminal = "urxvtcd"}) `removeKeysP` ["M-b", "M-."] In the definition of `main': main = xmonad (gnomeConfig {terminal = "urxvtcd"}) `removeKeysP` ["M-b", "M-."] Please check the file for errors. ------------------------------------------- Where have I gone wrong? /Jonas _______________________________________________ xmonad mailing list xmonad@haskell.org http://www.haskell.org/mailman/listinfo/xmonad
_______________________________________________ xmonad mailing list xmonad@haskell.org http://www.haskell.org/mailman/listinfo/xmonad
Don't you still need a 'do' somewhere in there?
main = do xmonad $ gnomeConfig { terminal = "urxvtcd" } `removeKeysP` ["M-b", "M-."]
should compile.
I think all on one line looks more readable though:
main = do xmonad $ gnomeConfig { terminal = "urxvtcd" } `removeKeysP` ["M-b", "M-."]
Apologies if this doesn't work, I haven't compiled it myself.
-- patrick brisbin _______________________________________________ xmonad mailing list xmonad@haskell.org http://www.haskell.org/mailman/listinfo/xmonad
_______________________________________________ xmonad mailing list xmonad@haskell.org http://www.haskell.org/mailman/listinfo/xmonad

On Wed, May 5, 2010 at 4:12 PM, Patrick Brisbin
On 05/05/10 at 10:04pm, Anders Engström wrote:
Try this (untested code, note the '$'): main = xmonad $ gnomeConfig {terminal = "urxvtcd" } `removeKeysP` ["M-b","M-."]
Which is equivalent to, or a shorthand for: main = xmonad (gnomeConfig {terminal = "urxvtcd" } `removeKeysP` ["M-b","M-."])
`removeKeysP` is in your code applied to the arguments: arg1: xmonad gnomeConfig {terminal = "urxvtcd"} arg2: ["M-b","M-."]
Hope that helps. /Anders
On Wed, May 5, 2010 at 21:37, Jonas Bygdén
wrote: Hi, I'm slowly going nuts here. This is my complete xmonad.hs file: ------------------------------------------- import XMonad import XMonad.Config.Gnome import XMonad.Util.EZConfig main = xmonad gnomeConfig {terminal = "urxvtcd" } `removeKeysP` ["M-b","M-."] ------------------------------------------- And when I try to use it I get these errors: ------------------------------------------- xmonad.hs:5:7: Couldn't match expected type `XConfig l' against inferred type `IO ()' In the first argument of `removeKeysP', namely `xmonad (gnomeConfig {terminal = "urxvtcd"})' In the expression: xmonad (gnomeConfig {terminal = "urxvtcd"}) `removeKeysP` ["M-b", "M-."] In the definition of `main': main = xmonad (gnomeConfig {terminal = "urxvtcd"}) `removeKeysP` ["M-b", "M-."] Please check the file for errors. ------------------------------------------- Where have I gone wrong? /Jonas _______________________________________________ xmonad mailing list xmonad@haskell.org http://www.haskell.org/mailman/listinfo/xmonad
_______________________________________________ xmonad mailing list xmonad@haskell.org http://www.haskell.org/mailman/listinfo/xmonad
Don't you still need a 'do' somewhere in there?
main = do xmonad $ gnomeConfig { terminal = "urxvtcd" } `removeKeysP` ["M-b", "M-."]
should compile.
I think all on one line looks more readable though:
main = do xmonad $ gnomeConfig { terminal = "urxvtcd" } `removeKeysP` ["M-b", "M-."]
Apologies if this doesn't work, I haven't compiled it myself.
No; do-notation is only necessary if you're using any syntax like the let bindings or <- or newlines - stuff which desugars to use of monadic functions like >> or >>=. This is all straight function calls. Hlint will even tell you that the do is unnecessary: hlint foo.hs foo.hs:1:9: Error: Redundant do Found: do xmonad $ gnomeConfig{terminal = "urxvtcd"} `removeKeysP` ["M-b", "M-."] Why not: xmonad $ gnomeConfig{terminal = "urxvtcd"} `removeKeysP` ["M-b", "M-."] Found 1 suggestion (1 error) -- gwern

On Wed, May 5, 2010 at 3:37 PM, Jonas Bygdén
import XMonad import XMonad.Config.Gnome import XMonad.Util.EZConfig main = xmonad gnomeConfig {terminal = "urxvtcd" } `removeKeysP` ["M-b","M-."]
When in doubt, parenthesize. ---- main = xmonad (gnomeConfig {terminal = "urxvtcd" }) `removeKeysP` ["M-b","M-."] /home/gwern/foo.hs:5:7: Couldn't match expected type `XConfig l' against inferred type `IO ()' In the first argument of `removeKeysP', namely `xmonad (gnomeConfig {terminal = "urxvtcd"})' In the expression: xmonad (gnomeConfig {terminal = "urxvtcd"}) `removeKeysP` ["M-b", "M-."] In the definition of `main': main = xmonad (gnomeConfig {terminal = "urxvtcd"}) `removeKeysP` ["M-b", "M-."] ---- ---- import XMonad import XMonad.Config.Gnome import XMonad.Util.EZConfig main = xmonad ((gnomeConfig {terminal = "urxvtcd" }) `removeKeysP` ["M-b","M-."]) /home/gwern/foo.hs:5:0: Warning: Definition but no type signature for `main' Inferred type: main :: IO () ---- Do you understand why? -- gwern
participants (4)
-
Anders Engström
-
Gwern Branwen
-
Jonas Bygdén
-
Patrick Brisbin