Hello,
You might already know this, but in case you don't: there is another
literate style:
... non-code ...
\begin{code}
... code ...
\end{code}
... non-code ...
in which you do not put prefixes to each line. (In fact the standard says
somewhere it is not recommended to mix the two styles if I
hGetContents reads the entire contents of the stream till the end (although
lazily). The return value of hGetContents is logically the entire contents
of the stream. That it has not read it completely is only a part of its
laziness, so the result does not depend upon when the caller stops
on this
problem.
Abhay
On Sun, Jun 1, 2008 at 1:07 PM, apfelmus [EMAIL PROTECTED] wrote:
Tillmann Rendel wrote:
Abhay Parvate wrote:
I think I would like to make another note: when we talk about the
complexity
of a function, we are talking about the time taken to completely evaluate
I think I would like to make another note: when we talk about the complexity
of a function, we are talking about the time taken to completely evaluate
the result. Otherwise any expression in haskell will be O(1), since it just
creates a thunk.
And then the user of the program is to be blamed for
On Thu, May 29, 2008 at 11:48 PM, Tillmann Rendel [EMAIL PROTECTED]
wrote:
Adrian Neumann wrote:
Hello,
I was wondering how expensive appending something to a list really is. Say
I write
I'd say longList ++ [5] stays unevaluated until I consumed the whole
list and then appending should
To add to this: There are other constants which are polymorphic, not only
numbers. Examples where you could add type signatures to make the type
explicit are the empty list '[]' and the 'Nothing' constructor of 'Maybe a'.
Adding type signatures to these will not be type casts, but telling the
It's not exactly a question of Haskell's behaviour. The list [ (a,b) | a -
[0..], b - [0..] ]
is such that apart from pairs starting with zero, no other pair is
associated with a finite index. In other words, [ (a,b) | a - [0..], b -
[0..] ] is not a correct 'enumeration' of all pairs of
Yes, I had always desired that the operator = should have been right
associative for this short cut even when written without the 'do' notation.
On Tue, May 13, 2008 at 3:39 AM, John Hamilton [EMAIL PROTECTED] wrote:
I'm trying to understand how short circuiting works with the Maybe monad.
I don't know why, but perhaps beginners may expect too much from the
laziness, almost to the level of magic (me too, in the beginning!). In an
eager language, a function like
mean :: (Fractional a) = [a] - a
expects the *whole* list before it can calculate the mean, and the question
of the
As a beginner, I had found the behaviour quite unpredictable. But with time
I found that I could reason out the behaviour with my slowly growing
knowledge of laziness. I don't spot all the places in my program that will
suck while writing a program, but post facto many things become clear. (And
Thanks both for the the explanation and the link. The wikibook is really
growing fast!
Abhay
On Wed, May 7, 2008 at 5:05 PM, apfelmus [EMAIL PROTECTED] wrote:
Abhay Parvate wrote:
Just for curiocity, is there a practically useful computation that uses
'seq' in an essential manner, i.e
Just for curiocity, is there a practically useful computation that uses
'seq' in an essential manner, i.e. apart from the efficiency reasons?
Abhay
On Wed, May 7, 2008 at 2:48 PM, apfelmus [EMAIL PROTECTED] wrote:
Luke Palmer wrote:
It seems that there is a culture developing where people
Hi Andrew,
I don't know whether it's intentional, but the patterns for case line of
are not exaustive. Are you sure you do not expect anything else apart from a
single . or a line starting with '#'?
More below:
On Mon, May 5, 2008 at 1:45 PM, Andrew Coppin [EMAIL PROTECTED]
wrote:
Neil
management techniques that have the
flexibility, efficiency, and accuracy of GC that I could be using for
these other resources?
Thanks,
- Conal
2008/4/14 Abhay Parvate [EMAIL PROTECTED]:
Hello,
In describing the Handle type, the GHC documentation says (in the
System.IO
like video memory, file descriptors, etc?
* Are there resource management techniques that have the
flexibility, efficiency, and accuracy of GC that I could be using for
these other resources?
Thanks,
- Conal
2008/4/14 Abhay Parvate [EMAIL PROTECTED]:
Hello
Thanks! I was worried about how/where would I place hClose!
On Mon, Apr 14, 2008 at 10:58 PM, Brent Yorgey [EMAIL PROTECTED] wrote:
2008/4/14 Abhay Parvate [EMAIL PROTECTED]:
Hello,
In describing the Handle type, the GHC documentation says (in the
System.IO documentation):
GHC note
1 byte per character + fixed overhead. Then,
assuming the function consuming the String doesn't leak, you'll end up
with a much smaller space requirement.
-- ryan
2008/4/14 Abhay Parvate [EMAIL PROTECTED]:
Thanks! I was worried about how/where would I place hClose!
On Mon, Apr 14
/14 Abhay Parvate [EMAIL PROTECTED]:
Hello,
In describing the Handle type, the GHC documentation says (in the
System.IO documentation):
GHC note: a Handle will be automatically closed when the garbage
collector detects that it has become unreferenced by the program. However,
relying
Hello,
In describing the Handle type, the GHC documentation says (in the System.IO
documentation):
GHC note: a Handle will be automatically closed when the garbage collector
detects that it has become unreferenced by the program. However, relying on
this behaviour is not generally recommended:
]
wrote:
Abhay Parvate,
Thank you; that answered my question.
Then, the following two lines of code should be
equivalent:
In hanoi.hs:
hanoi n = mapM_ putStrLn (hanoi_helper 'a' 'b' 'c' n)
In hanoi_unlines.hs:
hanoi n = putStr (unlines(hanoi_helper 'a' 'b' 'c' n))
I tested them both
The indentation is not right; all the statements after the 'do' keyword need
to start exactly at the same column. In particular, the 'f' in fileContent
and 's' in set should be one below the other. And the 'return ()' also seems
to be displaced; perhaps you want that also exactly below the last
Hello all,
Why is there a limitation on the stack size in GHC? Like heap where we can
limit the size by -M RTS option but the default is unlimited, why not let
the program use as big a stack as required? If not by default, then by a
separate option?
Some of the functions that we write in
22 matches
Mail list logo