Re: [Haskell-cafe] Maybe a, The Rationale

2008-05-11 Thread Ketil Malde
PR Stanley [EMAIL PROTECTED] writes: What is the underlying rationale for the Maybe data type? It is the equivalent of a database field that can be NULL. is it the safe style of programming it encourages/ Yes. Consider C, where this is typically done with a NULL pointer, or Lisp,

Re: [Haskell-cafe] Re: Order of Evaluation

2008-05-11 Thread Luke Palmer
On Fri, May 9, 2008 at 3:46 PM, Achim Schneider [EMAIL PROTECTED] wrote: Miguel Mitrofanov [EMAIL PROTECTED] wrote: Oh, you sure? I was, until you wrote that. But then, I am, as I wouldn't use unsafePerformIO together with IORef's, it's giving me the creeps. So.. what do you use

Re: [Haskell-cafe] Stack vs Heap allocation

2008-05-11 Thread Chaddaï Fouché
2008/5/10 Edsko de Vries [EMAIL PROTECTED]: The key reason why nested additions take stack space, is because (+) on Integers is *strict* in both arguments. If it were somehow non-strict instead, then the unevaluated parts of the number would be heap-allocated rather than stack-allocated. I

Re: [Haskell-cafe] Order of Evaluation

2008-05-11 Thread Richard Kelsall
Miguel Mitrofanov wrote: As I understand it Haskell does not specify an order of evaluation and it would therefore be a mistake to write a program which relies on a particular evaluation order. This is the 'unsafe' aspect of unsafePerformIO. Hmm... IMHO unsafePerformIO is 'unsafe' because it

Re: [Haskell-cafe] Maybe a, The Rationale

2008-05-11 Thread PR Stanley
Um, I was encountering and recognizing times when I really needed an out-of-band null, and the pain of representing such in C, shortly after I started serious programming in C (call it 1984-5). Is this really difficult? Paul: Hmm, I'm not quite sure what you're driving at.

Re: [Haskell-cafe] haskell compiler on NetBSD amd64

2008-05-11 Thread Matthias Kilian
On Sat, May 10, 2008 at 03:03:39PM -0700, Don Stewart wrote: I've to admit that the ghc port for OpenBSD is a little bit weird ;-) (but not as weird as my current work on ghc-6.8 for OpenBSD) What's your plan for the OpenBSD port, Kili? * Proper bootstrapping from .hc files. * Think

Re[2]: [Haskell-cafe] Re: Order of Evaluation

