[Haskell-cafe] I/O Haskell question

Deniz Dogan deniz.a.m.dogan at gmail.com
Mon Oct 5 10:06:07 EDT 2009

2009/10/5 Maria Boghiu <maria.boghiu at gmail.com>:
> I get an error saying I am mismatching types IO [String] and [String].

Something of the type IO [String] is a computation which does some IO
(reading files, launching nukes, etc.) and then returns a list of
strings. Something of the type [String] is merely a list of strings.
It is impossible (I'm lying here, but for a good cause) to "convert"
something on the form "IO a" to just "a".

Try something like this:

main = do
  fileContent <- readFile "/path/to/file"
  xmonad $ defaultConfig {
    workspaces = lines fileContent,
  } ...

Deniz Dogan

More information about the Haskell-Cafe mailing list