Re: [Haskell-cafe] Re: inserting values in a binary tree

2008-05-10 Thread Tomas Andersson
Den Saturday 10 May 2008 00.55.44 skrev PR Stanley: Actually, you've touched an important point there. It's balancing that I'm having difficulty with. Paul So what kind of balancing rules does it have to obey? AVL? Red-black? Something else? At 23:46 09/05/2008, you wrote: PR Stanley

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

2008-05-10 Thread Emil Skoeldberg
On Fri, May 09, 2008 at 10:21:19PM -0700, Donn Cave wrote: So here I am with 64 bit Athlon hardware, running amd64 NetBSD (a.k.a. x86_64), reasonably motivated to compile Haskell. From what I make of the porting instructions, So, we are in the same boat then! my only hope is to install

Re: [Haskell-cafe] build version problem?

2008-05-10 Thread Philip Weaver
Ok, I'll ask the obvious question... did you try to re-configure? runhaskell Setup.hs configure 2008/5/9 Galchin, Vasili [EMAIL PROTECTED]: Hello, I changed the version # in a cabal file and now I get ... runhaskell Setup.hs configure Configuring unix-2.4.0.0... [EMAIL

[Haskell-cafe] Re: inserting values in a binary tree

2008-05-10 Thread Achim Schneider
PR Stanley [EMAIL PROTECTED] wrote: Actually, you've touched an important point there. It's balancing that I'm having difficulty with. Paul http://en.wikipedia.org/wiki/Tree_rotation is the key to all this: It changes the tree structure without changing the tree ordering. rotr (Node (Node a

Re: [Haskell-cafe] Old editions of The Monad.Reader lost

2008-05-10 Thread Wouter Swierstra
Almost all? Is that why some are missing? eg. http://www.haskell.org/haskellwiki/The_Monad.Reader/Issue2 omits Impure Thoughts 1 - Thtatic Compilathionth (without a lisp) http://www.haskell.org/tmrwiki/ImpureThoughts_2f1. Philippa did not want her articles published under the new license -

Re: [Haskell-cafe] unsafeInterleaveIO and OpenGL

2008-05-10 Thread Peter Verswyvelen
Sounds reasonable. 'unsafeInterleaveIO' defers computation of 'vp' until it is actually needed. At this time the viewport might have changed. That sound reasonable indeed, but the viewport does not change and the values I get are really random. I'll try to make minimal example to demonstrate

Re: Re[2]: [Haskell-cafe] I am new to haskell

2008-05-10 Thread Giorgio Valoti
On 09/mag/08, at 13:59, Benjamin L. Russell wrote: […] i recommend you to read papers from the http://haskell.org/haskellwiki/Learning_Haskell page, in particular those in Advanced tutorials, Monads, Type classes, Popular libraries sections That is one idea. Also, since The Haskell School

Re: [Haskell-cafe] List concat

2008-05-10 Thread Andrew Coppin
Lennart Augustsson wrote: There are many implementations of such things. Data.Sequence is one. You can also make an implementation that has O(1) cons, snoc, and append, but that's rather tricky and has a large constant factor. Ah. So not only is it possible, but it's already in a standard

Re: [Haskell-cafe] List concat

2008-05-10 Thread Ross Paterson
On Fri, May 09, 2008 at 11:04:26PM +0100, Lennart Augustsson wrote: There are many implementations of such things. Data.Sequence is one. You can also make an implementation that has O(1) cons, snoc, and append, but that's rather tricky and has a large constant factor. It's also rather

[Haskell-cafe] Type unions

2008-05-10 Thread Eric Stansifer
I have been trying to write a DSL for Povray (see www.povray.org) in Haskell, using the technique of: http://okmij.org/ftp/papers/tagless-final-APLAS.pdf with some inspiration taken from http://okmij.org/ftp/Haskell/DSLSharing.hs The Povray Scene Description Language is a very declarative

[Haskell-cafe] Copy on read

2008-05-10 Thread Andrew Coppin
I just had a random idea, which I thought I'd share with you all. I've heard about systems that do copy on write. That is, all users share a single copy of some structure, until somebody tries to write on it. At that moment they get a personal copy to modify so they don't upset everybody

Re: [Haskell-cafe] Order of Evaluation