2008-05-11 Thread Bulat Ziganshin
Hello Luke, Sunday, May 11, 2008, 1:24:04 PM, you wrote: So.. what do you use unsafePerformIO together with? when i call function that in general case depends on the execution order (so it's type is ...-IO x), but in my specific case it doesn't matter. typical example is hGetContents on config

Re: [Haskell-cafe] Newbie Question: Using Haskell Functions in a C Program

2008-05-11 Thread Luke Palmer
On Thu, May 8, 2008 at 5:09 PM, Philip Müller [EMAIL PROTECTED] wrote: Thanks for all the answers. I'm testing this right now and simples cases work as expected. However from what I've read it seems it'll get ugly once I try to pass a C array to a Haskell function. Well, maybe arrays in C

[Haskell-cafe] Error: Improperly terminated character constant

2008-05-11 Thread Ivan Amarquaye
I'm writing a function dRop to accept words ending in 'es' and drop the last two characters i.e. 'es'.eg. mangoes - mongo but i keep on getting this error: Improperly terminated character constant after running this code which i have left below. Can i get any form of help from anyone in

Re: [Haskell-cafe] Error: Improperly terminated character constant

2008-05-11 Thread Johannes Laire
Single quotes are for characters, double quotes are for strings. So change 'es' to es. -- Johannes Laire 2008/5/11 Ivan Amarquaye [EMAIL PROTECTED]: I'm writing a function dRop to accept words ending in 'es' and drop the last two characters i.e. 'es'.eg. mangoes - mongo but i keep on

Re: Cryptographic hash uniquness (was [Haskell-cafe] Simple network client)

2008-05-11 Thread Graham Klyne
This is a very late response ... but I did some calculations as part of some work I did a while ago: http://www.ietf.org/rfc/rfc2938.txt (See appendix A The birthday paradox) #g -- Peter Verswyvelen wrote: winds up having a write cache, which is mutable in practice. The interesting thing

Re: Cryptographic hash uniquness (was [Haskell-cafe] Simple network client)

2008-05-11 Thread Richard Kelsall
Graham Klyne wrote: This is a very late response ... but I did some calculations as part of some work I did a while ago: http://www.ietf.org/rfc/rfc2938.txt (See appendix A The birthday paradox) #g A memorable summary of the birthday paradox being : There is a 50% chance of a collision

Re: [Haskell-cafe] Copy on read

2008-05-11 Thread Matthew Naylor
Uniqueness typing does not lead to in-place update. If a value is only used once, then there is no need to update it at all! my understanding is that if a value is uniquely-typed then it is statically known never to have more than one reference, thus it can be modified in-place. Some

Re: [Haskell-cafe] Re: Couple of formal questions

2008-05-11 Thread Creighton Hogg
On Mon, May 5, 2008 at 9:53 AM, Wouter Swierstra [EMAIL PROTECTED] wrote: On 1 May 2008, at 16:58, Michael Karcher wrote: Wouter Swierstra [EMAIL PROTECTED] wrote: Hi Creighton, Where could I find a proof that the initial algebras final coalgebras of CPO coincide? I saw

[Haskell-cafe] dropping hyphens and \n in words

2008-05-11 Thread Ivan Amarquaye
Generally a hyphen is written at the end of the sentance when moving on to the next line and i managed to achieve this in haskell by using the \n- newline which places an index word in the next line i.e. if the words appear indexed like this...([1]),[mangoes] and a hyphen is applied, it

Re: [Haskell-cafe] dropping hyphens and \n in words

2008-05-11 Thread Brandon S. Allbery KF8NH
On 2008 May 11, at 11:47, Ivan Amarquaye wrote: Now my problem is this...I'm assuming that the hyphen normally comes at the end of a sentence like this: there are so many guys ravis- hing our women and this can be demonstrated in haskell by \n which places the words or characters following

[Haskell-cafe] ANN: xmonad-utils 0.1

2008-05-11 Thread Gwern Branwen
Just dropping in a quick note: I've uploaded to Hackage the 0.1 release of xmonad-utils here: http://hackage.haskell.org/cgi-bin/hackage-scripts/package/xmonad-utils. There is of course a Darcs repo available as well: http://gorgias.mine.nu/repos/xmonad-utils. What is xmonad-utils? It's a

[Haskell-cafe] Re: dropping hyphens and \n in words

2008-05-11 Thread Achim Schneider
Ivan Amarquaye [EMAIL PROTECTED] wrote: Generally a hyphen is written at the end of the sentance when moving on to the next line and i managed to achieve this in haskell by using the \n- newline which places an index word in the next line i.e. if the words appear indexed like

Re: [Haskell-cafe] haskell compiler on NetBSD amd64

2008-05-11 Thread Don Stewart
kili: On Sat, May 10, 2008 at 03:03:39PM -0700, Don Stewart wrote: I've to admit that the ghc port for OpenBSD is a little bit weird ;-) (but not as weird as my current work on ghc-6.8 for OpenBSD) What's your plan for the OpenBSD port, Kili? * Proper bootstrapping from .hc

Re: [Haskell-cafe] haskell compiler on NetBSD amd64

2008-05-11 Thread Donn Cave
On Sat, 10 May 2008 23:59:18 +0200 Matthias Kilian [EMAIL PROTECTED] wrote: Here you go: http://openbsd.dead-parrot.de/distfiles/ghc-6.6.1-amd64-unknown-openbsd-hc.tar.bz2 Thanks, I have managed to build a stage1/ghc-6.6.1 with those, which is a start even if it does immediately core dump.

Re: [Haskell-cafe] Re: dropping hyphens and \n in words

2008-05-11 Thread Chaddaï Fouché
2008/5/11 Achim Schneider [EMAIL PROTECTED]: Excuse my bluntness, but I utterly fail to make sense of this. Reformulating your understanding of it would surely be beneficial. He has a routine that gives him a list of words classified by line, and he want the hyphens to be accounted for. So

[Haskell-cafe] Re: dropping hyphens and \n in words

2008-05-11 Thread Achim Schneider
Chaddaï Fouché [EMAIL PROTECTED] wrote: 2008/5/11 Achim Schneider [EMAIL PROTECTED]: Excuse my bluntness, but I utterly fail to make sense of this. Reformulating your understanding of it would surely be beneficial. He has a routine that gives him a list of words classified by line, and

[Haskell-cafe] saner shootout programs

2008-05-11 Thread J C
I don't know Haskell very well, but even I can tell, looking at, for example, the N-body benchmark, that the Haskell code is probably not type-safe, and the tricks used in it would not be usable in a larger program (see below). The task is essentially a pure computation: take a list of bodies

Re: [Haskell-cafe] saner shootout programs

2008-05-11 Thread Don Stewart
jhc0033: I don't know Haskell very well, but even I can tell, looking at, for example, the N-body benchmark, that the Haskell code is probably not type-safe, and the tricks used in it would not be usable in a larger program (see below). The task is essentially a pure computation: take a

Re: [Haskell-cafe] saner shootout programs

2008-05-11 Thread Don Stewart
dons: jhc0033: I don't know Haskell very well, but even I can tell, looking at, for example, the N-body benchmark, that the Haskell code is probably not type-safe, and the tricks used in it would not be usable in a larger program (see below). The task is essentially a pure

Re: [Haskell-cafe] saner shootout programs

2008-05-11 Thread PR Stanley
I don't know Haskell very well, but Paul: I'm not racist but . . . :-) even I can tell, looking at, for example, the N-body benchmark, that the Haskell code is probably not type-safe, and the tricks used in it would not be usable in a larger program (see below). The task is

