One half of all Haskell coders will tell you that mutable state
isn't a
good starting point to learn Haskell, the other half will tell you the
same because they want to be cool kids, too.
And the one left over will point out that he asked how to do this the
FP way, not the imperative way?
2008/6/16 Pieter Laeremans [EMAIL PROTECTED]:
Hi,
Which tools do you recommand for memory profiling haskell programs
on a *nix system.
I'm using haskell to develop a CGI program/script.
The application has to be deployed on shared hosting infrastructure.
Since I would like to be a good
Magicloud Magiclouds [EMAIL PROTECTED] writes:
static int old;
int diff (int now) { /* this would be called once a second */
int ret = now - old;
old = now;
return ret;
}
Because there is no variable in Haskell. So how to do this in a FP way?
I would claim the FP way is like
Am Sonntag, 15. Juni 2008 23:17 schrieb Duncan Coutts:
[…]
If we get a proper way to export a non-flat namespace then Gtk2Hs will
certainly switch to using it. Using 'buttonBlah' is horrible but there
is currently nothing better.
So is there anyone who wants to file a feature request?
[…]
On Mon, 2008-06-16 at 10:19 +0200, Ketil Malde wrote:
Magicloud Magiclouds [EMAIL PROTECTED] writes:
static int old;
int diff (int now) { /* this would be called once a second */
int ret = now - old;
old = now;
return ret;
}
Because there is no variable in Haskell. So
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
Henning Thielemann wrote:
On Mon, 9 Jun 2008, Duncan Coutts wrote:
On Mon, 2008-06-09 at 16:04 +0200, Ketil Malde wrote:
And - is there a way to make GHCi use aliased qualification? I find
my self typing detailed taxonomies all the time there.
The ghci syntax currently is:
:m Data.Set
Duncan Coutts wrote:
Right. That's exactly why we've not done something like that. With 100+
modules in the Gtk package it's totally infeasible to do qualified
imports of them all.
If we get a proper way to export a non-flat namespace then Gtk2Hs will
certainly switch to using it. Using
Hello Isaac,
Monday, June 16, 2008, 4:02:10 PM, you wrote:
Are there multiple blah functions among the GTK modules? I.e. would
GTK.blah be unambiguous, not mentioning that it's a button function.
yes. actually, gtk2hs uses typeclasses to overload functions over
various types
--
Best
The main point of the Program abstraction is about configuring and
running programs. As it happens some programs are provided by some
haskell packages (but not all, eg ld, ar, etc).
option to get version info and code to extract it (with one apparently
very special case being hsc2hs).
And
Duncan Coutts wrote:
If we get a proper way to export a non-flat namespace then Gtk2Hs will
certainly switch to using it. Using 'buttonBlah' is horrible but there
is currently nothing better.
Whilst I'm sure anyone who's used deep module structures has wondered
about this feature, I've seen
Sebastiaan Visser wrote:
Does anyone know a pattern in which I can do this easily?
Don't use hGetContents on a socket. That's asking for trouble.
Use hGetContents either NEVER (easy option) or only on throwaway
handles/files which won't be used again.
Jules
Duncan Coutts wrote:
If we get a proper way to export a non-flat namespace then Gtk2Hs will
certainly switch to using it. Using 'buttonBlah' is horrible but there
is currently nothing better.
Whilst I'm sure anyone who's used deep module structures has wondered
about this feature, I've seen
On Jun 16, 2008, at 2:58 PM, Jules Bean wrote:
Sebastiaan Visser wrote:
Does anyone know a pattern in which I can do this easily?
Don't use hGetContents on a socket. That's asking for trouble.
Can you please explain why?
What is a more easier method to spool your HTTP post data to a file
Sebastiaan Visser wrote:
On Jun 16, 2008, at 2:58 PM, Jules Bean wrote:
Sebastiaan Visser wrote:
Does anyone know a pattern in which I can do this easily?
Don't use hGetContents on a socket. That's asking for trouble.
Can you please explain why?
Because it's a broken abstraction.
It's
Thomas Davie [EMAIL PROTECTED] wrote:
One half of all Haskell coders will tell you that mutable state
isn't a
good starting point to learn Haskell, the other half will tell you
the same because they want to be cool kids, too.
And the one left over will point out that he asked how
Jules Bean [EMAIL PROTECTED] wrote:
Sebastiaan Visser wrote:
On Jun 16, 2008, at 2:58 PM, Jules Bean wrote:
Sebastiaan Visser wrote:
Does anyone know a pattern in which I can do this easily?
Don't use hGetContents on a socket. That's asking for trouble.
Can you please explain
Hi,
I'm in the process of updating the Deferred Binary library,
http://www-users.cs.york.ac.uk/~ndm/binarydefer/. The idea is that its
does serialisation, but certain elements can be marked as deferred -
instead of being written in the current file stream, they are merely
pointed at and if
On 16 Jun 2008, at 18:28, Achim Schneider wrote:
Thomas Davie [EMAIL PROTECTED] wrote:
One half of all Haskell coders will tell you that mutable state
isn't a
good starting point to learn Haskell, the other half will tell you
the same because they want to be cool kids, too.
And the one
2008/6/15 Magicloud Magiclouds [EMAIL PROTECTED]:
Hello,
I am getting familiar with FP now, and I have a program design kind of
question.
Say I have something like this in C:
static int old;
int diff (int now) { /* this would be called once a second */
int ret = now - old;
old
Thomas Davie [EMAIL PROTECTED] wrote:
On 16 Jun 2008, at 18:28, Achim Schneider wrote:
Thomas Davie [EMAIL PROTECTED] wrote:
One half of all Haskell coders will tell you that mutable state
isn't a
good starting point to learn Haskell, the other half will tell you
the same
On Mon, Jun 16, 2008 at 10:31:22AM +0800, Magicloud Magiclouds wrote:
Hello,
I am getting familiar with FP now, and I have a program design kind of
question.
Say I have something like this in C:
static int old;
int diff (int now) { /* this would be called once a second */
int ret
On Mon, 16 Jun 2008, Achim Schneider wrote:
We have to resort to IO actions to get the time, and to IORefs because
we need to chain up different calls to getCurrentTime using the IO
Monad. The rest of the program can work with whatever you like best.
Isn't (StateT s IO a) the cleaner
Henning Thielemann [EMAIL PROTECTED] wrote:
On Mon, 16 Jun 2008, Achim Schneider wrote:
We have to resort to IO actions to get the time, and to IORefs
because we need to chain up different calls to getCurrentTime using
the IO Monad. The rest of the program can work with whatever you
On 6/16/08, Magicloud Magiclouds [EMAIL PROTECTED] wrote:
Hello,
I am getting familiar with FP now, and I have a program design kind
of question.
Say I have something like this in C:
static int old;
int diff (int now) { /* this would be called once a second */
int ret = now -
On 6/11/08, Jonathan Cast [EMAIL PROTECTED] wrote:
This doesn't apply to f, though --- it has a function type, so the user
presumably already knows it won't be subject to updating, no?
Distinguishing functions from variables by the form of declaration,
rather than the type, seems somewhat
David Roundy wrote:
A better question would be to think about what you are trying to
accomplish, and then ask how to achieve that through functional
programming.
Amen!
I was waiting for somebody to say that...
There are a dozen situations in an imperative language where you'd write
a
The simple explanation is because the FFI standard says so;
primitive types wrapped in newtypes automatically get wrapped and
unwrapped during FFI calls. See
http://www.cse.unsw.edu.au/~chak/haskell/ffi/ffi/ffise3.html#x6-120003.2
; the FFI uses renamed datatype to mean newtype.
Consider the
Hello,
I am very new to Haskell, and I work in Windows XP.
Can anyone please point me to a working C / Haskell program pair that does the
following:
1) The C routine passes one or more scalars, arrays, or matrices to the Haskell
routine.
2) The Haskell routine reads a comma-delimited, ASCII
On Mon, 2008-06-16 at 17:43 +0100, Neil Mitchell wrote:
Hi,
I'm in the process of updating the Deferred Binary library,
http://www-users.cs.york.ac.uk/~ndm/binarydefer/. The idea is that its
does serialisation, but certain elements can be marked as deferred -
instead of being written in the
So, I know this has been discussed before, but:
1/0
Infinity
0/0
NaN
... so I see from the archives that Infinity is mandated by ieee754
even though my intuition says both should be NaN.
Every other language throws an exception, even C will crash the
program, so I'm guessing it's telling the
On Mon, Jun 16, 2008 at 9:43 AM, Neil Mitchell [EMAIL PROTECTED] wrote:
== The Question ==
Is there a simple way of tagging fields in a constructor as deferred,
just once for reading and writing, and ideally outside the instance
definition and not requiring additional code to unwrap? I can't
On Mon, Jun 16, 2008 at 4:07 PM, Evan Laforge [EMAIL PROTECTED] wrote:
So, I know this has been discussed before, but:
1/0
Infinity
0/0
NaN
... so I see from the archives that Infinity is mandated by ieee754
even though my intuition says both should be NaN.
There is a good reason for 1/0
On Mon, Jun 16, 2008 at 4:18 PM, David Roundy [EMAIL PROTECTED] wrote:
On Mon, Jun 16, 2008 at 4:07 PM, Evan Laforge [EMAIL PROTECTED] wrote:
Every other language throws an exception, even C will crash the
program, so I'm guessing it's telling the processor / OS to turn these
into signals,
Evan Laforge [EMAIL PROTECTED] writes:
So, I know this has been discussed before, but:
1/0
Infinity
0/0
NaN
... so I see from the archives that Infinity is mandated by ieee754
even though my intuition says both should be NaN.
Every other language throws an exception, even C will crash
No, The issue is that '/' is always floating point division in haskell,
for integer division, use `div`.
1 `div` 0 throws an exception like you expect.
GHC behaves exactly the same as C here. But in C whether '/' means
floating point or integral division depends on the types of its
On Monday 16 June 2008, Evan Laforge wrote:
So, I know this has been discussed before, but:
1/0
Infinity
0/0
NaN
... so I see from the archives that Infinity is mandated by ieee754
even though my intuition says both should be NaN.
Every other language throws an exception, even C
On Mon, Jun 16, 2008 at 04:41:23PM -0700, Evan Laforge wrote:
But what about that NaN-Integer conversion thing?
I think that may be a bug or at least a misfeature. The standard is
somewhat vauge on a lot of issues dealing with floating point since
it is such a tricky subject and depends a lot on
On Mon, Jun 16, 2008 at 04:50:05PM -0700, John Meacham wrote:
On Mon, Jun 16, 2008 at 04:41:23PM -0700, Evan Laforge wrote:
But what about that NaN-Integer conversion thing?
I think that may be a bug or at least a misfeature. The standard is
somewhat vauge on a lot of issues dealing with
droundy:
On Mon, Jun 16, 2008 at 04:50:05PM -0700, John Meacham wrote:
On Mon, Jun 16, 2008 at 04:41:23PM -0700, Evan Laforge wrote:
But what about that NaN-Integer conversion thing?
I think that may be a bug or at least a misfeature. The standard is
somewhat vauge on a lot of issues
On Mon, Jun 16, 2008 at 05:08:36PM -0700, Don Stewart wrote:
droundy:
On Mon, Jun 16, 2008 at 04:50:05PM -0700, John Meacham wrote:
On Mon, Jun 16, 2008 at 04:41:23PM -0700, Evan Laforge wrote:
But what about that NaN-Integer conversion thing?
I think that may be a bug or at least
droundy:
On Mon, Jun 16, 2008 at 05:08:36PM -0700, Don Stewart wrote:
droundy:
On Mon, Jun 16, 2008 at 04:50:05PM -0700, John Meacham wrote:
On Mon, Jun 16, 2008 at 04:41:23PM -0700, Evan Laforge wrote:
But what about that NaN-Integer conversion thing?
I think that may be a
hi,
I wasn't able to add an attachment to a ticket, is something wrong
with permissions?
Python Traceback
Traceback (most recent call last):
File /var/lib/python-support/python2.4/trac/web/main.py, line 387,
in dispatch_request
dispatcher.dispatch(req)
File
On Mon, Jun 16, 2008 at 05:39:39PM -0700, Don Stewart wrote:
It's a bug in the H98 report then:
Yes, I consider a whole lot of the floating point stuff in the report a
bug of sorts IMHO :) It is certainly something that I hope to work on for
Haskell'.
John
--
John Meacham -
On Mon, Jun 16, 2008 at 05:39:39PM -0700, Don Stewart wrote:
decodeFloat really ought to be a partial function, and this should
be a crashing bug, if the standard libraries were better-written.
It's a bug in the H98 report then:
Section 6.4.6:
The function decodeFloat applied
On 16 Jun 2008, at 19:24, Achim Schneider wrote:
Thomas Davie [EMAIL PROTECTED] wrote:
On 16 Jun 2008, at 18:28, Achim Schneider wrote:
Thomas Davie [EMAIL PROTECTED] wrote:
One half of all Haskell coders will tell you that mutable state
isn't a
good starting point to learn Haskell,
On 2008 Jun 16, at 19:18, David Roundy wrote:
On Mon, Jun 16, 2008 at 4:07 PM, Evan Laforge [EMAIL PROTECTED]
wrote:
Every other language throws an exception, even C will crash the
program, so I'm guessing it's telling the processor / OS to turn
these
into signals, while GHC is turning
On 17 Jun 2008, at 11:07 am, Evan Laforge wrote:
So, I know this has been discussed before, but:
1/0
Infinity
0/0
NaN
... so I see from the archives that Infinity is mandated by ieee754
even though my intuition says both should be NaN.
Other people have other intuitions. It may be
... so I see from the archives that Infinity is mandated by ieee754
even though my intuition says both should be NaN.
Other people have other intuitions. It may be that your intuition
is telling you that neither result should be an ordinary number,
and if that's what it's really telling
Thomas Davie [EMAIL PROTECTED] wrote:
On 16 Jun 2008, at 19:24, Achim Schneider wrote:
Thomas Davie [EMAIL PROTECTED] wrote:
On 16 Jun 2008, at 18:28, Achim Schneider wrote:
Thomas Davie [EMAIL PROTECTED] wrote:
One half of all Haskell coders will tell you that mutable
Since Haskell-Café often strays into mathematics,
this may not be too far off topic.
On 17 Jun 2008, at 2:29 pm, Evan Laforge wrote:
Yeah, on reflection, I think my intuition derives from me asking a
math teacher back in high school isn't n/0 infinity? after looking
at a graph, to which he said
Yes, that's it, State.
Thanks.
-邮件原件-
发件人: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] 代表 Achim Schneider
发送时间: 2008年6月16日 12:01
收件人: haskell-cafe@haskell.org
主题: [Haskell-cafe] Re: How to do this in FP way?
Magicloud Magiclouds [EMAIL PROTECTED] wrote:
static int old;
int diff (int
I think if I do not use a state, and the function would be called for many
times, it would waste memory, if using something like loop, right?
-邮件原件-
发件人: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] 代表 Achim Schneider
发送时间: 2008年6月16日 12:01
收件人: haskell-cafe@haskell.org
主题: [Haskell-cafe]
Magicloud [EMAIL PROTECTED] wrote:
I think if I do not use a state, and the function would be called for
many times, it would waste memory, if using something like loop,
right?
nope, at least not in general.
update :: MyState - Int - MyState
draw :: MyState - IO ()
mainLoop :: MyState -
But if there are some beautiful arithmetics that do not use something like
state, I won't say no to them.
-邮件原件-
发件人: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] 代表 Achim Schneider
发送时间: 2008年6月16日 12:01
收件人: haskell-cafe@haskell.org
主题: [Haskell-cafe] Re: How to do this in FP way?
OK. Here it is.
I want to make a monitor tool for linux. It runs for a long time, and give
out a certain process's io stat per second. The way I get io stat is to read
from /proc/pid/io. But the data in this file is a total, I need to read it
first, then next second, read it again, and shows the
56 matches
Mail list logo