> <span style="font-family:arial,sans-serif;font-size:13px">the result </span><span style="font-family:arial,sans-serif;font-size:13px">is of type [()] but for a cartesian n-product, you would like [[a]]</span><br style="font-family:arial,sans-serif;font-size:13px">
<div><span style="font-family:arial,sans-serif;font-size:13px"><br></span></div><div><span style="font-family:arial,sans-serif;font-size:13px">Right. So what we have here is a product over a count of 0 sets, which is isomorphic to the function space that has the null set as domain. The latter has exactly one element: the trivial function.</span></div>
<div><span style="font-family:arial,sans-serif;font-size:13px"><br></span></div><div><span style="font-family:arial,sans-serif;font-size:13px">My apologies for misreading what OP wrote:</span></div><div><span style="font-family:arial,sans-serif;font-size:13px"><br>
</span></div><div><span style="color:rgb(80,0,80);font-family:arial,sans-serif;font-size:13px">> This looks to me to be a violation of the rule that the Cartesian</span><br style="color:rgb(80,0,80);font-family:arial,sans-serif;font-size:13px">
<span style="color:rgb(80,0,80);font-family:arial,sans-serif;font-size:13px">> product of an empty list of lists is a list with one element i</span><span style="color:rgb(80,0,80);font-family:arial,sans-serif;font-size:13px">n</span><div style="color:rgb(80,0,80);font-family:arial,sans-serif;font-size:13px">
> it.</div></div><div><br></div><div>I thought he meant something along the lines of sequence ["","x"].</div><div><span style="font-family:arial,sans-serif;font-size:13px"><br></span></div><div class="gmail_extra">
<br clear="all"><div>-- Kim-Ee</div>
<br><br><div class="gmail_quote">On Mon, Dec 24, 2012 at 4:42 PM, Chaddaï Fouché <span dir="ltr"><<a href="mailto:chaddai.fouche@gmail.com" target="_blank">chaddai.fouche@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="im">On Mon, Dec 24, 2012 at 8:01 AM, Jay Sulzberger <<a href="mailto:jays@panix.com">jays@panix.com</a>> wrote:<br>
><br>
> > sequence []<br>
> []<br>
> it :: [()]<br>
><br>
> This looks to me to be a violation of the rule that the Cartesian<br>
> product of an empty list of lists is a list with one element in<br>
> it. It looks to be a violation because "[]" looks like a name<br>
> for an empty list. But we also have<br>
><br>
> > length (sequence [])<br>
> 1<br>
> it :: Int<br>
><br>
> which almost reassures me.<br>
><br>
<br>
</div>Well the type of the first response is a dead give-away : the result<br>
is of type [()] but for a cartesian n-product, you would like [[a]]<br>
(with a maybe instantiated to a concrete type) ...<br>
What's happening here is that sequence is not "the cartesian<br>
n-product" in general, it is only that in the list monad but in<br>
"sequence []" there's nothing to indicate that we're in the list<br>
monad, so GHC default to the IO monad and unit () so sequence has the<br>
type "[IO ()] -> IO [()]" and there's no IO action in the list<br>
parameter, so there's nothing in the result list.<br>
<br>
Try :<br>
> sequence [] :: [[Int]]<br>
and you should be reassured.<br>
<br>
--<br>
Jedaï<br>
<div class="HOEnZb"><div class="h5"><br>
_______________________________________________<br>
Beginners mailing list<br>
<a href="mailto:Beginners@haskell.org">Beginners@haskell.org</a><br>
<a href="http://www.haskell.org/mailman/listinfo/beginners" target="_blank">http://www.haskell.org/mailman/listinfo/beginners</a><br>
</div></div></blockquote></div><br></div>