
10 Mar
2008
10 Mar
'08
6:17 p.m.
Hi
I would like to know if in fact there's any difference in practice between (), [()], i.e. if in practice the difference matters.
Usually, not so much. A lot of Monad functions have _ variants, i.e. mapM and mapM_. If you don't need the result, use the mapM_ version, as it will run faster and not space/stack leak in some circumstances.
By the way, as a consequence can you possibly get IO (()) or IO ([()]) and are these all different from each other?
Read () as Unit. You can't put anything in a Unit, even if the bracket notation subtly suggests you can. You can have IO Unit and IO [Unit], but not IO Un(Unit)it or IO Un([Unit])it. The two types you gave can't exist. Thanks Neil