Re: [Haskell-cafe] return in Monad class necessary?

2007-11-27 Thread Reinier Lamers
Chris Eidhof wrote: On 26 nov 2007, at 19:48, Henning Thielemann wrote: I wonder whether it is a typical mistake of beginners to write 'return' within a do-block (that is, not at the end) and if it is possible to avoid this mistake by clever typing. In a proper monad 'return' can be fused

Re: [Haskell-cafe] return in Monad class necessary?

2007-11-27 Thread Chris Eidhof
On 27 nov 2007, at 10:14, Reinier Lamers wrote: Chris Eidhof wrote: On 26 nov 2007, at 19:48, Henning Thielemann wrote: I wonder whether it is a typical mistake of beginners to write 'return' within a do-block (that is, not at the end) and if it is possible to avoid this mistake by clever

Re: [Haskell-cafe] New slogan for haskell.org

2007-11-27 Thread Ketil Malde
Thomas Schilling [EMAIL PROTECTED] writes: Haskell is a general-purpose, pure functional programming languages that puts many interesting results from research into a practical programming language. It's features include: * Static typing with type inference: enables writing robust and fast

Re: [Haskell-cafe] Browser action and new http library

2007-11-27 Thread Bjorn Bringert
On Nov 27, 2007, at 0:54 , bbrown wrote: I am trying to use the HTTP library 3001 for ghc 6.8 and cant figure out how to use a proxy to do a GET request as I am behind a proxy server. My thinking is that I could use the setProxy method it looks like it returns a BrowserAction? What do I

[Haskell-cafe] Re: map/reduce example

2007-11-27 Thread Mirko Rahn
i've written small program which demonstrates how map/reduce may be implemented in Haskell. it counts amount of words in file, splitting it into 64kb blocks processed by two threads. their results are combined by another two threads. how it may be made better? Hello, I do not know anything

[Haskell-cafe] about GADTs on ghci

2007-11-27 Thread Yu-Teh Shen
i have seen the documents in http://www.haskell.org/haskellwiki/Generalised_algebraic_datatype but i can not run the following code on ghci ex: data Term x where K :: Term (a - b - a) S :: Term ((a - b - c) - (a - b) - a - c) Const :: a - Term a (:@) :: Term (a - b) - (Term a) -

Re: [Haskell-cafe] about GADTs on ghci

2007-11-27 Thread Luke Palmer
On Nov 27, 2007 12:57 PM, Yu-Teh Shen [EMAIL PROTECTED] wrote: i have seen the documents in http://www.haskell.org/haskellwiki/Generalised_algebraic_datatype but i can not run the following code on ghci ex: data Term x where K :: Term (a - b - a) S :: Term ((a - b - c) - (a - b)

Re: [Haskell-cafe] St. Petersburg Game

2007-11-27 Thread Ketil Malde
[EMAIL PROTECTED] writes: increment b = b + 1 This is also called 'succ' (for successor). main = dolet b = 0 let c = randomRIO (1,2) until (c == 1) increment b return b ERROR StPetersburg.hs:8 - Type error in application *** Expression

Re: [Haskell-cafe] St. Petersburg Game

2007-11-27 Thread Lutz Donnerhacke
* [EMAIL PROTECTED] wrote: I'm trying to program an implementation of the St. Petersburg game in Haskell. There is a coin toss implied, and the random-number generation is driving me quite mad. So far, I've tried this: import Random import System.Random -- time goes on, interfaces change

Re: [Haskell-cafe] New slogan for haskell.org

2007-11-27 Thread Thomas Schilling
On Mon, 2007-11-26 at 20:31 -0800, David Fox wrote: On Nov 26, 2007 11:38 AM, Thomas Schilling [EMAIL PROTECTED] wrote: Haskell is a general-purpose, pure functional programming languages that puts many interesting results from research into a

Re: [Haskell-cafe] St. Petersburg Game

2007-11-27 Thread Thomas Davie
main = do let b = 0 let c = randomRIO (1,2) until (c == 1) increment b return b This is intended to print the number of consecutive heads (i.e., 2) before the first tail, but I get the following error: ERROR StPetersburg.hs:8 - Type

Re: [Haskell-cafe] St. Petersburg Game

2007-11-27 Thread Luke Palmer
On Nov 27, 2007 1:27 PM, [EMAIL PROTECTED] wrote: Hello, I'm trying to program an implementation of the St. Petersburg game in Haskell. There is a coin toss implied, and the random-number generation is driving me quite mad. So far, I've tried this: Yeah, random number generation is one of

