[Haskell-cafe] IO () and IO [()]

Dan Piponi dpiponi at gmail.com
Mon Mar 10 19:01:19 EDT 2008

On Mon, Mar 10, 2008 at 3:11 PM, Paulo J. Matos <pocm at soton.ac.uk> wrote:
>  I would like to know if in fact there's any difference in practice
>  between (), [()], i.e. if in practice the difference matters.

The type [()] is very similar to the type Integer and it's quite
different from () because you can count with it. For example:

main = do
    count <- mapM print ["Hello","World"]
    print $ "You printed " ++ show (length count) ++ " lines"

You can't do that with a IO (). Not that I actually recommend doing this.

More information about the Haskell-Cafe mailing list