<?xml version="1.0" encoding="ISO-8859-1"?>

<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/">
	<channel>
		<title>nntpnews.net - fa.haskell</title>
		<link>http://www.nntpnews.net</link>
		<description />
		<language>en</language>
		<lastBuildDate>Fri, 10 Sep 2010 21:40:21 GMT</lastBuildDate>
		<generator>vBulletin</generator>
		<ttl>60</ttl>
		<image>
			<url>http://www.nntpnews.net/fusion/misc/rss.jpg</url>
			<title>nntpnews.net - fa.haskell</title>
			<link>http://www.nntpnews.net</link>
		</image>
		<item>
			<title><![CDATA[Re: [Haskell-cafe] Dependent types]]></title>
			<link>http://www.nntpnews.net/showthread.php?t=17058815&amp;goto=newpost</link>
			<pubDate>Fri, 10 Sep 2010 12:50:59 GMT</pubDate>
			<description><![CDATA[Hi!

On Fri, Sep 10, 2010 at 9:22 AM, Stephen Tetley
<stephen.tetley@gmail.com> wrote:
> This issue pops up quite quite often - Ryan Ingram's answer...]]></description>
			<content:encoded><![CDATA[<div>Hi!<br />
<br />
On Fri, Sep 10, 2010 at 9:22 AM, Stephen Tetley<br />
&lt; - &gt; wrote:<font color="blue"><br />
&gt; This issue pops up quite quite often - Ryan Ingram's answer to it the<br />
&gt; last time it was on the Cafe points to the relevant Trac issue<br />
&gt; numbers:</font><br />
<br />
But I have not yet made it as GADTs. I would need some help here. How<br />
to change MaybePacket to GADTs?<br />
<br />
<br />
Mitar<br />
_______________________________________________<br />
Haskell-Cafe mailing list<br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Code:</div>
	<hr /><code style="margin:0px" dir="ltr" style="text-align:left">Content visible to registered users only.</code><hr />
</div><div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Code:</div>
	<hr /><code style="margin:0px" dir="ltr" style="text-align:left">Content visible to registered users only.</code><hr />
</div></div>

]]></content:encoded>
			<category domain="http://www.nntpnews.net/forumdisplay.php?f=2460">fa.haskell</category>
			<dc:creator>Mitar</dc:creator>
			<guid isPermaLink="true">http://www.nntpnews.net/showthread.php?t=17058815</guid>
		</item>
		<item>
			<title><![CDATA[[Haskell-beginners] Network programming (select(2)) for Haskell?]]></title>
			<link>http://www.nntpnews.net/showthread.php?t=17058814&amp;goto=newpost</link>
			<pubDate>Fri, 10 Sep 2010 12:03:00 GMT</pubDate>
			<description><![CDATA[Hi Patrick,

On 10/09/2010 14:02, Patrick LeBoutillier wrote:
> In order to get better at network programming using haskell, I'd like
> to try and...]]></description>
			<content:encoded><![CDATA[<div>Hi Patrick,<br />
<br />
On 10/09/2010 14:02, Patrick LeBoutillier wrote:<font color="blue"><br />
&gt; In order to get better at network programming using haskell, I'd like<br />
&gt; to try and port it to Haskell, but I can't seem to locate the<br />
&gt; equivalent to select(2) in Haskell. Perhaps a different idiom is to be<br />
&gt; used?</font><br />
<br />
No select(2) syscall is explicitly available at API level.<br />
This is because of how the Haskell (GHC) Runtime is structured.<br />
Both the default single threaded runtime that the multi-threaded<br />
runtime are capable of hosting different haskell light-threads.<br />
IO between lightweight threads is multiplex transparently<br />
by the runtime via select(2) o epoll/kqueue in the upcoming ghc.<br />
Haskell lightweight threads are very cheap and efficient<br />
so the idiomatic way to handle your use case is to spawn different<br />
threads with forkIO (you are forking lightweight threads not OS thread)<br />
and you some Haskell concurrency primitive for thread<br />
communication/synchronization (see MVar and Chan in Control.Concurrent).<br />
<br />
Paolo<br />
<br />
_______________________________________________<br />
Beginners mailing list<br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Code:</div>
	<hr /><code style="margin:0px" dir="ltr" style="text-align:left">Content visible to registered users only.</code><hr />
</div><div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Code:</div>
	<hr /><code style="margin:0px" dir="ltr" style="text-align:left">Content visible to registered users only.</code><hr />
</div></div>

]]></content:encoded>
			<category domain="http://www.nntpnews.net/forumdisplay.php?f=2460">fa.haskell</category>
			<dc:creator>Patrick LeBoutillier</dc:creator>
			<guid isPermaLink="true">http://www.nntpnews.net/showthread.php?t=17058814</guid>
		</item>
		<item>
			<title><![CDATA[[Haskell-cafe] FFI and concurrency]]></title>
			<link>http://www.nntpnews.net/showthread.php?t=17058813&amp;goto=newpost</link>
			<pubDate>Fri, 10 Sep 2010 10:26:35 GMT</pubDate>
			<description>Hello Johannes,

Friday, September 10, 2010, 2:25:58 PM, you wrote:

just forkIO in threaded RTS works for me. try:

main = do forkIO...</description>
			<content:encoded><![CDATA[<div>Hello Johannes,<br />
<br />
Friday, September 10, 2010, 2:25:58 PM, you wrote:<br />
<br />
just forkIO in threaded RTS works for me. try:<br />
<br />
main = do forkIO expensiveCalc<br />
forkIO expensiveCalc<br />
forkIO expensiveCalc<br />
expensiveCalc<br />
<font color="blue"><br />
&gt; What's the story with FFI calls and concurrency?</font><br />
<font color="blue"><br />
&gt; I have an expensive calculation performed<br />
&gt; by some C function, which I call from Haskell land.<br />
&gt; (This works like a charm.)</font><br />
<font color="blue"><br />
&gt; I have several cores available. How could I run<br />
&gt; several of these calculations in parallel?</font><br />
<font color="blue"><br />
&gt; Thanks, Johannes.</font><br />
<br />
<font color="blue"><br />
&gt; _______________________________________________<br />
&gt; Haskell-Cafe mailing list<br />
&gt; <div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Code:</div>
	<hr /><code style="margin:0px" dir="ltr" style="text-align:left">Content visible to registered users only.</code><hr />
</div>&gt; <div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Code:</div>
	<hr /><code style="margin:0px" dir="ltr" style="text-align:left">Content visible to registered users only.</code><hr />
</div></font><br />
<br />
<br />
--<br />
Best regards,<br />
Bulat                            private.php?do=newpm&amp;u=<br />
<br />
_______________________________________________<br />
Haskell-Cafe mailing list<br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Code:</div>
	<hr /><code style="margin:0px" dir="ltr" style="text-align:left">Content visible to registered users only.</code><hr />
</div><div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Code:</div>
	<hr /><code style="margin:0px" dir="ltr" style="text-align:left">Content visible to registered users only.</code><hr />
</div></div>

]]></content:encoded>
			<category domain="http://www.nntpnews.net/forumdisplay.php?f=2460">fa.haskell</category>
			<dc:creator>Johannes Waldmann</dc:creator>
			<guid isPermaLink="true">http://www.nntpnews.net/showthread.php?t=17058813</guid>
		</item>
		<item>
			<title><![CDATA[[Haskell-beginners] Stack space overflow with foldl']]></title>
			<link>http://www.nntpnews.net/showthread.php?t=17058812&amp;goto=newpost</link>
			<pubDate>Fri, 10 Sep 2010 09:30:19 GMT</pubDate>
			<description><![CDATA[Hi,

I see a stack overflow with this code, but I don't understand why.

Test.hs
--------------

main :: IO ()
main = do
let list = ([1..3*1000*1000]...]]></description>
			<content:encoded><![CDATA[<div>Hi,<br />
<br />
I see a stack overflow with this code, but I don't understand why.<br />
<br />
Test.hs<br />
--------------<br />
<br />
main :: IO ()<br />
main = do<br />
let list = ([1..3*1000*1000] :: [Int])<br />
let !x = foldl'2 (flip seq) () list<br />
return x<br />
<br />
-- foldl'2 is just the __GLASGOW_HASKELL__ version of Data.List.foldl'.<br />
-- <div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Code:</div>
	<hr /><code style="margin:0px" dir="ltr" style="text-align:left">Content visible to registered users only.</code><hr />
</div>-- src/Data-List.html<br />
-- The test case behaves the same if I call foldl' instead of foldl'2.<br />
foldl'2 :: (a -&gt; b -&gt; a) -&gt; a -&gt; [b] -&gt; a<br />
foldl'2 f z0 xs0 = lgo z0 xs0<br />
where lgo z []     = z<br />
lgo z (x:xs) = let z' = f z x in z' `seq` (lgo z' xs)<br />
<br />
$ ghc Test.hs -o Test<br />
$ time ./Test<br />
<br />
real	0m0.087s<br />
user	0m0.084s<br />
sys	0m0.000s<br />
<br />
$ ghc Test.hs -o Test -O<br />
$ time ./Test<br />
Stack space overflow: current size 8388608 bytes.<br />
Use `+RTS -Ksize -RTS' to increase it.<br />
<br />
real	0m1.780s<br />
user	0m1.764s<br />
sys	0m0.004s<br />
<br />
$ ghc --version<br />
The Glorious Glasgow Haskell Compilation System, version 6.12.3<br />
<br />
I looked at the Core output with ghc-core, with or without<br />
optimizations, and I see a $wlgo recursive function that doesn't appear<br />
to end in a tail call.  I don't see any let expressions in the<br />
folding code, so I assume no thunks are being created.  I can make a<br />
tail call appear by doing either of two things:<br />
<br />
1. Replace &quot;lgo z []&quot; with &quot;lgo !z []&quot;.  This suggestion came from an<br />
email on haskell-beginners that I can't find right now.  It was a few<br />
months ago.<br />
<br />
2. Instead of using the __GLASGOW_HASKELL__ version of foldl', use the<br />
other version:<br />
<br />
foldl' f a []     = a<br />
foldl' f a (x:xs) = let a' = f a x in a' `seq` foldl' f a' xs<br />
<br />
My test case is contrived.  Originally, I had a program that read<br />
lines from a file as Data.ByteString values, and I was trying to debug<br />
a stack overflow.  I added the foldl' call to force the evaluation of<br />
the ByteString lines, but the foldl' call itself overflowed the<br />
stack.<br />
<br />
I might have fixed my original stack overflow problem.  I was applying<br />
sum to a large list of integers, and sum is lazy.  I don't think I have<br />
any real code anymore that overflows the stack, but I'm uncomfortable<br />
because I don't know why my test case doesn't work.<br />
<br />
Is the foldl' call in my test case allowed to have linear stack usage?<br />
<br />
Thanks,<br />
-Ryan<br />
_______________________________________________<br />
Beginners mailing list<br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Code:</div>
	<hr /><code style="margin:0px" dir="ltr" style="text-align:left">Content visible to registered users only.</code><hr />
</div><div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Code:</div>
	<hr /><code style="margin:0px" dir="ltr" style="text-align:left">Content visible to registered users only.</code><hr />
</div></div>

]]></content:encoded>
			<category domain="http://www.nntpnews.net/forumdisplay.php?f=2460">fa.haskell</category>
			<dc:creator>Ryan Prichard</dc:creator>
			<guid isPermaLink="true">http://www.nntpnews.net/showthread.php?t=17058812</guid>
		</item>
		<item>
			<title><![CDATA[[Haskell-cafe] Combining applicative with arrows?]]></title>
			<link>http://www.nntpnews.net/showthread.php?t=17054447&amp;goto=newpost</link>
			<pubDate>Fri, 10 Sep 2010 08:34:22 GMT</pubDate>
			<description><![CDATA[On Fri, Sep 10, 2010 at 10:34:04AM +0200, Nils Schweinsberg wrote:
> I just wondered if you can define Applicative instances for arrows?
> Basicly...]]></description>
			<content:encoded><![CDATA[<div>On Fri, Sep 10, 2010 at 10:34:04AM +0200, Nils Schweinsberg wrote:<font color="blue"><br />
&gt; I just wondered if you can define Applicative instances for arrows?<br />
&gt; Basicly what I thought of is:<br />
&gt;<br />
&gt; I have a type for my arrow which is &quot;CollectA&quot; (using HXT here):<br />
&gt;<br />
&gt;     type CollectA a = SomeArrow XmlTree a</font><br />
<br />
If you do<br />
<br />
import Control.Applicative<br />
<br />
type CollectA = WrappedArrow SomeArrow XmlTree<br />
<br />
then CollectA will be an instance of Applicative.<br />
_______________________________________________<br />
Haskell-Cafe mailing list<br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Code:</div>
	<hr /><code style="margin:0px" dir="ltr" style="text-align:left">Content visible to registered users only.</code><hr />
</div><div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Code:</div>
	<hr /><code style="margin:0px" dir="ltr" style="text-align:left">Content visible to registered users only.</code><hr />
</div></div>

]]></content:encoded>
			<category domain="http://www.nntpnews.net/forumdisplay.php?f=2460">fa.haskell</category>
			<dc:creator>Nils Schweinsberg</dc:creator>
			<guid isPermaLink="true">http://www.nntpnews.net/showthread.php?t=17054447</guid>
		</item>
		<item>
			<title><![CDATA[[Haskell-cafe] Disable LINE Pragma handling in GHC]]></title>
			<link>http://www.nntpnews.net/showthread.php?t=17054446&amp;goto=newpost</link>
			<pubDate>Fri, 10 Sep 2010 06:40:40 GMT</pubDate>
			<description>Well, in an editor, there some operations that operate on solely on a file,
and some at the project level. I would make sense to me if...</description>
			<content:encoded><![CDATA[<div>Well, in an editor, there some operations that operate on solely on a file,<br />
and some at the project level. I would make sense to me if typechecking<br />
errors were reported against the original file (following the pragmas) while<br />
lexing and outlining results would operate without (on the actual file<br />
contents).<br />
<br />
JP<br />
<br />
On Fri, Sep 10, 2010 at 2:13 PM, Antoine Latter &lt; - &gt; wrote:<br />
<font color="blue"><br />
&gt; On Fri, Sep 10, 2010 at 1:40 AM, JP Moresmau &lt; - &gt; wrote:<font color="green"><br />
&gt; &gt; Hello fellow Haskellers,<br />
&gt; &gt; In EclipseFP we use the GHC API for IDE related stuff like syntax<br />
&gt; &gt; highlighting and code outlines. However, I ran into something funny<br />
&gt; &gt; yesterday: when a source file contains LINE pragmas<br />
&gt; &gt; (</font><br />
&gt; <div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Code:</div>
	<hr /><code style="margin:0px" dir="ltr" style="text-align:left">Content visible to registered users only.</code><hr />
</div>&gt; ),<font color="green"><br />
&gt; &gt; all the locations for tokens are changed to reflect the pragmas</font><br />
&gt; information.<font color="green"><br />
&gt; &gt; While this is great in the &quot;normal' GHC usage, this is not so great for</font><br />
&gt; us,<font color="green"><br />
&gt; &gt; because we're interested in that source code, not in original code. I<br />
&gt; &gt; haven't seen any flag to turn that behavior off in the docs, nor in the<br />
&gt; &gt; Lexer code, but have I missed something? Can I tell GHC to just ignore</font><br />
&gt; these<font color="green"><br />
&gt; &gt; pragmas? I suppose even using GHC for building and something else<br />
&gt; &gt; (haskell-src-exts?) for code handling would leave us with compilation<br />
&gt; &gt; messages at the wrong place.<br />
&gt; &gt; Thanks,</font><br />
&gt;<br />
&gt; Would you turn the behavior back on when editing .hsc files or<br />
&gt; something similar?<br />
&gt;</font><br />
<br />
<br />
<br />
--<br />
JP Moresmau<br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Code:</div>
	<hr /><code style="margin:0px" dir="ltr" style="text-align:left">Content visible to registered users only.</code><hr />
</div>_______________________________________________<br />
Haskell-Cafe mailing list<br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Code:</div>
	<hr /><code style="margin:0px" dir="ltr" style="text-align:left">Content visible to registered users only.</code><hr />
</div><div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Code:</div>
	<hr /><code style="margin:0px" dir="ltr" style="text-align:left">Content visible to registered users only.</code><hr />
</div></div>

]]></content:encoded>
			<category domain="http://www.nntpnews.net/forumdisplay.php?f=2460">fa.haskell</category>
			<dc:creator>JP Moresmau</dc:creator>
			<guid isPermaLink="true">http://www.nntpnews.net/showthread.php?t=17054446</guid>
		</item>
		<item>
			<title><![CDATA[[Haskell-cafe] ANN: ecu-0.0.0]]></title>
			<link>http://www.nntpnews.net/showthread.php?t=17054445&amp;goto=newpost</link>
			<pubDate>Fri, 10 Sep 2010 04:13:45 GMT</pubDate>
			<description><![CDATA[On Thu, Sep 09, 2010 at 11:11:33PM -0500, Tom Hawkins wrote:
> to other fields, not just automotive.  My question is, is it possible
> for a user to...]]></description>
			<content:encoded><![CDATA[<div>On Thu, Sep 09, 2010 at 11:11:33PM -0500, Tom Hawkins wrote:<font color="blue"><br />
&gt; to other fields, not just automotive.  My question is, is it possible<br />
&gt; for a user to select which programs to install within a given package?<br />
&gt;  I could see where someone would want to install a data analysis tool,<br />
&gt; but not want to bother with separately installing Kvaser canlib.  I<br />
&gt; had considered different packages for the individual tools, but that<br />
&gt; would get messy pretty quick, especially since many tools share a lot<br />
&gt; of common code.<br />
&gt;<br />
&gt; And one last question:  The Kvaser canlib library has a different name<br />
&gt; depending on if the machine is Linux or Windows.  What is the best way<br />
&gt; to configure the build based on the platform?  Current I have the<br />
&gt; library name hard coded in the extra-libraries field in the cabal<br />
&gt; file.</font><br />
<br />
You want conditional configurations in the .cabal file.  See<br />
<br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Code:</div>
	<hr /><code style="margin:0px" dir="ltr" style="text-align:left">Content visible to registered users only.</code><hr />
</div>For the OS issue you can do something like<br />
<br />
if os(windows)<br />
Build-depends: canlib-windows<br />
else<br />
Build-depends: canlib<br />
<br />
or whatever.  For user-selectable programs, create some flags and use<br />
the flags to specify which executables are buildable.  Then the user<br />
can just pass a flag to cabal install and get the executables they<br />
want.<br />
<br />
-Brent<br />
_______________________________________________<br />
Haskell-Cafe mailing list<br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Code:</div>
	<hr /><code style="margin:0px" dir="ltr" style="text-align:left">Content visible to registered users only.</code><hr />
</div><div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Code:</div>
	<hr /><code style="margin:0px" dir="ltr" style="text-align:left">Content visible to registered users only.</code><hr />
</div></div>

]]></content:encoded>
			<category domain="http://www.nntpnews.net/forumdisplay.php?f=2460">fa.haskell</category>
			<dc:creator>Tom Hawkins</dc:creator>
			<guid isPermaLink="true">http://www.nntpnews.net/showthread.php?t=17054445</guid>
		</item>
		<item>
			<title><![CDATA[[Haskell-cafe] "malicious" JS on haskell site]]></title>
			<link>http://www.nntpnews.net/showthread.php?t=17054444&amp;goto=newpost</link>
			<pubDate>Thu, 09 Sep 2010 21:30:50 GMT</pubDate>
			<description><![CDATA["Albert Y. C. Lai" <trebla@vex.net> writes:

> Looks like the free web counter was sold to an advertiser as few years ago.

I've seen this happen...]]></description>
			<content:encoded><![CDATA[<div>&quot;Albert Y. C. Lai&quot; &lt; - &gt; writes:<br />
<font color="blue"><br />
&gt; Looks like the free web counter was sold to an advertiser as few years ago.</font><br />
<br />
I've seen this happen before, and it's just a strategy - first provide<br />
some cross-site neat function, wait around for a while, then replace it<br />
with some ad-serving crap.<br />
<br />
Take home lesson: only serve <acronym title="JavaScript">JS</acronym> that you host yourself.<br />
<br />
-k<br />
--<br />
If I haven't seen further, it is by standing in the footprints of giants<br />
_______________________________________________<br />
Haskell-Cafe mailing list<br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Code:</div>
	<hr /><code style="margin:0px" dir="ltr" style="text-align:left">Content visible to registered users only.</code><hr />
</div><div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Code:</div>
	<hr /><code style="margin:0px" dir="ltr" style="text-align:left">Content visible to registered users only.</code><hr />
</div></div>

]]></content:encoded>
			<category domain="http://www.nntpnews.net/forumdisplay.php?f=2460">fa.haskell</category>
			<dc:creator>Keith Sheppard</dc:creator>
			<guid isPermaLink="true">http://www.nntpnews.net/showthread.php?t=17054444</guid>
		</item>
		<item>
			<title><![CDATA[[Haskell-cafe] Style and a problem]]></title>
			<link>http://www.nntpnews.net/showthread.php?t=17054443&amp;goto=newpost</link>
			<pubDate>Thu, 09 Sep 2010 20:55:36 GMT</pubDate>
			<description><![CDATA[On Fri, Sep 10, 2010 at 12:24:39PM +0300, Wanas wrote:
> On Fri, Sep 10, 2010 at 1:06 AM, Nils Schweinsberg <ml@n-sch.de> wrote:
>
> > Something like...]]></description>
			<content:encoded><![CDATA[<div>On Fri, Sep 10, 2010 at 12:24:39PM +0300, Wanas wrote:<font color="blue"><br />
&gt; On Fri, Sep 10, 2010 at 1:06 AM, Nils Schweinsberg &lt; - &gt; wrote:<br />
&gt;<font color="green"><br />
&gt; &gt; Something like this?<br />
&gt; &gt;<br />
&gt; &gt;    import Data.List<br />
&gt; &gt;<br />
&gt; &gt;    newList :: Int -&gt; [[Int]]<br />
&gt; &gt;    newList n = myNub<br />
&gt; &gt;        [ l | l &lt;- undefined -- not really sure how you want<br />
&gt; &gt;                             -- to generate these lists :)<br />
&gt; &gt;            , sum l == sum [1..n]<br />
&gt; &gt;            ]<br />
&gt; &gt;<br />
&gt; &gt;    myNub :: (Ord a) =&gt; [[a]] -&gt; [[a]]<br />
&gt; &gt;    myNub = nubBy (\a b -&gt; sort a == sort b)<br />
&gt; &gt;<br />
&gt; &gt;<br />
&gt; &gt; - Nils<br />
&gt; &gt;</font><br />
&gt; So I've checked out this code, and it doesn't compile on ghci. My version,<br />
&gt; without the &quot;undefined&quot; portion is(which still doesn't work):<br />
&gt;<br />
&gt; import Data.List<br />
&gt;<br />
&gt; newList :: Int -&gt; [[Int]]<br />
&gt; newList n = myNub [ l | l &lt;- [1..n], sum l == sum [1..n] ]</font><br />
<br />
The reason this doesn't compile is that<br />
<br />
l &lt;- [1..n]<br />
<br />
means l will take on each of the values 1 through n in turn.  So l is<br />
of type Int.  But then you do 'sum l' which requires l to be a list.<br />
So clearly that does not typecheck.  But I'm not quite sure I<br />
understand what you actually want l to be.  Do you want it to run<br />
through all lists of a certain length with elements chosen from<br />
[1..n]?  In that case you could do something like<br />
<br />
import Control.Monad  -- for replicateM<br />
<br />
...<br />
<br />
[ l | l &lt;- replicateM n [1..n], ... ]<br />
<br />
which will generate all length-n lists with elements chosen from<br />
[1..n].  If you wanted all lists with lengths from 1 to n and elements<br />
chosen from 1 to n, you could do<br />
<br />
[ l | len &lt;- [1..n], l &lt;- replicateM len [1..n], ... ]<br />
<br />
As others have pointed out there are likely far more efficient ways to<br />
do what you want, but I'm just trying to help you get this code to<br />
work first, even if it's inefficient.<br />
<br />
-Brent<br />
<br />
_______________________________________________<br />
Haskell-Cafe mailing list<br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Code:</div>
	<hr /><code style="margin:0px" dir="ltr" style="text-align:left">Content visible to registered users only.</code><hr />
</div><div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Code:</div>
	<hr /><code style="margin:0px" dir="ltr" style="text-align:left">Content visible to registered users only.</code><hr />
</div></div>

]]></content:encoded>
			<category domain="http://www.nntpnews.net/forumdisplay.php?f=2460">fa.haskell</category>
			<dc:creator>Wanas</dc:creator>
			<guid isPermaLink="true">http://www.nntpnews.net/showthread.php?t=17054443</guid>
		</item>
		<item>
			<title><![CDATA[[Haskell-cafe] CAL experience]]></title>
			<link>http://www.nntpnews.net/showthread.php?t=17054442&amp;goto=newpost</link>
			<pubDate>Thu, 09 Sep 2010 19:31:34 GMT</pubDate>
			<description><![CDATA[karel.gardas:
> Hello,
>
> as this is really friendly forum, I'd like to ask to perhaps solve my
> wonder. From time to time I'm seeing people here...]]></description>
			<content:encoded><![CDATA[<div>karel.gardas:<font color="blue"><br />
&gt; Hello,<br />
&gt;<br />
&gt; as this is really friendly forum, I'd like to ask to perhaps solve my<br />
&gt; wonder. From time to time I'm seeing people here recommending Scala as a<br />
&gt; kind of replacement for non-existent Haskell on Java/JVM platform. My<br />
&gt; wonder is: why the people here do not recommend CAL, which at least to<br />
&gt; me, looks much more closer to Haskell than Scala is. Are there any bad<br />
&gt; experiences with this language and OpenQuark platform? I'm asking since<br />
&gt; I'm currently playing with it and plan to use it for java objects data<br />
&gt; processing.</font><br />
<br />
Since Business Objects was aquired by SAP, development has slowed.<br />
<br />
-- Don<br />
_______________________________________________<br />
Haskell-Cafe mailing list<br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Code:</div>
	<hr /><code style="margin:0px" dir="ltr" style="text-align:left">Content visible to registered users only.</code><hr />
</div><div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Code:</div>
	<hr /><code style="margin:0px" dir="ltr" style="text-align:left">Content visible to registered users only.</code><hr />
</div></div>

]]></content:encoded>
			<category domain="http://www.nntpnews.net/forumdisplay.php?f=2460">fa.haskell</category>
			<dc:creator>Karel Gardas</dc:creator>
			<guid isPermaLink="true">http://www.nntpnews.net/showthread.php?t=17054442</guid>
		</item>
		<item>
			<title><![CDATA[[Haskell-cafe] Haskell, arrows and signal processing]]></title>
			<link>http://www.nntpnews.net/showthread.php?t=17054441&amp;goto=newpost</link>
			<pubDate>Thu, 09 Sep 2010 18:40:29 GMT</pubDate>
			<description><![CDATA[> The input and output are  infinite streams. I have a few questions:
>
> 1) Is it possible to change it to use arrows? How would it look like?
> 2)...]]></description>
			<content:encoded><![CDATA[<div>&gt; The input and output are  infinite streams. I have a few questions:<font color="blue"><br />
&gt;<br />
&gt; 1) Is it possible to change it to use arrows? How would it look like?<br />
&gt; 2) How would one implement an continuous time version?</font><br />
<br />
Yampa can do *exactly* what you're asking for.  Unfortunately the code<br />
seems to be a little rough and there are many space leaks (some of<br />
which are alluded to in the source code comments).  Definitely make<br />
sure to profile memory usage as you code.<br />
_______________________________________________<br />
Haskell-Cafe mailing list<br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Code:</div>
	<hr /><code style="margin:0px" dir="ltr" style="text-align:left">Content visible to registered users only.</code><hr />
</div><div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Code:</div>
	<hr /><code style="margin:0px" dir="ltr" style="text-align:left">Content visible to registered users only.</code><hr />
</div></div>

]]></content:encoded>
			<category domain="http://www.nntpnews.net/forumdisplay.php?f=2460">fa.haskell</category>
			<dc:creator>Anthony LODI</dc:creator>
			<guid isPermaLink="true">http://www.nntpnews.net/showthread.php?t=17054441</guid>
		</item>
		<item>
			<title><![CDATA[[Haskell] New haskell.org server]]></title>
			<link>http://www.nntpnews.net/showthread.php?t=17054440&amp;goto=newpost</link>
			<pubDate>Thu, 09 Sep 2010 17:47:32 GMT</pubDate>
			<description>Hi all,

We will shortly be replacing the haskell.org server with a more modern,
commercially hosted machine. For now, the new server is available...</description>
			<content:encoded><![CDATA[<div><br />
Hi all,<br />
<br />
We will shortly be replacing the haskell.org server with a more modern,<br />
commercially hosted machine. For now, the new server is available as<br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Code:</div>
	<hr /><code style="margin:0px" dir="ltr" style="text-align:left">Content visible to registered users only.</code><hr />
</div>The ghc, hugs and nhc98 websites have been copied across, and there is a<br />
copy of the wiki (although that will be resynced when we change<br />
servers). We will also be moving the mailing lists at changeover time.<br />
<br />
***   If you know of anything else that haskell.org   ***<br />
***  does, and should keep doing, please let us know  ***<br />
***            now or it will break soon!             ***<br />
***                                                   ***<br />
***     If you have anything else on haskell.org,     ***<br />
***          please find it a new home now!           ***<br />
<br />
Note that if there are other services currently running on haskell.org,<br />
this may be a good time to consider moving them to the community server<br />
instead:<br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Code:</div>
	<hr /><code style="margin:0px" dir="ltr" style="text-align:left">Content visible to registered users only.</code><hr />
</div><br />
<br />
Meanwhile, we would like to thank Paul Hudak, John Peterson, Mark<br />
Wogahn, the Yale Workstation Support team and Yale University for<br />
hosting, running and maintaining the haskell.org server for countless<br />
years.<br />
<br />
We would also like to thank the Haskell Summer of Code team for<br />
providing the funding for the new server, and the community sysadmin<br />
team for agreeing to maintain it in the future.<br />
<br />
Thanks also to Thomas Schilling and Ashley Yakeley for getting the wiki<br />
up and running, and restyling it.<br />
<br />
<br />
<br />
Thanks<br />
Ian, on behalf of the Haskell Infrastructure team.<br />
<br />
_______________________________________________<br />
Haskell mailing list<br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Code:</div>
	<hr /><code style="margin:0px" dir="ltr" style="text-align:left">Content visible to registered users only.</code><hr />
</div><div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Code:</div>
	<hr /><code style="margin:0px" dir="ltr" style="text-align:left">Content visible to registered users only.</code><hr />
</div></div>

]]></content:encoded>
			<category domain="http://www.nntpnews.net/forumdisplay.php?f=2460">fa.haskell</category>
			<dc:creator>Ian Lynagh</dc:creator>
			<guid isPermaLink="true">http://www.nntpnews.net/showthread.php?t=17054440</guid>
		</item>
		<item>
			<title><![CDATA[[Haskell-cafe] installing GHC/Haskell Platform in Linux withoutroot permission]]></title>
			<link>http://www.nntpnews.net/showthread.php?t=17054439&amp;goto=newpost</link>
			<pubDate>Thu, 09 Sep 2010 17:39:00 GMT</pubDate>
			<description><![CDATA[On Thursday 09 September 2010 20:23:13, Ali Razavi wrote:
> Unfortunately I don't have ghc installed. Can I install it without root
> priv?

That...]]></description>
			<content:encoded><![CDATA[<div>On Thursday 09 September 2010 20:23:13, Ali Razavi wrote:<font color="blue"><br />
&gt; Unfortunately I don't have ghc installed. Can I install it without root<br />
&gt; priv?</font><br />
<br />
That ought to work. I just unpacked and installed ghc-6.8.3-i386-unknown-<br />
linux.tar.bz2 in a subdir of $HOME without root privileges.<br />
(I would've tried a newer release, but I had the 6.8.3 vanilla binary just<br />
happening to lie around.)<br />
So in principle it works, if it doesn't work with a later vanilla linux<br />
binary, that would be a surprise (and a bug), but then you could use an<br />
older one to build from source (that works, promised, I have done that a<br />
lot).<br />
<font color="blue"><br />
&gt;<br />
&gt; On Sep 9, 2010, at 1:40 PM, Don Stewart &lt; - &gt; wrote:<font color="green"><br />
&gt; &gt; ali.razavi:<font color="darkred"><br />
&gt; &gt;&gt; Is it possible to install either of these (preferably the latter)<br />
&gt; &gt;&gt; somewhere in my home directory without having root permission? I<br />
&gt; &gt;&gt; tried the unknown linux package with configure --prefix set to a<br />
&gt; &gt;&gt; subdir in my home, to no avail. The problem seems to be due to some<br />
&gt; &gt;&gt; library registration which fails.</font><br />
&gt; &gt;<br />
&gt; &gt; Assuming you have GHC installed, the Haskell Platform Linux generic<br />
&gt; &gt; source installer will install without root privledges.<br />
&gt; &gt;<br />
&gt; &gt; If that doesn't work for you, file a bug with a log of what failed on<br />
&gt; &gt; the HP bug tracker.<br />
&gt; &gt;<br />
&gt; &gt; -- Don</font></font><br />
<br />
_______________________________________________<br />
Haskell-Cafe mailing list<br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Code:</div>
	<hr /><code style="margin:0px" dir="ltr" style="text-align:left">Content visible to registered users only.</code><hr />
</div><div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Code:</div>
	<hr /><code style="margin:0px" dir="ltr" style="text-align:left">Content visible to registered users only.</code><hr />
</div></div>

]]></content:encoded>
			<category domain="http://www.nntpnews.net/forumdisplay.php?f=2460">fa.haskell</category>
			<dc:creator>Ali Razavi</dc:creator>
			<guid isPermaLink="true">http://www.nntpnews.net/showthread.php?t=17054439</guid>
		</item>
		<item>
			<title><![CDATA[[Haskell-beginners] List Manipulation]]></title>
			<link>http://www.nntpnews.net/showthread.php?t=17054438&amp;goto=newpost</link>
			<pubDate>Thu, 09 Sep 2010 17:13:43 GMT</pubDate>
			<description><![CDATA[On Thursday 09 September 2010 19:12:21, Lorenzo Isella wrote:
>
> Up to some extent, I am done (later on I found out that reading this
> into a...]]></description>
			<content:encoded><![CDATA[<div>On Thursday 09 September 2010 19:12:21, Lorenzo Isella wrote:<font color="blue"><br />
&gt;<br />
&gt; Up to some extent, I am done (later on I found out that reading this<br />
&gt; into a matrix for hmatrix is a one-liner), but I would like to achieve<br />
&gt; more just performing standard list manipulations.<br />
&gt; For instance, since my data files are always this simple (integers/real<br />
&gt; arrays of numbers)<br />
&gt;<br />
&gt; (1) How can I tell the length of every sublist in my list?</font><br />
<br />
map length<br />
<br />
gives the list of lengths<br />
<br />
(if all sublists are known to have the same length, of course one length is<br />
enough, e.g. head . map length if there is known to be at least one<br />
sublist).<br />
<font color="blue"><br />
&gt; (2) How can I e.g. stitch together the 1st element in every sublist in<br />
&gt; order to get the 1st column of the original data file?</font><br />
<br />
map head does this. More general,<br />
<br />
import Data.List<br />
<br />
and then<br />
<br />
transpose<br />
<br />
does what you'd expect, so<br />
<br />
firstColumn xss = head (transpose xss)<br />
<br />
can do it.<br />
<br />
But there's a catch.<br />
As a rule, don't use head.<br />
<br />
head is a partial function, if it's called with an empty list, it throws an<br />
error. And that error isn't particularly informative. So if you have<br />
multiple calls to head in your programme and one of them throws an error,<br />
it can be a major pain to find out what went wrong (and sometimes an empty<br />
list where a nonempty one is expected isn't an unrecoverable error, in<br />
those cases using head is wrong in an additional way).<br />
It's okay to use head in places where it is known that it can't be called<br />
on an empty list because its argument comes from a function that produces<br />
only nonempty lists (some people disagree with that opinion and think head<br />
should never be called, on principle or because of a feared slippery<br />
slope).<br />
But in general, don't use head.<br />
<br />
So, how do we do it without head?<br />
<br />
For example,<br />
<br />
-- default value if there is no sublist<br />
sublistLength [] = 0<br />
sublistLength (xs : _) = length xs<br />
<br />
Or use Maybe to indicate whether it's a real result or not,<br />
<br />
sublistLength [] = Nothing<br />
sublistLength (xs : _) = Just (length xs)<br />
<br />
{-<br />
import Data.Maybe<br />
<br />
sublistLength = fmap length . listToMaybe<br />
-}<br />
<br />
-- skip empty sublists<br />
firstColumn xss = [x | (x : _) &lt;- xss]<br />
<br />
-- indicate empty sublists with Maybe<br />
import Data.Maybe -- for listToMaybe<br />
firstColumn xss = map listToMaybe xss<br />
<br />
That loses a little conciseness, but it buys you safety.<br />
<font color="blue"><br />
&gt;<br />
&gt; Many thanks<br />
&gt;<br />
&gt; Lorenzo</font><br />
_______________________________________________<br />
Beginners mailing list<br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Code:</div>
	<hr /><code style="margin:0px" dir="ltr" style="text-align:left">Content visible to registered users only.</code><hr />
</div><div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Code:</div>
	<hr /><code style="margin:0px" dir="ltr" style="text-align:left">Content visible to registered users only.</code><hr />
</div></div>

]]></content:encoded>
			<category domain="http://www.nntpnews.net/forumdisplay.php?f=2460">fa.haskell</category>
			<dc:creator>Lorenzo Isella</dc:creator>
			<guid isPermaLink="true">http://www.nntpnews.net/showthread.php?t=17054438</guid>
		</item>
		<item>
			<title><![CDATA[[Haskell-cafe] problems using macports?]]></title>
			<link>http://www.nntpnews.net/showthread.php?t=17054437&amp;goto=newpost</link>
			<pubDate>Thu, 09 Sep 2010 15:39:00 GMT</pubDate>
			<description>See if


Code:
---------
Content visible to registered users only.
---------
is of any help.

_______________________________________________</description>
			<content:encoded><![CDATA[<div>See if<br />
<br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Code:</div>
	<hr /><code style="margin:0px" dir="ltr" style="text-align:left">Content visible to registered users only.</code><hr />
</div>is of any help.<br />
<br />
_______________________________________________<br />
Haskell-Cafe mailing list<br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Code:</div>
	<hr /><code style="margin:0px" dir="ltr" style="text-align:left">Content visible to registered users only.</code><hr />
</div><div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Code:</div>
	<hr /><code style="margin:0px" dir="ltr" style="text-align:left">Content visible to registered users only.</code><hr />
</div></div>

]]></content:encoded>
			<category domain="http://www.nntpnews.net/forumdisplay.php?f=2460">fa.haskell</category>
			<dc:creator>S. Doaitse Swierstra</dc:creator>
			<guid isPermaLink="true">http://www.nntpnews.net/showthread.php?t=17054437</guid>
		</item>
	</channel>
</rss>