Re: [Haskell-cafe] about GADTs on ghci

2007-11-27 Thread Yu-Teh Shen
Thanks. So GADT provide us to generic type to include all types, is it right? ex: data Parser tok a where Zero :: Parser tok () One :: Parser tok () Check :: (tok - Bool) - Parser tok tok Satisfy :: ([tok] - Bool) - Parser tok [tok] Push :: tok - Parser tok a - Parser tok a

Re: [Haskell-cafe] A tale of three shootout entries

2007-11-27 Thread Richard Kelsall
Sterling Clover wrote: ... Finally, there's fasta. http://shootout.alioth.debian.org/gp4/benchmark.php?test=fastalang=ghcid=2 This one really depresses me. It outperforms the previous version by roughly 20% on my machine (PPC) but underperforms by roughly the same amount on the shootout

Re: [Haskell-cafe] New slogan for haskell.org

2007-11-27 Thread David Menendez
On Nov 26, 2007 1:44 PM, Thomas Davie [EMAIL PROTECTED] wrote: But the point is that this section of the site is the bit that's meant to be an advertisement -- we're trying to encourage people to read more, Are we? I thought Haskell.org was intended to describe what Haskell *is*. There are

Re: [Haskell-cafe] return in Monad class necessary?

2007-11-27 Thread David Menendez
On Nov 27, 2007 4:45 AM, Chris Eidhof [EMAIL PROTECTED] wrote: First, some people want to use return just as an imperative programmer would use it: to exit from a function. So the programmer doesn't expect the commands after that return are executed. This is more a problem with the name. I

Re: [Haskell-cafe] New slogan for haskell.org

2007-11-27 Thread Thomas Davie
On 27 Nov 2007, at 14:44, David Menendez wrote: On Nov 26, 2007 1:44 PM, Thomas Davie [EMAIL PROTECTED] wrote: But the point is that this section of the site is the bit that's meant to be an advertisement -- we're trying to encourage people to read more, Are we? I thought Haskell.org was

Re: [Haskell-cafe] New slogan for haskell.org

2007-11-27 Thread Thomas Schilling
On Tue, 2007-11-27 at 09:44 -0500, David Menendez wrote: On Nov 26, 2007 1:44 PM, Thomas Davie [EMAIL PROTECTED] wrote: But the point is that this section of the site is the bit that's meant to be an advertisement -- we're trying to

RE: [Haskell-cafe] A tale of three shootout entries

2007-11-27 Thread Simon Peyton-Jones
| Something I found with Dons version on my machine was that if I removed | all the exclamation marks and the -fbang-patterns bit at the top it went | about 20% faster as well as being much cleaner code, but with my very | rudimentary understanding of Haskell I wasn't entirely sure it would |

Re: [Haskell-cafe] St. Petersburg Game

2007-11-27 Thread pepe
Hola Manolo, What you are trying to do is very easy in Haskell, but you'd better change the approach. In short, you are trying to use b as if it was a mutable variable, which it is not! One could rewrite your program using mutable variables, as below: import Data.IORef import Random

[Haskell-cafe] About garbage collecting

2007-11-27 Thread Maurí­cio
Hi, If available memory is low, is the garbage collector going to eliminate data that is still referenced, but it knows it can be recalculated when needed? Thanks, Maurício ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org

Re: [Haskell-cafe] Why aren't Float and Double Bounded?

2007-11-27 Thread Henning Thielemann
On Mon, 26 Nov 2007, Jason Dusek wrote: Among numeric types, it seems that only integer types are Bounded. Maybe because IEEE format supports Infinity? ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org

Re: [Haskell-cafe] About garbage collecting

2007-11-27 Thread Brent Yorgey
On Nov 27, 2007 10:43 AM, Maurí­cio [EMAIL PROTECTED] wrote: Hi, If available memory is low, is the garbage collector going to eliminate data that is still referenced, but it knows it can be recalculated when needed? If I understand it correctly, when a thunk is evaluated, it is actually

Re: [Haskell-cafe] A tale of three shootout entries

2007-11-27 Thread Adrian Hey
Simon Peyton-Jones wrote: | Something I found with Dons version on my machine was that if I removed | all the exclamation marks and the -fbang-patterns bit at the top it went | about 20% faster as well as being much cleaner code, but with my very | rudimentary understanding of Haskell I wasn't

