Yes, I wish Haskell had a 1-tuple.&nbsp; The obvious syntax is already taken, but I could accept something different, like &#39;One a&#39;.<br><br><div class="gmail_quote">On Mon, Mar 10, 2008 at 11:17 PM, Dan Weston &lt;<a href="mailto:westondan@imageworks.com">westondan@imageworks.com</a>&gt; wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">I understand the lack of distinction between a unit type and a 0-tuple,<br>
since they are isomorphic. But it is strange that there is no 1-tuple,<br>
since _|_ and the 1-tuple (_|_) would be different things entirely, no?<br>
<br>
Dan<br>
<div class="Ih2E3d"><br>
Rodrigo Queiro wrote:<br>
&gt; You&#39;re looking for mapM_<br>
&gt; mapM_ :: (Monad m) =&gt; (a -&gt; m b) -&gt; [a] -&gt; m ()<br>
&gt; (see also sequence_ :: (Monad m) =&gt; [m a] -&gt; m () )<br>
&gt;<br>
&gt; I don&#39;t think that it is possible to have a 1-tuples, just 2 and up. ()<br>
&gt; is a unit rather than a 0-tuple, apparently:<br>
&gt; <a href="http://www.haskell.org/onlinereport/basic.html#sect6.1.4" target="_blank">http://www.haskell.org/onlinereport/basic.html#sect6.1.4</a><br>
&gt;<br>
&gt; On 10/03/2008, *Paulo J. Matos* &lt;<a href="mailto:pocm@soton.ac.uk">pocm@soton.ac.uk</a><br>
</div><div class="Ih2E3d">&gt; &lt;mailto:<a href="mailto:pocm@soton.ac.uk">pocm@soton.ac.uk</a>&gt;&gt; wrote:<br>
&gt;<br>
&gt; &nbsp; &nbsp; Hello all,<br>
&gt;<br>
&gt; &nbsp; &nbsp; I find it funny that IO () is different from IO [()].<br>
&gt; &nbsp; &nbsp; For example, if I define a function to output some lines with mapT,<br>
&gt; &nbsp; &nbsp; I would do:<br>
&gt; &nbsp; &nbsp; outputLines :: Int -&gt; IO ()<br>
&gt; &nbsp; &nbsp; outputLines i = mapM (putStrLn . show) (take i $ iterate ((+) 1) 1)<br>
&gt;<br>
&gt; &nbsp; &nbsp; However, this is in fact<br>
&gt; &nbsp; &nbsp; outputLines :: Int -&gt; IO [()]<br>
&gt;<br>
&gt; &nbsp; &nbsp; I would like to know if in fact there&#39;s any difference in practice<br>
&gt; &nbsp; &nbsp; between (), [()], i.e. if in practice the difference matters.<br>
&gt; &nbsp; &nbsp; My first guess is that this is just a consequence of the Haskell type<br>
&gt; &nbsp; &nbsp; system and so that everything fits this really needs to be like this.<br>
&gt; &nbsp; &nbsp; Because<br>
&gt; &nbsp; &nbsp; mapM :: (Monad m) =&gt; (a -&gt; m b) -&gt; [a] -&gt; m [b]<br>
&gt;<br>
&gt; &nbsp; &nbsp; So I guess that it makes sense that you get IO [()] instead of IO (),<br>
&gt; &nbsp; &nbsp; and adding an exception just to say that [()] == () isn&#39;t good.<br>
&gt; &nbsp; &nbsp; By the way, as a consequence can you possibly get IO (()) or IO ([()])<br>
&gt; &nbsp; &nbsp; and are these all different from each other?<br>
&gt;<br>
&gt; &nbsp; &nbsp; Cheers,<br>
&gt;<br>
&gt; &nbsp; &nbsp; --<br>
</div>&gt; &nbsp; &nbsp; Paulo Jorge Matos - pocm at <a href="http://soton.ac.uk" target="_blank">soton.ac.uk</a> &lt;<a href="http://soton.ac.uk" target="_blank">http://soton.ac.uk</a>&gt;<br>
<div class="Ih2E3d">&gt; &nbsp; &nbsp; <a href="http://www.personal.soton.ac.uk/pocm" target="_blank">http://www.personal.soton.ac.uk/pocm</a><br>
&gt; &nbsp; &nbsp; PhD Student @ ECS<br>
&gt; &nbsp; &nbsp; University of Southampton, UK<br>
&gt; &nbsp; &nbsp; Sponsor ECS runners - Action against Hunger:<br>
&gt; &nbsp; &nbsp; <a href="http://www.justgiving.com/ecsrunslikethewind" target="_blank">http://www.justgiving.com/ecsrunslikethewind</a><br>
&gt; &nbsp; &nbsp; _______________________________________________<br>
&gt; &nbsp; &nbsp; Haskell-Cafe mailing list<br>
</div>&gt; &nbsp; &nbsp; <a href="mailto:Haskell-Cafe@haskell.org">Haskell-Cafe@haskell.org</a> &lt;mailto:<a href="mailto:Haskell-Cafe@haskell.org">Haskell-Cafe@haskell.org</a>&gt;<br>
<div class="Ih2E3d">&gt; &nbsp; &nbsp; <a href="http://www.haskell.org/mailman/listinfo/haskell-cafe" target="_blank">http://www.haskell.org/mailman/listinfo/haskell-cafe</a><br>
&gt;<br>
&gt;<br>
&gt;<br>
</div>&gt; ------------------------------------------------------------------------<br>
<div><div></div><div class="Wj3C7c">&gt;<br>
&gt; _______________________________________________<br>
&gt; Haskell-Cafe mailing list<br>
&gt; <a href="mailto:Haskell-Cafe@haskell.org">Haskell-Cafe@haskell.org</a><br>
&gt; <a href="http://www.haskell.org/mailman/listinfo/haskell-cafe" target="_blank">http://www.haskell.org/mailman/listinfo/haskell-cafe</a><br>
<br>
<br>
_______________________________________________<br>
Haskell-Cafe mailing list<br>
<a href="mailto:Haskell-Cafe@haskell.org">Haskell-Cafe@haskell.org</a><br>
<a href="http://www.haskell.org/mailman/listinfo/haskell-cafe" target="_blank">http://www.haskell.org/mailman/listinfo/haskell-cafe</a><br>
</div></div></blockquote></div><br>