2008-05-10 Thread Daniil Elovkov
Hello You may find this paper useful http://research.microsoft.com/~simonpj/Papers/spineless-tagless-gmachine.ps.gz It should give you the general feeling of how things are actually executed. It's quite old, some things in GHC have changed, but the overall scheme, I believe, is the same. The

Re: [Haskell-cafe] Type unions

2008-05-10 Thread Lennart Augustsson
Try making a type class for the functions. That will allow you both varargs and unions. Have a look at Text.Printf. -- Lennart On Sat, May 10, 2008 at 1:28 PM, Eric Stansifer [EMAIL PROTECTED] wrote: I have been trying to write a DSL for Povray (see www.povray.org) in Haskell, using the

Re: [Haskell-cafe] Type unions

2008-05-10 Thread Eric Stansifer
Try making a type class for the functions. That will allow you both varargs and unions. Have a look at Text.Printf. Thank you -- looking at Printf was very helpful. My syntax is much happier as a result. I also see now that I am approaching the problem from the wrong direction -- that by

Re[2]: [Haskell-cafe] Type unions

2008-05-10 Thread Bulat Ziganshin
Hello Eric, Saturday, May 10, 2008, 8:26:27 PM, you wrote: Thank you -- looking at Printf was very helpful. My syntax is much happier as a result. btw, i also recommend to look into HsLua[1] which uses type classes in very smart and elegant way to automatically convert between Haskell and

Re: [Haskell-cafe] Copy on read

2008-05-10 Thread Malcolm Wallace
If Haskell had uniqueness typing, maybe the compiler could be made to infer when values are used in a unique way. And maybe if the compiler can detect data being used in a unique way, it could code for in-place updates instead of copying, and thereby gain a performance advantage.

Re: [Haskell-cafe] Old editions of The Monad.Reader lost

2008-05-10 Thread Gwern Branwen
On 2008.05.10 12:17:45 +0100, Wouter Swierstra [EMAIL PROTECTED] scribbled 0.4K characters: Almost all? Is that why some are missing? eg. http://www.haskell.org/haskellwiki/The_Monad.Reader/Issue2 omits Impure Thoughts 1 - Thtatic Compilathionth (without a lisp)

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

2008-05-10 Thread Don Stewart
emil.skoldberg: On Fri, May 09, 2008 at 10:21:19PM -0700, Donn Cave wrote: So here I am with 64 bit Athlon hardware, running amd64 NetBSD (a.k.a. x86_64), reasonably motivated to compile Haskell. From what I make of the porting instructions, So, we are in the same boat then! my only

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

2008-05-10 Thread Matthias Kilian
On Sat, May 10, 2008 at 12:13:16PM -0700, Don Stewart wrote: I wonder if it is still possible to use the .hc files already generated for the OpenBSD/amd64 port, and use those to do the port to NetBSD/amd64. http://www.openbsd.org/cgi-bin/cvsweb/ports/lang/ghc/ If nobody tries,

[Haskell-cafe] seeking advice on my POSIX wrapper

2008-05-10 Thread Galchin, Vasili
Hello, Last night I sent out an announcement about some POSIX work that I have been doing. In any case, one of the FFI wrappers is driving me crazy, i.e. the one for mq_receive: http://opengroup.org/onlinepubs/007908799/xsh/mq_receive.html . When I call this function (mqReceive), I get

Re: [Haskell-cafe] seeking advice on my POSIX wrapper

2008-05-10 Thread Bulat Ziganshin
Hello Vasili, Sunday, May 11, 2008, 12:47:52 AM, you wrote: . When I call this function (mqReceive), I get message too long. you can divide-and-conquer the problem by trying 1) write the C code that calls mq_receive with the same params 2) call your own function instead of mq_receive and

Re: [Haskell-cafe] seeking advice on my POSIX wrapper

2008-05-10 Thread Brandon S. Allbery KF8NH
On 2008 May 10, at 16:47, Galchin, Vasili wrote: Last night I sent out an announcement about some POSIX work that I have been doing. In any case, one of the FFI wrappers is driving me crazy, i.e. the one for mq_receive:http://opengroup.org/onlinepubs/007908799/xsh/mq_receive.html .

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