Re: [Haskell-cafe] New slogan for haskell.org

2007-11-27 Thread Henning Thielemann
On Tue, 27 Nov 2007, Thomas Davie wrote: On 27 Nov 2007, at 14:44, David Menendez wrote: On Nov 26, 2007 1:44 PM, Thomas Davie [EMAIL PROTECTED] wrote: But the point is that this section of the site is the bit that's meant to be an advertisement -- we're trying to encourage people to

Re: [Haskell-cafe] St. Petersburg Game

2007-11-27 Thread Henning Thielemann
On Tue, 27 Nov 2007 [EMAIL PROTECTED] wrote: Hello, I'm trying to program an implementation of the St. Petersburg game in Haskell. There is a coin toss implied, and the random-number generation is driving me quite mad. So far, I've tried this: import Random increment :: Int - Int

Re: [Haskell-cafe] Waiting for thread to finish

2007-11-27 Thread Don Stewart
briqueabraque: Hi, After I have spawned a thread with 'forkIO', how can I check if that thread work has finished already? Or wait for it? The usual trick I use is to have an MVar that child thread can set when done, causing the main thread to wait: main = do done - newEmptyMVar

Re: [Haskell-cafe] New slogan for haskell.org

2007-11-27 Thread David Fox
On Nov 27, 2007 8:14 AM, Henning Thielemann [EMAIL PROTECTED] wrote: On Tue, 27 Nov 2007, Thomas Davie wrote: On 27 Nov 2007, at 14:44, David Menendez wrote: On Nov 26, 2007 1:44 PM, Thomas Davie [EMAIL PROTECTED] wrote: But the point is that this section of the site is the bit

Re: [Haskell-cafe] New slogan for haskell.org

2007-11-27 Thread Thomas Schilling
On Tue, 2007-11-27 at 08:34 -0800, David Fox wrote: On Nov 27, 2007 8:14 AM, Henning Thielemann [EMAIL PROTECTED] wrote: On Tue, 27 Nov 2007, Thomas Davie wrote: On 27 Nov 2007, at 14:44, David Menendez wrote: On Nov 26, 2007 1:44 PM,

Re: [Haskell-cafe] New slogan for haskell.org

2007-11-27 Thread Graham Fawcett
On Nov 27, 2007 11:14 AM, Henning Thielemann [EMAIL PROTECTED] wrote: I think this is true, but for me it means, that we do not need another advertisement at Haskell.org, but facts. I also expect that people visiting the site already know about static typing and have categorized themselves

[Haskell-cafe] Re: Waiting for thread to finish

2007-11-27 Thread ChrisK
Maurí­cio wrote: Hi, After I have spawned a thread with 'forkIO', how can I check if that thread work has finished already? Or wait for it? Thanks, Maurício The best way to do this is using Control.Exception.finally: myFork :: IO () - IO (ThreadId,MVar ()) myFork todo = m -

[Haskell-cafe] the ability to talk to POSIX device drivers

2007-11-27 Thread Galchin Vasili
Hello, I saw somewhere that in one of the Haskell libraries there is support to open, read, write, ioctl, etc. to POSIX drivers, but I don't see in the Haskell Report. ?? Kind regards, Vasili ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org

Re: [Haskell-cafe] the ability to talk to POSIX device drivers

2007-11-27 Thread Don Stewart
vigalchin: Hello, I saw somewhere that in one of the Haskell libraries there is support to open, read, write, ioctl, etc. to POSIX drivers, but I don't see in the Haskell Report. ?? Have a look in the 'unix' library. The Haskell report defines the language, not the

Re: [Haskell-cafe] Strings and utf-8

2007-11-27 Thread Paul Johnson
Brandon S. Allbery KF8NH wrote: However, the IO system truncates [characters] to 8 bits. I Should this be considered a bug? I presume that its because stdio.h was defined in the days of ASCII-only strings, and the functions in System.IO are defined in terms of stdio.h. But does this need to

Re: [Haskell-cafe] A tale of three shootout entries

2007-11-27 Thread Richard Kelsall
Simon Peyton-Jones wrote: | Something I found with Dons version on my machine was that if I removed | all the exclamation marks and the -fbang-patterns bit at the top it went | about 20% faster as well as being much cleaner code, but with my very | rudimentary understanding of Haskell I wasn't

Re: [Haskell-cafe] A tale of three shootout entries

