[Haskell-cafe] I/O Haskell question

Maria Boghiu maria.boghiu at gmail.com
Mon Oct 5 09:48:56 EDT 2009


I'm trying to configure Xmonad, the window manager.

for this purpose, I'm trying to read the *workspaces* variable in the code
below from file.
As you can see, I do workspaces = readWS where
readWS = do
         l <- readFile "~/bla"
         return l*

I get an error saying I am mismatching types IO [String] and [String].
But I thought that once one does * l <- readFile "~/bla"*, l is the a string
or, in this case, a String list. If I run that line in prelude it seems to
be working fine, prints the content of the file "~/bla" on screen (though
I'm not sure if as a String or as a list of Strings, i.e. [String])

Can anyone help please?
I've been struggling with this for days...

94 main = do
 95         xmonad
 96         $ defaultConfig {
 97         manageHook         = manageDocks <+> myManageHook <+> manageHook
 98         layoutHook         = avoidStruts $ layoutHook defaultConfig,
 99         logHook            = dynamicLogWithPP $ conkyPP "",
100         terminal           = "gnome-terminal",
101         keys               = myKeys,
102         workspaces         = readWS,
103         mouseBindings      = myMouseBindings,
104         focusedBorderColor = "#008E00",
105         borderWidth        = 3
106         --modMask            = mod1Mask, --This is to rebind mod key
107         } `additionalKeys`
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/haskell-cafe/attachments/20091005/f5a74403/attachment.html

More information about the Haskell-Cafe mailing list