Re: [Haskell-cafe] saner shootout programs

2008-05-11 Thread J C
On Sun, May 11, 2008 at 1:40 PM, Don Stewart [EMAIL PROTECTED] wrote: n-body requires updating a global array of double values to be I think the array and any side-effects on it can and should be local to the simulation procedure. competitive performance-wise, though we haven't really nailed

Re: [Haskell-cafe] saner shootout programs

2008-05-11 Thread Don Stewart
jhc0033: On Sun, May 11, 2008 at 1:40 PM, Don Stewart [EMAIL PROTECTED] wrote: n-body requires updating a global array of double values to be I think the array and any side-effects on it can and should be local to the simulation procedure. competitive performance-wise, though we

Re: [Haskell-cafe] haskell compiler on NetBSD amd64

2008-05-11 Thread Don Stewart
donn: On Sat, 10 May 2008 23:59:18 +0200 Matthias Kilian [EMAIL PROTECTED] wrote: Here you go: http://openbsd.dead-parrot.de/distfiles/ghc-6.6.1-amd64-unknown-openbsd-hc.tar.bz2 Thanks, I have managed to build a stage1/ghc-6.6.1 with those, which is a start even if it does

Re: [Haskell-cafe] Re: Interesting critique of OCaml

2008-05-11 Thread Richard A. O'Keefe
On 9 May 2008, at 6:59 am, Donnie Jones wrote: I pasted a copy of the article below for those that cannot access the site.Why Ocaml Sucks Published by Brian at 6:49 pm under Functional Languages: Ocaml, Haskell . An even better idea [for 'printf'] might be some variant of functional

Re: [Haskell-cafe] Maybe a, The Rationale

2008-05-11 Thread Richard A. O'Keefe
On 12 May 2008, at 1:52 am, Brandon S. Allbery KF8NH wrote: My real point was that in the C programming culture it was/is far too common to use an in-band value; that is, one that could be confused with or treated as a valid response: null pointers, stdio's EOF (= -1). Here I must

Re: [Haskell-cafe] Maybe a, The Rationale

2008-05-11 Thread Don Stewart
ok: Maybe types force you to deal with it, while simultaneously providing convenience functions to help you deal with it. I readily grant that Maybe is a wonderful wonderful thing and I use it freely and voluntarily. BUT it should not dominate the code. Consider Haskell's getChar

Re: [Haskell-cafe] Maybe a, The Rationale

2008-05-11 Thread Brandon S. Allbery KF8NH
On 2008 May 11, at 22:42, Don Stewart wrote: ok: Maybe types force you to deal with it, while simultaneously providing convenience functions to help you deal with it. I readily grant that Maybe is a wonderful wonderful thing and I use it freely and voluntarily. BUT it should not