2007-11-27 Thread Don Stewart
r.kelsall: Simon Peyton-Jones wrote: | Something I found with Dons version on my machine was that if I removed | all the exclamation marks and the -fbang-patterns bit at the top it went | about 20% faster as well as being much cleaner code, but with my very | rudimentary understanding of

Re: [Haskell-cafe] A tale of three shootout entries

2007-11-27 Thread Ryan Dickie
Oops forgot to hit reply-to-all.. resending.. N-body is looking good. I am running and amd64 3000+ on ghc 6.8.1. The debian shootout is showing a huge gap between ghc 6.6 and g++ but I am not seeing that gap. One concern though is that the code doesn't look very haskellish. So much pointer

Re: [Haskell-cafe] A tale of three shootout entries

2007-11-27 Thread Ryan Dickie
Never mind. I screwed up the timings. The new haskell timings are still a huge improvement but they are: -0.169075164 -0.169031665 real0m27.196s user0m19.688s sys 0m0.163s On Nov 27, 2007 11:25 AM, Ryan Dickie [EMAIL PROTECTED] wrote: Oops forgot to hit reply-to-all.. resending..

Re: [Haskell-cafe] Re: is there a more concise way to generate helper functions for a datatype built on records?

2007-11-27 Thread Isaac Dupree
apfelmus wrote: Benedikt Huber wrote: type Upd a = a - a data Ref cx t = Ref { select :: cx - t , update :: Upd t - Upd cx } Functional references are also called lens, I'm going to use that term from now on. As a minor note, I somehow prefer a single primitive data Lens s a =

Re: [Haskell-cafe] A tale of three shootout entries

2007-11-27 Thread Richard Kelsall
Don Stewart wrote: ... There may well have been changes to the strictness analyser that make some of the bangs (or most) unnecessary now. Also, its very likely I didn't check all combinations of strict and lazy arguments for the optimal evaluation strategy :) I suspect the optimum details

Re: [Haskell-cafe] Why aren't Float and Double Bounded?

2007-11-27 Thread Isaac Dupree
Henning Thielemann wrote: On Mon, 26 Nov 2007, Jason Dusek wrote: Among numeric types, it seems that only integer types are Bounded. Maybe because IEEE format supports Infinity? therefore, maxBound is Infinity and minBound negative infinity? Isaac

Re: [Haskell-cafe] about GADTs on ghci

