<div dir="auto"><div>Not like that, no. The Set type is explicitly for *finite* sets only. fromList [1..] is bottom and will run out of memory. You'd need a *very* different implementation to be able to support infinite sets at all, and even then you'd only catch certain special cases.<br><br><div class="gmail_quote"><div dir="ltr">On Sat, Dec 8, 2018, 7:46 PM Jeffrey Brown <<a href="mailto:jeffbrown.the@gmail.com">jeffbrown.the@gmail.com</a> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">The following expressions both cause GHCI to hang:<div><span style="font-family:monospace"><span style="color:rgb(0,0,0)">
</span><br>> S.intersection (S.fromList [1,2]) (S.fromList [1..])
<br>fromList ^CInterrupted.
<br>> S.intersection (S.fromList [1..]) (S.fromList [1,2])
<br>fromList ^CInterrupted.
<br>> <br>
<br></span><div>Is there a smarter way to take the intersection of sets when at least one of them is small (but I don't know which one that is)?</div><div><br></div>-- <br><div dir="ltr" class="m_-519756800252006756gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div>Jeff Brown | Jeffrey Benjamin Brown</div><div dir="ltr"><a href="https://msu.edu/~brown202/" style="font-size:12.8px" target="_blank" rel="noreferrer">Website</a>   |   <a href="https://www.facebook.com/mejeff.younotjeff" style="font-size:12.8px" target="_blank" rel="noreferrer">Facebook</a>   |   <a href="https://www.linkedin.com/in/jeffreybenjaminbrown" style="font-size:12.8px" target="_blank" rel="noreferrer">LinkedIn</a><span style="font-size:12.8px">(spammy, so I often miss messages here)   </span><span style="font-size:12.8px">|</span><span style="font-size:12.8px">   </span><a href="https://github.com/jeffreybenjaminbrown" style="font-size:12.8px" target="_blank" rel="noreferrer">Github</a><span style="font-size:12.8px">   </span></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div>
_______________________________________________<br>
Haskell-Cafe mailing list<br>
To (un)subscribe, modify options or view archives go to:<br>
<a href="http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe" rel="noreferrer noreferrer" target="_blank">http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe</a><br>
Only members subscribed via the mailman list are allowed to post.</blockquote></div></div></div>