[Haskell-cafe] Conditional IO ?
Eugene Kirpichov
ekirpichov at gmail.com
Mon Jun 20 10:08:21 CEST 2011
| otherwise = return ()
or:
handleParseErrors errors = when (not . null $ errors) $ writeFile .....
2011/6/20 Dmitri O.Kondratiev <dokondr at gmail.com>:
> Hi,
> What is right way to do conditional IO?
> For example, I need to write to file errors only in case they exist,
> otherwise my function should do nothing:
>
> handleParseErrors errors
> | (not . null) errors = writeFile "parse-errors.txt" (show errors)
> | otherwise = ?
>
> What should be an 'otherwise' case ?
>
> Thanks!
>
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
>
>
--
Eugene Kirpichov
Principal Engineer, Mirantis Inc. http://www.mirantis.com/
Editor, http://fprog.ru/
More information about the Haskell-Cafe
mailing list