2007-11-27 Thread Andrew Coppin
Luke Palmer wrote: You can also put the line {-# OPTIONS_GHC -fglasgow-exts #-} At the top, to turn on glasgow extensions whenever GHC compiles this file. I was under the impression that it's better to use the LANGUAGE pragma rather than the catch-all Glasgow-exts option. However, I

[Haskell-cafe] Re: Waiting for thread to finish

2007-11-27 Thread Maurí­cio
Hi, After I have spawned a thread with 'forkIO', how can I check if that thread work has finished already? Or wait for it? The best way to do this is using Control.Exception.finally: (...) These techniques are needed because forkIO is a very lightweight threading mechanism. Adding

Re: [Haskell-cafe] about GADTs on ghci

2007-11-27 Thread Ian Lynagh
On Tue, Nov 27, 2007 at 07:11:27PM +, Andrew Coppin wrote: I was under the impression that it's better to use the LANGUAGE pragma rather than the catch-all Glasgow-exts option. However, I can't actually find a language option for GADTs... somebody care to clarify? In GHC 6.8.1 it's

Re: [Haskell-cafe] Re: Waiting for thread to finish

2007-11-27 Thread Don Stewart
briqueabraque: Hi, After I have spawned a thread with 'forkIO', how can I check if that thread work has finished already? Or wait for it? The best way to do this is using Control.Exception.finally: (...) These techniques are needed because forkIO is a very lightweight

Re: [Haskell-cafe] about GADTs on ghci

2007-11-27 Thread Thomas Schilling
On Tue, 2007-11-27 at 19:11 +, Andrew Coppin wrote: Luke Palmer wrote: You can also put the line {-# OPTIONS_GHC -fglasgow-exts #-} At the top, to turn on glasgow extensions whenever GHC compiles this file. I was under the impression that it's better to use the LANGUAGE

Re: [Haskell-cafe] Why aren't Float and Double Bounded?

2007-11-27 Thread Josh Lee
On Tue, 27 Nov 2007 14:41:59 -0500 Isaac Dupree [EMAIL PROTECTED] wrote: Henning Thielemann wrote: On Mon, 26 Nov 2007, Jason Dusek wrote: Among numeric types, it seems that only integer types are Bounded. Maybe because IEEE format supports Infinity? therefore, maxBound is

Re: [Haskell-cafe] Why aren't Float and Double Bounded?

2007-11-27 Thread Henning Thielemann
On Tue, 27 Nov 2007, Josh Lee wrote: On Tue, 27 Nov 2007 14:41:59 -0500 Isaac Dupree [EMAIL PROTECTED] wrote: Henning Thielemann wrote: On Mon, 26 Nov 2007, Jason Dusek wrote: Among numeric types, it seems that only integer types are Bounded. Maybe because IEEE format

[Haskell-cafe] A tale of Project Euler

2007-11-27 Thread Andrew Coppin
Hi guys. Somebody just introduced me to a thing called Project Euler. I gather it's well known around here... Anyway, I was a little bit concerned about problem #7. The problem is basically figure out what the 10,001st prime number is. Consider the following two programs for solving this:

Re: [Haskell-cafe] A tale of Project Euler

2007-11-27 Thread Brent Yorgey
On Nov 27, 2007 2:34 PM, Andrew Coppin [EMAIL PROTECTED] wrote: Hi guys. Somebody just introduced me to a thing called Project Euler. I gather it's well known around here... Anyway, I was a little bit concerned about problem #7. The problem is basically figure out what the 10,001st prime

Re: [Haskell-cafe] Why aren't Float and Double Bounded?

2007-11-27 Thread Bit Connor
Actually, IEEE numbers are designed in such a way, that if you interpret their bits as integer number, then 'succ' leads you to the next larger representable number. Thus you only have to cast from Float or Double to Int32 or Int64 respectively, call enumFromTo, then cast back to Float or

Re: [Haskell-cafe] A tale of Project Euler

2007-11-27 Thread Don Stewart
andrewcoppin: Hi guys. Somebody just introduced me to a thing called Project Euler. I gather it's well known around here... Anyway, I was a little bit concerned about problem #7. The problem is basically figure out what the 10,001st prime number is. Consider the following two programs

Re: [Haskell-cafe] A tale of Project Euler

2007-11-27 Thread Henning Thielemann
On Tue, 27 Nov 2007, Andrew Coppin wrote: So, now I have a Haskell version that's only several hundred times slower. Neither program is especially optimised, yet the C version is drastically faster. This makes me sad. :-( I think the C version is so much faster because it does not need

Re: [Haskell-cafe] Why aren't Float and Double Bounded?

2007-11-27 Thread Andrew Coppin
Josh Lee wrote: On Tue, 27 Nov 2007 14:41:59 -0500 Isaac Dupree [EMAIL PROTECTED] wrote: Henning Thielemann wrote: On Mon, 26 Nov 2007, Jason Dusek wrote: Among numeric types, it seems that only integer types are Bounded. Maybe because IEEE format supports Infinity?

[Haskell-cafe] Re: is there a more concise way to generate helper functions for a datatype built on records?

2007-11-27 Thread apfelmus
Isaac Dupree wrote: apfelmus wrote: dup :: Lens a (a,a) dup = id id Which component of the pair should put dup :: a - (a,a) - (a,a) change? The first, the second, or even both? [...] put :: Lens s a - a - s - s put x = flip $ snd . focus x wouldn't put dup :: (a,a) - a - a

Re: [Haskell-cafe] A tale of Project Euler

2007-11-27 Thread Olivier Boudry
On 11/27/07, Andrew Coppin [EMAIL PROTECTED] wrote: Hi guys. Somebody just introduced me to a thing called Project Euler. I gather it's well known around here... Anyway, I was a little bit concerned about problem #7. The problem is basically figure out what the 10,001st prime number is.

Re: [Haskell-cafe] Why aren't Float and Double Bounded?

2007-11-27 Thread Henning Thielemann
On Tue, 27 Nov 2007, Bit Connor wrote: Actually, IEEE numbers are designed in such a way, that if you interpret their bits as integer number, then 'succ' leads you to the next larger representable number. Thus you only have to cast from Float or Double to Int32 or Int64 respectively,

Re: [Haskell-cafe] A tale of Project Euler

2007-11-27 Thread Andrew Coppin
Andrew Coppin wrote: Also, I'm stuck with problem #10. (Find the sum of all primes less than 1 million.) I've let the program run for well over 15 minutes, and still no answer is forthcomming. It's implemented using the same primes function as above, with a simple filter and sum. (The type has

Re: [Haskell-cafe] Why aren't Float and Double Bounded?

2007-11-27 Thread Yitzchak Gale
Bit Connor wrote: Also, a related question: How do you convert from Float - Double, and the reverse? Only thing I could find is (fromRational . toRational) which I also imagine to be slow, and I also wonder about accuracy. realToFrac -Yitz ___

Re: [Haskell-cafe] A tale of Project Euler

2007-11-27 Thread Sebastian Sylvan
On Nov 27, 2007 8:54 PM, Olivier Boudry [EMAIL PROTECTED] wrote: Hi Andrew, I don't remember who I stole this prime computation from, but it is very fast (10001's prime in 0.06 sec with Int and 0.2 with Integer on my machine) and not overly complex: primes :: [Integer] primes = 2 :

Re: [Haskell-cafe] A tale of Project Euler

2007-11-27 Thread Sebastian Sylvan
On Nov 27, 2007 8:44 PM, Andrew Coppin [EMAIL PROTECTED] wrote: Andrew Coppin wrote: Also, I'm stuck with problem #10. (Find the sum of all primes less than 1 million.) I've let the program run for well over 15 minutes, and still no answer is forthcomming. It's implemented using the same

Re: [Haskell-cafe] A tale of Project Euler

2007-11-27 Thread Andrew Coppin
On the other hand, I must relay to you how much fun I had with certain other problems. For example, problem #12. I started with this: triangles = scanl1 (+) [1..] divisors n = length $ filter (\x - n `mod` x == 0) [1..n] answer = head $ dropWhile (\n - divisors n 500) triangles Sadly,

Re: [Haskell-cafe] A tale of Project Euler

2007-11-27 Thread Yitzchak Gale
Andrew Coppin wrote: On the other hand, I must relay to you how much fun I had with certain other problems. You may want to look at: http://haskell.org/haskellwiki/Euler_problems and make some contributions. But be very careful what you peek at, so don't spoil your own fun. Regards, Yitz

Re: [Haskell-cafe] Why aren't Float and Double Bounded?

2007-11-27 Thread Henning Thielemann
On Tue, 27 Nov 2007, Yitzchak Gale wrote: Bit Connor wrote: Also, a related question: How do you convert from Float - Double, and the reverse? Only thing I could find is (fromRational . toRational) which I also imagine to be slow, and I also wonder about accuracy. realToFrac added to

Re: [Haskell-cafe] A tale of Project Euler

2007-11-27 Thread Olivier Boudry
On 11/27/07, Sebastian Sylvan [EMAIL PROTECTED] wrote: That is indeed a nice and clear version that's pretty fast. It's basically the same as the C version except backwards (i.e. examine a number and work backwards through its divisors, rather than filling in a map of all multiples of a known

Re: [Haskell-cafe] A tale of Project Euler

2007-11-27 Thread Andrew Coppin
Brent Yorgey wrote: The algorithm you use to compute primes is actually quite inefficient, and in particular, it is NOT the same algorithm that the C program is using, despite first appearances! The call to 'filter' in the sieve function works by checking *every* number for divisibility by p,

[Haskell-cafe] Re: New slogan for haskell.org

2007-11-27 Thread apfelmus
David Menendez wrote: Thomas Davie wrote: But the point is that this section of the site is the bit that's meant to be an advertisement -- we're trying to encourage people to read more, Are we? I thought Haskell.org was intended to describe what Haskell *is*. There are plenty of articles

Re: [Haskell-cafe] Re: New slogan for haskell.org

2007-11-27 Thread Henning Thielemann
On Tue, 27 Nov 2007, apfelmus wrote: More specifically, fact means something that you can easily check yourself. Robust/maintainable/testable code are things you _can't_ easily check yourself without already learning the language. +1 But shorter code is a fact you can easily check, for

[Haskell-cafe] building a Haskell package on cygwin

2007-11-27 Thread Galchin Vasili
Hello, What is involved in building a package on cygwin? Kind regards, Vasya ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

[Haskell-cafe] Re: New slogan for haskell.org

2007-11-27 Thread apfelmus
Henning Thielemann wrote: apfelmus wrote: Back then, I was given the task to calculate some sequence of numbers which I did in one page of C code. So far so good, but when I asked the task assigner about his solution, he responded: Ah, this problem, that's 1 line in Haskell. Well, 2 lines if

Re: [Haskell-cafe] A tale of Project Euler

2007-11-27 Thread Andrew Coppin
Don Stewart wrote: This is an FAQ. Unless you use the same algorithm and data types in benchmarks, you're not really benchmarking anything. And expecting one of the worst possible algorithms to be good is hoping for a little too much :) Well, if I was comparing my Haskell against some

[Haskell-cafe] nbody (my own attempt) and performance problems

2007-11-27 Thread Ryan Dickie
I thought it would be a nice exercise (and a good learning experience) to try and solve the nbody problem from the debian language shootout. Unfortunately, my code sucks. There is a massive space leak and performance is even worse. On the bright side, my implementation is purely functional. My

Re: [Haskell-cafe] Re: New slogan for haskell.org

2007-11-27 Thread David Fox
On Nov 27, 2007 1:33 PM, apfelmus [EMAIL PROTECTED] wrote: David Menendez wrote: Thomas Davie wrote: But the point is that this section of the site is the bit that's meant to be an advertisement -- we're trying to encourage people to read more, Are we? I thought Haskell.org was

AW: [Haskell-cafe] Building MissingH on Windows - now problems with hslogger

2007-11-27 Thread Nicu
Ok, it looked good, but then I had to install first the hslogger. Here I found the same problem, but I had now the scheme, so I began to change. This it worked fine for configure, but when I try to build, I get: [6 of 6] Compiling System.Log.Logger ( src/System/Log/Logger.hs,

[Haskell-cafe] cabal-install

2007-11-27 Thread Ben Franksen
Just thought I install the latest version (0.4.0) from hackage and test it. Build and install went fine, but then it gets strange: [EMAIL PROTECTED]: .../haskell/cabal-install-0.4.0 sudo runhaskell Setup.lhs install Installing: /usr/local/bin [EMAIL PROTECTED]: .../haskell/cabal-install-0.4.0

Re: [Haskell-cafe] Re: Waiting for thread to finish

2007-11-27 Thread Brad Clow
If you would like to wait on multiple threads, you can use STM like so: import Control.Concurrent import Control.Concurrent.STM import Control.Exception main = do tc - atomically $ newTVar 2 run tc (print (last [1..1])) run tc (print (last [1..11000])) print Waiting

Re: [Haskell-cafe] About garbage collecting

2007-11-27 Thread Lennart Augustsson
This is an idea that has been kicking around for a long time. But no Haskell implementation that I know of implements it. On Nov 27, 2007 3:43 PM, Maurí­cio [EMAIL PROTECTED] wrote: Hi, If available memory is low, is the garbage collector going to eliminate data that is still referenced,

Re: [Haskell-cafe] Re: Waiting for thread to finish

2007-11-27 Thread Brad Clow
I was just watching top while executing this and noticed that it really only used one core (I am using GHC 6.8.1 on a MacBook). Does anyone know why? On Nov 28, 2007 10:34 AM, Brad Clow [EMAIL PROTECTED] wrote: If you would like to wait on multiple threads, you can use STM like so: import

Re: [Haskell-cafe] Re: Waiting for thread to finish

2007-11-27 Thread Spencer Janssen
On Tuesday 27 November 2007 18:46:00 Brad Clow wrote: I was just watching top while executing this and noticed that it really only used one core (I am using GHC 6.8.1 on a MacBook). Does anyone know why? Did you compile with -threaded, and run with +RTS -N2? Cheers, Spencer Janssen

Re: [Haskell-cafe] Re: Waiting for thread to finish

2007-11-27 Thread Brad Clow
Silly mistake. I had compiled with -threaded, but forgot the +RTS -N2. However, I have a more complex app, where I haven't forgotton to use the right flags :-) and the utilisation of cores is very poor. I am thinking it is due to laziness. I am currently wondering how GHC handles the case where

[Haskell-cafe] Re: Re: Waiting for thread to finish

2007-11-27 Thread Ben Franksen
Don Stewart wrote: Beautiful code can be very efficient. Indeed, as I recently the opportunity to demonstrate to my co-workers by re-implementing a script written in Perl that turned out to be just a bit too slow to be useful in practice. My version was not only one tenth the code size and about

Re: [Haskell-cafe] Why aren't Float and Double Bounded?

2007-11-27 Thread Lennart Augustsson
But IEEE can be run with projective infinity in which case there is only one of them. On Nov 27, 2007 7:41 PM, Isaac Dupree [EMAIL PROTECTED] wrote: Henning Thielemann wrote: On Mon, 26 Nov 2007, Jason Dusek wrote: Among numeric types, it seems that only integer types are Bounded.

Re: [Haskell-cafe] Re: Waiting for thread to finish

2007-11-27 Thread Dan Weston
Silly or not, if I compile with -threaded, I always link in the one-liner C file: char *ghc_rts_opts = -N2; so I don't have to remember at runtime whether it should run with 2 cores or not. This just changes the default to 2 cores, so I am still free to run on only one core with the

Re: [Haskell-cafe] Re: Waiting for thread to finish

2007-11-27 Thread Matthew Brecknell
Brad Clow: However, I have a more complex app, where I haven't forgotton to use the right flags :-) and the utilisation of cores is very poor. I am thinking it is due to laziness. I am currently wondering how GHC handles the case where the function that is being forked uses lazy arguments?

Re: [Haskell-cafe] Why aren't Float and Double Bounded?

2007-11-27 Thread Isaac Dupree
Among numeric types, it seems that only integer types are Bounded. Maybe because IEEE format supports Infinity? therefore, maxBound is Infinity and minBound negative infinity? But IEEE can be run with projective infinity in which case there is only one of them. Well, if Double becomes a

Re: [Haskell-cafe] Re: Waiting for thread to finish

2007-11-27 Thread Brad Clow
On Nov 28, 2007 11:30 AM, Matthew Brecknell [EMAIL PROTECTED] wrote: Even with threads, results are evaluated only when they are needed (or when forced by a strictness annotation). So the thread that needs a result (or forces it) first will be the one to evaluate it. So does GHC implement some

Re: [Haskell-cafe] cabal-install

2007-11-27 Thread Don Stewart
ben.franksen: Just thought I install the latest version (0.4.0) from hackage and test it. Build and install went fine, but then it gets strange: [EMAIL PROTECTED]: .../haskell/cabal-install-0.4.0 sudo runhaskell Setup.lhs install Installing: /usr/local/bin [EMAIL PROTECTED]:

Re: [Haskell-cafe] Re: Waiting for thread to finish

2007-11-27 Thread Matthew Brecknell
Brad Clow: If you would like to wait on multiple threads, you can use STM like so: import Control.Concurrent import Control.Concurrent.STM import Control.Exception main = do tc - atomically $ newTVar 2 run tc (print (last [1..1])) run tc (print (last [1..11000]))

Re: [Haskell-cafe] A tale of three shootout entries

2007-11-27 Thread Sterling Clover
I tried the same thing on my box, and indeed the version that isn't strict in the rand function outperforms the original by a fair margin, and seems to do slightly better than my own as well. Killing the bangs in the unroll function also seems to help (especially that in (s!, Just r')).

Re: [Haskell-cafe] New slogan for haskell.org

2007-11-27 Thread Sterling Clover
On Nov 27, 2007, at 11:34 AM, David Fox wrote: In that case we need to identify all the groups that the front page is serving and create separate areas for each, all above the fold as it were: 1. A sales pitch for new users. I see how much this disturbs some people, but maybe it is

Re: [Haskell-cafe] Re: Waiting for thread to finish

2007-11-27 Thread Matthew Brecknell
Brad Clow: So does GHC implement some sychronisation given that a mutation is occuring under the covers, ie. the thunk is being replaced by the result? I believe so, but I have no idea of the details. I am using a TVar to build results of forked functions in. I had a quick go at changing to

Re: [Haskell-cafe] Re: Waiting for thread to finish

2007-11-27 Thread Brad Clow
On Nov 28, 2007 2:39 PM, Matthew Brecknell [EMAIL PROTECTED] wrote: Brad Clow: Don's library is fairly simple. It adds a strictness annotation to force each value you write to a MVar or Chan, so for example, (Control.Concurrent.MVar.Strict.putMVar v x) is basically equivalent to

Re: [Haskell-cafe] nbody (my own attempt) and performance problems

2007-11-27 Thread Ryan Dickie
I sat down tonight and did tons of good learning (which was my goal). Yes, the variable names in the unrolling is a little ugly but it helps to read the C++ version for context. There are two for loops (advN is each inner one unrolled). the other function names match the C++ version. It was my