[Haskell-cafe] I/O Haskell question

Keith Sheppard keithshep at gmail.com
Mon Oct 5 10:27:23 EDT 2009


I have to nominate "I'm lying here, but for a good cause" as a quote
of the week.

-Keith

On Mon, Oct 5, 2009 at 10:06 AM, Deniz Dogan <deniz.a.m.dogan at gmail.com> wrote:
> 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
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
>



-- 
keithsheppard.name


More information about the Haskell-Cafe mailing list