2008-05-10 Thread Donn Cave
On Sat, 10 May 2008 12:13:16 -0700 Don Stewart [EMAIL PROTECTED] wrote: I wonder if it is still possible to use the .hc files already generated for the OpenBSD/amd64 port, and use those to do the port to NetBSD/amd64. http://www.openbsd.org/cgi-bin/cvsweb/ports/lang/ghc/ That

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

2008-05-10 Thread Matthias Kilian
On Sat, May 10, 2008 at 02:36:43PM -0700, Donn Cave wrote: I wonder if it is still possible to use the .hc files already generated for the OpenBSD/amd64 port, and use those to do the port to NetBSD/amd64. http://www.openbsd.org/cgi-bin/cvsweb/ports/lang/ghc/ That sounds fine

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

2008-05-10 Thread Don Stewart
kili: http://openbsd.dead-parrot.de/distfiles/ghc-6.6.1-amd64-unknown-openbsd-hc.tar.bz2 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? as apparently 6.8 is

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

2008-05-10 Thread PR Stanley
Paul: Hi folks data Maybe a = Nothing | Just a What is the underlying rationale for the Maybe data type? is it the safe style of programming it encourages/ Something tells me this is going to start a lengthy discussion. :-) Bob: Pure and simple -- it allows

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

2008-05-10 Thread Brandon S. Allbery KF8NH
On 2008 May 10, at 18:56, PR Stanley wrote: Paul: Hi folks data Maybe a = Nothing | Just a What is the underlying rationale for the Maybe data type? is it the safe style of programming it encourages/ Something tells me this is going to start a lengthy discussion.

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

2008-05-10 Thread PR Stanley
Paul: Hi folks data Maybe a = Nothing | Just a What is the underlying rationale for the Maybe data type? is it the safe style of programming it encourages/ Something tells me this is going to start a lengthy discussion. :-) Bob: Pure and simple -- it allows you

Re: [Haskell-cafe] seeking advice on my POSIX wrapper

2008-05-10 Thread Galchin, Vasili
sender .. main = do fd - mqOpen /myipc ReadWrite (Just nullFileMode) (Just (MQAttributes 0 128 128 0)) mqSend fd Hello world 11 1 (MQAttributes flags maxMsgNum maxMsgSize curNumMsgs) - mqGetAttributes fd putStrLn (attrs flags- ++ (show flags) ++ maxMsgNum

Re: [Haskell-cafe] seeking advice on my POSIX wrapper

2008-05-10 Thread Galchin, Vasili
The Linux version of mqueue that I am using is implemented as a Linux filesystem. I am reading now, Brandon. V. On Sat, May 10, 2008 at 4:09 PM, Brandon S. Allbery KF8NH [EMAIL PROTECTED] wrote: On 2008 May 10, at 16:47, Galchin, Vasili wrote: Last night I sent out an announcement

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

2008-05-10 Thread Philip Weaver
On Sat, May 10, 2008 at 3:10 PM, PR Stanley [EMAIL PROTECTED] wrote: Paul: Hi folks data Maybe a = Nothing | Just a What is the underlying rationale for the Maybe data type? is it the safe style of programming it encourages/ Something tells me this is going to start a

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

2008-05-10 Thread Sebastian Sylvan
On Sat, May 10, 2008 at 11:36 PM, PR Stanley [EMAIL PROTECTED] wrote: Hi folks data Maybe a = Nothing | Just a What is the underlying rationale for the Maybe data type? is it the safe style of programming it encourages/ Something tells me this is going to start a lengthy

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

2008-05-10 Thread Brandon S. Allbery KF8NH
On 2008 May 10, at 20:41, Philip Weaver wrote: On Sat, May 10, 2008 at 3:10 PM, PR Stanley [EMAIL PROTECTED] wrote: 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

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

2008-05-10 Thread Eric Stansifer
IME nullable by default is one of the biggest sources of runtime crashes in high level OOP languages like C#, which is a shame because it really isn't that difficult to statically eliminate the vast majority of them, especially when you're sort of hand-waving the semantics of your language

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

2008-05-10 Thread Lars Viklund
On Sun, May 11, 2008 at 02:59:32AM +0100, Eric Stansifer wrote: I definitely agree. After I'd been learning Haskell for 6 months and then wrote a program in Java C++, almost the first thing I did was code up a generic MaybeT class in each language. It is so much clearer and more obvious to