Re: [Haskell-cafe] GHC vs GCC

2010-03-27 Thread David Menendez
On Sat, Mar 27, 2010 at 12:56 AM, Thomas DuBuisson
thomas.dubuis...@gmail.com wrote:
 Using bang patterns didn't help almost anything here. Using rem
 instead of mod made the time go from 45s to 40s. Now, using -fvia-C
 really helped (when I used rem but not using mod). It went down to
 10s.

 Bang patterns should have helped tons - it isn't GHC thats at fault
 here and yes it does tco.  I attached a version w/ excessive bangs
 below.  Did you compile with ghc --make -O3 -fforce-recomp?

Does -O3 actually do anything? GHC only goes up to -O2.

-- 
Dave Menendez d...@zednenem.com
http://www.eyrie.org/~zednenem/
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Why is it so different between 6.12.1 and 6.10.4_1 ?

2010-03-27 Thread zaxis

I just start ghci from shell and do nothing else. In fact, i really donot
know `Monad ((-) a) ` . Would you mind expplain it ?


Yusaku Hashimoto wrote:
 
 Did you import the module includes the instance of Monad ((-) e)
 somewhere in your code loaded in ghci?
 
 I tried this on a fresh ghci 6.12, but I got No instance error.
 
 -nwn
 
 On Sat, Mar 27, 2010 at 9:20 AM, zaxis z_a...@163.com wrote:

 In 6.12.1 under archlinux
let f x y z = x + y + z
 :t f
 f :: (Num a) = a - a - a - a

 :t (=) . f
 (=) . f :: (Num a) = a - ((a - a) - a - b) - a - b
 ((=) . f) 1 (\f x - f x) 2
 5

 In 6.10.4_1 under freebsd
 let f x y z = x + y + z
 *Money :t f
 f :: (Num a) = a - a - a - a

 :t (=) . f
 (=) . f  :: (Monad ((-) a), Num a) = a - ((a - a) - a - b) - a
 - b
 ((=) . f) 1 (\f x - f x) 2

 interactive:1:1:
    No instance for (Monad ((-) a))
      arising from a use of `=' at interactive:1:1-5
    Possible fix: add an instance declaration for (Monad ((-) a))
    In the first argument of `(.)', namely `(=)'
    In the expression: ((=) . f) 1 (\ f x - f x) 2
    In the definition of `it': it = ((=) . f) 1 (\ f x - f x) 2

 Sincerely!


 -
 fac n = let {  f = foldr (*) 1 [1..n] } in f
 --
 View this message in context:
 http://old.nabble.com/Why-is-it-so-different-between-6.12.1-and-6.10.4_1---tp28049329p28049329.html
 Sent from the Haskell - Haskell-Cafe mailing list archive at Nabble.com.

 ___
 Haskell-Cafe mailing list
 Haskell-Cafe@haskell.org
 http://www.haskell.org/mailman/listinfo/haskell-cafe

 ___
 Haskell-Cafe mailing list
 Haskell-Cafe@haskell.org
 http://www.haskell.org/mailman/listinfo/haskell-cafe
 
 


-
fac n = let {  f = foldr (*) 1 [1..n] } in f 
-- 
View this message in context: 
http://old.nabble.com/Why-is-it-so-different-between-6.12.1-and-6.10.4_1---tp28049329p28050535.html
Sent from the Haskell - Haskell-Cafe mailing list archive at Nabble.com.

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Why is it so different between 6.12.1 and 6.10.4_1 ?

2010-03-27 Thread zaxis

Why do you bother with the interior definition of f in there? 
Because i want to try a C code style not layout style without `do` syntax
sugar .


Yusaku Hashimoto wrote:
 
 fac n = let {  f = foldr (*) 1 [1..n] } in f

 Why do you bother with the interior definition of f in there?

 fac = product . enumFromTo 1
 
 let fac = do is_zero - (==0); if is_zero then return 1 else liftM2
 (*) id (fac . pred)
 
 -nwn
 
 On Sat, Mar 27, 2010 at 9:59 AM, Ivan Lazar Miljenovic
 ivan.miljeno...@gmail.com wrote:
 zaxis z_a...@163.com writes:
 In 6.10.4_1 under freebsd
 let f x y z = x + y + z
 *Money :t f
 f :: (Num a) = a - a - a - a

 :t (=) . f
 (=) . f  :: (Monad ((-) a), Num a) = a - ((a - a) - a - b) - a
 - b
 ((=) . f) 1 (\f x - f x) 2

 interactive:1:1:
     No instance for (Monad ((-) a))
       arising from a use of `=' at interactive:1:1-5
     Possible fix: add an instance declaration for (Monad ((-) a))
     In the first argument of `(.)', namely `(=)'
     In the expression: ((=) . f) 1 (\ f x - f x) 2
     In the definition of `it': it = ((=) . f) 1 (\ f x - f x) 2


 Some definitions and exports got changed, so in 6.12 the (- a) Monad
 instance is exported whereas in 6.10 it isn't.

 fac n = let {  f = foldr (*) 1 [1..n] } in f

 Why do you bother with the interior definition of f in there?

 fac = product . enumFromTo 1

 --
 Ivan Lazar Miljenovic
 ivan.miljeno...@gmail.com
 IvanMiljenovic.wordpress.com
 ___
 Haskell-Cafe mailing list
 Haskell-Cafe@haskell.org
 http://www.haskell.org/mailman/listinfo/haskell-cafe

 ___
 Haskell-Cafe mailing list
 Haskell-Cafe@haskell.org
 http://www.haskell.org/mailman/listinfo/haskell-cafe
 
 


-
fac n = let {  f = foldr (*) 1 [1..n] } in f 
-- 
View this message in context: 
http://old.nabble.com/Why-is-it-so-different-between-6.12.1-and-6.10.4_1---tp28049329p28050543.html
Sent from the Haskell - Haskell-Cafe mailing list archive at Nabble.com.

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] GHC vs GCC

2010-03-27 Thread wren ng thornton

David Menendez wrote:

On Sat, Mar 27, 2010 at 12:56 AM, Thomas DuBuisson
thomas.dubuis...@gmail.com wrote:

Using bang patterns didn't help almost anything here. Using rem
instead of mod made the time go from 45s to 40s. Now, using -fvia-C
really helped (when I used rem but not using mod). It went down to
10s.

Bang patterns should have helped tons - it isn't GHC thats at fault
here and yes it does tco.  I attached a version w/ excessive bangs
below.  Did you compile with ghc --make -O3 -fforce-recomp?


Does -O3 actually do anything? GHC only goes up to -O2.


Well GHC has an -O3[1], but it's not a good idea to use it. Some of the 
optimizations that -O3 does can result in slower code for particular 
programs. Whereas -O2 is safe and never results in pessimizations.



[1] Unless recent versions have removed it.

--
Live well,
~wren
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Why is it so different between 6.12.1 and 6.10.4_1 ?

2010-03-27 Thread Ivan Lazar Miljenovic
zaxis z_a...@163.com writes:

Why do you bother with the interior definition of f in there? 
 Because i want to try a C code style not layout style without `do` syntax
 sugar .

Haskell /= C, so stop trying to code as if it is.  If you like C so
much, then use C.

-- 
Ivan Lazar Miljenovic
ivan.miljeno...@gmail.com
IvanMiljenovic.wordpress.com
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] GHC vs GCC

2010-03-27 Thread Grzegorz C

Hi,


Rafael Almeida wrote:
 
 On Fri, Mar 26, 2010 at 6:49 PM, Jason Dagit da...@codersbase.com wrote:
 Using bang patterns didn't help almost anything here. Using rem
 instead of mod made the time go from 45s to 40s. Now, using -fvia-C
 really helped (when I used rem but not using mod). It went down to
 10s.
 
 What's going on here? Doesn't ghc do tail recursion optimization?
 
I see similar surprising results here on  x86_64 Linux, GHC 6.10.4 (version
with bangs):
-fasm
real0m25.239s
user0m25.218s
sys 0m0.012s

-via-c
real0m8.699s
user0m8.641s
sys 0m0.020s

Best,
--
Grzegorz
-- 
View this message in context: 
http://old.nabble.com/GHC-vs-GCC-tp28045806p28050734.html
Sent from the Haskell - Haskell-Cafe mailing list archive at Nabble.com.

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Internet game servers in Haskell?

2010-03-27 Thread Colin Paul Adams
Has anyone ever written a server in Haskell for managing live
game-playing (any game) across the internet?
-- 
Colin Adams
Preston Lancashire
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] GHC vs GCC vs JHC

2010-03-27 Thread Neil Mitchell
Hi John,

Any chance of seeing the benchmark? You're not the only one with an
optimising compiler tucked away somewhere :-)

I have one benchmark where I outperform GHC by 21 times, although
saying it's artificial is a bit of an understatement...

Thanks, Neil

On Fri, Mar 26, 2010 at 6:27 PM, John Meacham j...@repetae.net wrote:
 Here are jhc's timings for the same programs on my machine. gcc and ghc
 both used -O3 and jhc had its full standard optimizations turned on.

 jhc:
 ./hs.out  5.12s user 0.07s system 96% cpu 5.380 total

 gcc:
 ./a.out  5.58s user 0.00s system 97% cpu 5.710 total

 ghc:
 ./try  31.11s user 0.00s system 96% cpu 32.200 total


 As you can see, jhc shines at this example, actually beating gcc -O3. It
 isn't too surprising, this is exactly the sort of haskell code that jhc
 excels at.

        John


 --
 John Meacham - ⑆repetae.net⑆john⑈ - http://notanumber.net/
 ___
 Haskell-Cafe mailing list
 Haskell-Cafe@haskell.org
 http://www.haskell.org/mailman/listinfo/haskell-cafe

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Re: Randomized N-Queens

2010-03-27 Thread Heinrich Apfelmus
Ronald Guida wrote:
 Hi,
 
 I'm trying to solve the N-queens problem, but with a catch: I want to
 generate solutions in a random order.
 
 I know how to solve the N-queens problem; my solver (below) generates all
 possible solutions.  What I am trying to do is generate solutions in a
 random order by somehow randomizing the order in which nextRow considers
 the unused columns.  I tried adding a random number generator to the
 solution state; the problem with this approach is that whenever the solver
 backtracks, the state of the random number generator backtracks along with
 it.  In effect, I am selecting a random, but fixed, permutation for each
 row, and then I am applying that same set of permutations along all
 computational paths.  Whenever I consider row R, regardless of which path I
 have taken, I am applying row R's permutation to the unused columns.
 
 This is not the behavior I want.  I want each computational path to use a
 new, different permutation for each row.  On the other hand I also want to
 be able to take the first few solutions without waiting for all possible
 solutions to be generated.  How might I go about doing this?

 [...]
 data (RandomGen g) = SolutionState g = SolutionState
 { solnBoard :: Board
 , solnUnusedColumns :: [Int]
 , solnRandomGen :: g
 }
 
 nextRow :: (RandomGen g) = Int - Int - StateT (SolutionState g) [] ()

It's a matter of choosing the right monad stack. In particular, putting
the random number generator into the solution state pretty much forces
the undesired behavior. Random numbers are best put in a separate monad
(transformer), for reasons of abstraction which are outlined here:

  http://lukepalmer.wordpress.com/2009/01/17/use-monadrandom/
  http://apfelmus.nfshost.com/articles/random-permutations.html


Also, it's not really necessary to use the state monad to store the
solution, using a plain old parameter works just fine, as the following
code illustrates:

import Control.Monad.Random  -- from the  MonadRandom  package

-- generate a random permutation
randomPerm :: MonadRandom r = [a] - r [a]
randomPerm xs = go (length xs) xs
where
go 0 [] = return []
go n xs = do
k - getRandomR (0,n-1)
let (x,xs') = select k xs
liftM (x:) $ go (n-1) xs'

select 0 (x:xs) = (x,xs)
select k (x:xs) = let (y,ys) = select (k-1) xs in (y,x:ys)

-- 8 queens
type Pos = (Int,Int)

attacks (x1,y1) (x2,y2) =
   x1 == x2
|| y1 == y2
|| x1 - x2 == y1 - y2
|| x2 - x1 == y1 - y2

type Solution = [Pos]

solve :: Rand StdGen [Solution]
solve = solve' 8 []
where
solve' 0   qs = return [qs]
solve' row qs =
liftM concat . mapM putQueen = randomPerm [1..8]
where
putQueen col
| any (q `attacks`) qs = return []
| otherwise= solve' (row-1) (q:qs)
where q = (row,col)

test seed = evalRand solve $ mkStdGen seed



Regards,
Heinrich Apfelmus

--
http://apfelmus.nfshost.com

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Why is it so different between 6.12.1 and 6.10.4_1 ?

2010-03-27 Thread zaxis

Of course, you are wrong !  C is VERY important for almost every programmer 
in the world!  Why cannot C programmer use haskell ?   And Why does haskell
support C code style ?


Ivan Miljenovic wrote:
 
 zaxis z_a...@163.com writes:
 
Why do you bother with the interior definition of f in there? 
 Because i want to try a C code style not layout style without `do` syntax
 sugar .
 
 Haskell /= C, so stop trying to code as if it is.  If you like C so
 much, then use C.
 
 -- 
 Ivan Lazar Miljenovic
 ivan.miljeno...@gmail.com
 IvanMiljenovic.wordpress.com
 ___
 Haskell-Cafe mailing list
 Haskell-Cafe@haskell.org
 http://www.haskell.org/mailman/listinfo/haskell-cafe
 
 


-
fac n = let {  f = foldr (*) 1 [1..n] } in f 
-- 
View this message in context: 
http://old.nabble.com/Why-is-it-so-different-between-6.12.1-and-6.10.4_1---tp28049329p28051693.html
Sent from the Haskell - Haskell-Cafe mailing list archive at Nabble.com.

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Why is it so different between 6.12.1 and 6.10.4_1 ?

2010-03-27 Thread Dietrich Epp

I think Miljenovic was asking about this (I removed explicit braces):

fac n = let f = foldr (*) 1 [1..n] in f

Which is strictly equivalent to:

fac n = foldr (*) 1 [1..n]

Translated into C, this is kind of like doing this:

int add(int x, int y)
{
int sum = x + y;
return sum;
}

instead of this:

int add(int x, int y)
{
return x + y;
}

I find it very cumbersome (though not *difficult*) and painful to use  
a C style of programming with Haskell, so I am not sure what you mean  
when you ask why Haskell supports C style.  Are you talking about  
mutable state, syntax, or something else?


--Dietrich

On 2010 March 27, at 4:28, zaxis wrote:



Of course, you are wrong !  C is VERY important for almost every  
programmer
in the world!  Why cannot C programmer use haskell ?   And Why does  
haskell

support C code style ?


Ivan Miljenovic wrote:


zaxis z_a...@163.com writes:


Why do you bother with the interior definition of f in there?
Because i want to try a C code style not layout style without `do`  
syntax

sugar .


Haskell /= C, so stop trying to code as if it is.  If you like C so
much, then use C.

--
Ivan Lazar Miljenovic
ivan.miljeno...@gmail.com
IvanMiljenovic.wordpress.com
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe





-
fac n = let {  f = foldr (*) 1 [1..n] } in f
--
View this message in context: 
http://old.nabble.com/Why-is-it-so-different-between-6.12.1-and-6.10.4_1---tp28049329p28051693.html
Sent from the Haskell - Haskell-Cafe mailing list archive at  
Nabble.com.


___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] GHC vs GCC

2010-03-27 Thread Jan-Willem Maessen
On Sat, Mar 27, 2010 at 12:43 AM, Rafael Almeida almeida...@gmail.comwrote:

 On Fri, Mar 26, 2010 at 6:49 PM, Jason Dagit da...@codersbase.com wrote:
 
 
  On Fri, Mar 26, 2010 at 2:33 PM, Bryan O'Sullivan b...@serpentine.com
  wrote:
 
  On Fri, Mar 26, 2010 at 10:46 AM, Rafael Cunha de Almeida
  almeida...@gmail.com wrote:
 
  During a talk with a friend I came up with two programs, one written in
  C and another in haskell.
 
  Your Haskell code builds a huge thunked accumulator value, so of course
  it's slow (put bang patterns on all arguments). Also, you should use rem
  instead of mod. Make those tiny changes and you'll get a 5x speedup, to
 half
  the performance of the C code.
 
  Interesting.  I had to add -fvia-C to get within half the performance of
 C.
  Just bang patterns and rem and I'm 1/5th of C.  I'm on a x86_64 machine.
 I
  wonder if that plays in.
 
  Jason
 

 Using bang patterns didn't help almost anything here. Using rem
 instead of mod made the time go from 45s to 40s. Now, using -fvia-C
 really helped (when I used rem but not using mod). It went down to
 10s.


It's worth pointing out that there's a bit of bang-pattern mysticism going
on in this conversation (which has not been uncommon of late!).  A non-buggy
strictness analyzer should expose the strictness of these functions without
difficulty.  If bang patterns make any difference at all with a -O flag,
either there's a strictness analysis bug, or some very interesting effects
from shifting the order of forcing of strict variables.

Putting in bang patterns is a good idea to plug the obvious space leak when
run without optimization, but isn't going to make a difference for
optimizing compilation of obviously-strict functions.

-Jan-Willem Maessen
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] GHC vs GCC

2010-03-27 Thread Pom

On 10-03-26 11:50 PM, wren ng thornton wrote:
Well GHC has an -O3[1], but it's not a good idea to use it. Some of 
the optimizations that -O3 does can result in slower code for 
particular programs. Whereas -O2 is safe and never results in 
pessimizations.




Slightly off topic, but ACOVEA may be an interesting item to see here.

http://www.coyotegulch.com/products/acovea/

Pom.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] GHC vs GCC

2010-03-27 Thread Xiao-Yong Jin
On Fri, 26 Mar 2010 21:56:16 -0700, Thomas DuBuisson wrote:

 Using bang patterns didn't help almost anything here. Using rem
 instead of mod made the time go from 45s to 40s. Now, using -fvia-C
 really helped (when I used rem but not using mod). It went down to
 10s.

 Bang patterns should have helped tons - it isn't GHC thats at fault
 here and yes it does tco.  I attached a version w/ excessive bangs
 below.  Did you compile with ghc --make -O3 -fforce-recomp?

I can verify that it is not bang patterns that helped, it is
an issue related to `mod' vs. `rem'.

mod w/o bang: 30.73s user 0.15s system 99% cpu 30.954 total
rem w/o bang: 6.52s user 0.00s system 99% cpu 6.528 total
mod w/  bang: 30.53s user 0.25s system 99% cpu 30.878 total
rem w/  bang: 6.34s user 0.00s system 99% cpu 6.359 total

Compiled with:
  ghc --make -fexcess-precision -funbox-strict-fields -O3 -Wall -optc-O3 
-optc-march=native -optl-Wl,-s -fvia-c -fforce-recomp test.hs -o test-hs

And for comparison, c version: 4.35s user 0.04s system 99% cpu 4.403 total

Linux 2.6.33-ARCH #1 SMP PREEMPT Mon Mar 15 19:11:52 CET 2010 x86_64 
GenuineIntel GNU/Linux

Best,
jxy
-- 
Jc/*__o/*
X\ * (__
Y*/\  
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Are there any female Haskellers?

2010-03-27 Thread Günther Schmidt

Hi all,

from the names of people on the list it seems that all users here are males.

Just out of curiosity are there any female users here, or are we guys 
only at the moment?


Günther


___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Testing for valid data

2010-03-27 Thread michael rice
When I'm learning a new language I like to translate old programs into the new 
language as a test of my understanding. However, many of the old programs are 
from old programming texts, many written in the time of punch-cards for batch 
processing, and many containing significant amounts of code that only tests for 
valid data. Should we still be writing programs in this fashion, or acknowledge 
the fact that better tools for pre-screening data are now available and code 
only for the problem at hand?

Michael



  ___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Are there any female Haskellers?

2010-03-27 Thread Ozgur Akgun
Why? Are you going to make dirty jokes or something :)

Nevertheless, I guess you're right. There are very few females in most of
the CS topics, and haskell is no different.
I know at least 1 (one!) female who implemented software using haskell for
her phd thesis, though.

Cheers!

2010/3/27 Günther Schmidt gue.schm...@web.de

 Hi all,

 from the names of people on the list it seems that all users here are
 males.

 Just out of curiosity are there any female users here, or are we guys only
 at the moment?

 Günther


 ___
 Haskell-Cafe mailing list
 Haskell-Cafe@haskell.org
 http://www.haskell.org/mailman/listinfo/haskell-cafe




-- 
Ozgur Akgun
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Are there any female Haskellers?

2010-03-27 Thread Daniel Fischer
-Ursprüngliche Nachricht-
Von: Günther Schmidt gue.schm...@web.de
Gesendet: 27.03.2010 16:14:57
An: haskell-cafe@haskell.org
Betreff: [Haskell-cafe] Are there any female Haskellers?

Hi all,

from the names of people on the list it seems that all users here are males.

Just out of curiosity are there any female users here, or are we guys 
only at the moment?

Günther


I'm pretty sure that Phil(l?)ip(p?)a Cowderoy is female, I've also seen a 
couple of other female names here and on the beginners list.
(Since Ashley Yakeley seems to be located in the USA, I dare not guess whether 
Ashley is a man's name or a woman's in this case.)
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Are there any female Haskellers?

2010-03-27 Thread Andrew Coppin

Ozgur Akgun wrote:
Nevertheless, I guess you're right. There are very few females in most 
of the CS topics, and haskell is no different.


This is my experience too. Although note that apparently the world's 
very first computer programmer was apparently a woman...


___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Are there any female Haskellers?

2010-03-27 Thread Mihai Maruseac
I worked with a female student on a Haskell project last summer :)
She's not into being member of a mailing list or a user group but she
exists.

On Sat, Mar 27, 2010 at 6:51 PM, Andrew Coppin
andrewcop...@btinternet.com wrote:
 Ozgur Akgun wrote:

 Nevertheless, I guess you're right. There are very few females in most of
 the CS topics, and haskell is no different.

 This is my experience too. Although note that apparently the world's very
 first computer programmer was apparently a woman...

 ___
 Haskell-Cafe mailing list
 Haskell-Cafe@haskell.org
 http://www.haskell.org/mailman/listinfo/haskell-cafe

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] chp-plus doesn't install

2010-03-27 Thread Colin Paul Adams
I'm getting these errors (ghc 6.10.4 on Linux x86_64):

Building chp-plus-1.1.0...
[1 of 9] Compiling Control.Concurrent.CHP.Test ( 
Control/Concurrent/CHP/Test.hs, dist/build/Control/Concurrent/CHP/Test.o )
[2 of 9] Compiling Control.Concurrent.CHP.Console ( 
Control/Concurrent/CHP/Console.hs, dist/build/Control/Concurrent/CHP/Console.o )
[3 of 9] Compiling Control.Concurrent.CHP.Connect ( 
Control/Concurrent/CHP/Connect.hs, dist/build/Control/Concurrent/CHP/Connect.o )

Control/Concurrent/CHP/Connect.hs:146:67:
Couldn't match expected type `ChanOpts a'
   against inferred type `ConnectableParam (Chanout a)'
In the first argument of `oneToOneChannel'', namely `o'
In the second argument of `($)', namely `oneToOneChannel' o'
In the first argument of `(=)', namely
`((writer  reader) $ oneToOneChannel' o)'

Control/Concurrent/CHP/Connect.hs:152:67:
Couldn't match expected type `ChanOpts a'
   against inferred type `ConnectableParam (Chanin a)'
In the first argument of `oneToOneChannel'', namely `o'
In the second argument of `($)', namely `oneToOneChannel' o'
In the first argument of `(=)', namely
`((reader  writer) $ oneToOneChannel' o)'

etc.
-- 
Colin Adams
Preston Lancashire
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Are there any female Haskellers?

2010-03-27 Thread James Russell
Maybe not on the list, but there certainly are in academia.
I can think of several off the top of my head.

2010/3/27 Günther Schmidt gue.schm...@web.de:
 Hi all,

 from the names of people on the list it seems that all users here are males.

 Just out of curiosity are there any female users here, or are we guys only
 at the moment?

 Günther


 ___
 Haskell-Cafe mailing list
 Haskell-Cafe@haskell.org
 http://www.haskell.org/mailman/listinfo/haskell-cafe

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] chp-plus doesn't install

2010-03-27 Thread Neil Brown

Colin Paul Adams wrote:

I'm getting these errors (ghc 6.10.4 on Linux x86_64):

Building chp-plus-1.1.0...
[1 of 9] Compiling Control.Concurrent.CHP.Test ( 
Control/Concurrent/CHP/Test.hs, dist/build/Control/Concurrent/CHP/Test.o )
[2 of 9] Compiling Control.Concurrent.CHP.Console ( 
Control/Concurrent/CHP/Console.hs, dist/build/Control/Concurrent/CHP/Console.o )
[3 of 9] Compiling Control.Concurrent.CHP.Connect ( 
Control/Concurrent/CHP/Connect.hs, dist/build/Control/Concurrent/CHP/Connect.o )

Control/Concurrent/CHP/Connect.hs:146:67:
Couldn't match expected type `ChanOpts a'
   against inferred type `ConnectableParam (Chanout a)'
In the first argument of `oneToOneChannel'', namely `o'
In the second argument of `($)', namely `oneToOneChannel' o'
In the first argument of `(=)', namely
`((writer  reader) $ oneToOneChannel' o)'
  
I don't immediately have a GHC 6.10.4 machine to hand, but that is an 
odd error.  Here is the code in question:


instance ConnectableExtra (Chanout a) (Chanin a) where
 type ConnectableParam (Chanout a) = ChanOpts a
 connectExtra o = (=) ((writer  reader) $ oneToOneChannel' o)

(based on the class:

class ConnectableExtra l r where
 type ConnectableParam l
 connectExtra :: ConnectableParam l - ((l, r) - CHP ()) - CHP ()
)

So I don't see why there is a type mismatch; ConnectableParam (Chanout 
a) is ChanOpts a.  I don't know if it's somehow confused by the recently 
added similar instance:


instance ConnectableExtra (Chanout a) (Shared Chanin a) where
 type ConnectableParam (Chanout a) = ChanOpts a
 connectExtra o = (=) ((writer  reader) $ oneToAnyChannel' o)

There's no conflict between the two instances, though.  I wonder if 
making ConnectableParam depend on l and r would fix it.  I'll look 
further into this when I get onto a 6.10.4 machine.


Thanks,

Neil.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] GHC vs GCC

2010-03-27 Thread Tillmann Rendel

Jan-Willem Maessen wrote:
It's worth pointing out that there's a bit of bang-pattern mysticism 
going on in this conversation (which has not been uncommon of late!).  A 
non-buggy strictness analyzer should expose the strictness of these 
functions without difficulty.  


Could the result of strictness analysis reported in terms of the 
original Haskell program?


   ghc -O2 -ddump-strictness test.hs

  test.hs:3:1:
  Top-level function `foo' is found to be strict in the
  first and third argument.

This could help people gain confidence in the strictness analyzer.

  Tillmann
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Are there any female Haskellers?

2010-03-27 Thread Jason Dagit
On Sat, Mar 27, 2010 at 9:05 AM, Daniel Fischer daniel.is.fisc...@web.dewrote:

 -Ursprüngliche Nachricht-
 Von: Günther Schmidt gue.schm...@web.de
 Gesendet: 27.03.2010 16:14:57
 An: haskell-cafe@haskell.org
 Betreff: [Haskell-cafe] Are there any female Haskellers?

 Hi all,
 
 from the names of people on the list it seems that all users here are
 males.
 
 Just out of curiosity are there any female users here, or are we guys
 only at the moment?
 
 Günther
 

 I'm pretty sure that Phil(l?)ip(p?)a Cowderoy is female, I've also seen a
 couple of other female names here and on the beginners list.
 (Since Ashley Yakeley seems to be located in the USA, I dare not guess
 whether Ashley is a man's name or a woman's in this case.)


Ashley Yakeley is a man.

I work with several female Haskellers.  And I've met several others who are
at universities or use Haskell on the side.

In general, I'd say women in computer science are a minority.  I would say
mathematics has a higher percentage of women than computer science from my
own anecdotal experience.  Why are there so few women in computer science?
 I don't know but it's an interesting question.  One professor I was talking
to about this subject said he felt that at his university when CS was a part
of math there were more women and when it became part of engineering the
percentage of women dropped.

It's possible that there are gender differences that cause men to be
attracted to this field more frequently than women.  I'm hesitant to say
that's the underlying reason though.  I suspect the following, based on
conversations I've had with women in the field.  For some reason it started
out as a male dominated field.  Let's assume for cultural reasons.  Once it
became a male dominated field, us males unknowingly made the work and
learning environments somewhat hostile or unattractive to women.  I bet I
would feel out of place if I were the only male in a class of 100 women.

Anyway, those are just observations I've made.  Don't take any of it too
seriously and I certainly don't mean to offend anyone.  I know gender
differences can be quite controversial at times.

Jason
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Are there any female Haskellers?

2010-03-27 Thread Alberto G. Corona
To say this in scientific headline jargon, It´s a matter of division of
work, time, and dimorphic fixation of abilities in the brain by natural
selection trough dimorphic development of the brain of men and women by
different genetic sequences. I don´t know any kind of tool more flexible and
powerful than a computer language. Men are good at making tools and using
them. They invested more in engineering because this activity were more
critical for their success than in the case of women. Sociological or
cultural explanations don´t explain the universal tendencies and habilities
across cultures and time.

 The reasons for the sexual differences in mathematical abilities are
different, because math abilities  are not a -primary- reason for survival.
 Tools engineering and mastering is. If this is politically incorrect I beg
you pardon, but this is my honest theory about that. My other hobby is
evolution and evolutionary psichology.  I really recommend to learn about
it.

Hope that this cold answer don't end this funny thread ;(

Best wishes
  Alberto
2010/3/27 Jason Dagit da...@codersbase.com



 On Sat, Mar 27, 2010 at 9:05 AM, Daniel Fischer 
 daniel.is.fisc...@web.dewrote:

 -Ursprüngliche Nachricht-
 Von: Günther Schmidt gue.schm...@web.de
 Gesendet: 27.03.2010 16:14:57
 An: haskell-cafe@haskell.org
 Betreff: [Haskell-cafe] Are there any female Haskellers?

 Hi all,
 
 from the names of people on the list it seems that all users here are
 males.
 
 Just out of curiosity are there any female users here, or are we guys
 only at the moment?
 
 Günther
 

 I'm pretty sure that Phil(l?)ip(p?)a Cowderoy is female, I've also seen a
 couple of other female names here and on the beginners list.
 (Since Ashley Yakeley seems to be located in the USA, I dare not guess
 whether Ashley is a man's name or a woman's in this case.)


 Ashley Yakeley is a man.

 I work with several female Haskellers.  And I've met several others who are
 at universities or use Haskell on the side.

 In general, I'd say women in computer science are a minority.  I would say
 mathematics has a higher percentage of women than computer science from my
 own anecdotal experience.  Why are there so few women in computer science?
  I don't know but it's an interesting question.  One professor I was talking
 to about this subject said he felt that at his university when CS was a part
 of math there were more women and when it became part of engineering the
 percentage of women dropped.

 It's possible that there are gender differences that cause men to be
 attracted to this field more frequently than women.  I'm hesitant to say
 that's the underlying reason though.  I suspect the following, based on
 conversations I've had with women in the field.  For some reason it started
 out as a male dominated field.  Let's assume for cultural reasons.  Once it
 became a male dominated field, us males unknowingly made the work and
 learning environments somewhat hostile or unattractive to women.  I bet I
 would feel out of place if I were the only male in a class of 100 women.

 Anyway, those are just observations I've made.  Don't take any of it too
 seriously and I certainly don't mean to offend anyone.  I know gender
 differences can be quite controversial at times.

 Jason

 ___
 Haskell-Cafe mailing list
 Haskell-Cafe@haskell.org
 http://www.haskell.org/mailman/listinfo/haskell-cafe


___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] GHC vs GCC

2010-03-27 Thread David Menendez
On Sat, Mar 27, 2010 at 1:45 PM, Tillmann Rendel
ren...@mathematik.uni-marburg.de wrote:
 Jan-Willem Maessen wrote:

 It's worth pointing out that there's a bit of bang-pattern mysticism going
 on in this conversation (which has not been uncommon of late!).  A non-buggy
 strictness analyzer should expose the strictness of these functions without
 difficulty.

 Could the result of strictness analysis reported in terms of the original
 Haskell program?

That would be nice. Even if you're willing to read core, I'm not aware
that the output of -ddump-stranal is explained anywhere.

Incidentally, the results of -ddump-simpl when running on -O2 say that
GHC has unboxed every argument except the first argument to rangeJ.

-- 
Dave Menendez d...@zednenem.com
http://www.eyrie.org/~zednenem/
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Re: Are there any female Haskellers?

2010-03-27 Thread Gracjan Polak
Alberto G. Corona  agocorona at gmail.com writes:
 
 Hope that this cold answer don't end this funny thread ;(
 

Those concerned with Haskellers to Haskellinas ration can always employ this
technique:

http://www.newton.dep.anl.gov/askasci/bio99/bio99128.htm

Any volunteers? :)

-- 
Gracjan



___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Are there any female Haskellers?

2010-03-27 Thread John Van Enk
http://en.wikipedia.org/wiki/Grace_Hopper

http://en.wikipedia.org/wiki/Grace_HopperA heck of a lady.

On Sat, Mar 27, 2010 at 12:51 PM, Andrew Coppin andrewcop...@btinternet.com
 wrote:

 Ozgur Akgun wrote:

 Nevertheless, I guess you're right. There are very few females in most of
 the CS topics, and haskell is no different.


 This is my experience too. Although note that apparently the world's very
 first computer programmer was apparently a woman...


 ___
 Haskell-Cafe mailing list
 Haskell-Cafe@haskell.org
 http://www.haskell.org/mailman/listinfo/haskell-cafe

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Are there any female Haskellers?

2010-03-27 Thread Jason Dusek
2010/03/27 Alberto G. Corona agocor...@gmail.com:
 To say this in scientific headline jargon, it's a matter of
 division of work, time, and dimorphic fixation of abilities in
 the brain by natural selection trough dimorphic development of
 the brain of men and women by different genetic sequences. I
 don't know any kind of tool more flexible and powerful than a
 computer language. Men are good at making tools and using
 them. They invested more in engineering because this activity
 were more critical for their success than in the case of
 women. Sociological or cultural explanations don't explain the
 universal tendencies and habilities across cultures and time.

  In this passage, you seem to attribute to men a relatively
  great adaptation for making  using tools, relative to women.
  You suggest this applies to computer languages -- excellent
  tools -- and this explains the relative absence of women in
  computing.

  It's hard to take your remarks seriously; consider:

 .  There is no single adaptation for tool using. Men differ
greatly in their aptitude for working with different kinds
of tools.

 .  The relevance of tools in women's lives is well known; there
are few cultures that have not allocated some essential
domain of work -- fabric arts, tanning, cooking, picking
certain plants -- to women. It's hard to see any support for
the notion that tools are more (or less) critical for the
evolutionary success of men.

  Though this may be your honest theory, you don't offer much
  support for it. When offering a theory as to the relative
  success of one movie over another, I suppose there is not a
  great burden of proof; but carelessness in the matter of which
  kind of person can do which kind of work has hurt too many
  people for too long.

--
Jason Dusek
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Why is it so different between 6.12.1 and 6.10.4_1 ?

2010-03-27 Thread Yusaku Hashimoto
Hmm, When a ghci was started, there should be the only loaded module
(Prelude.) And in both 6.10 and 6.12, such instance is not defined or
exported in its Prelude. So please try `ghci -ignore-dot-ghci`. It
invokes ghci without reading ~/.ghci and ./.ghci.

And `((-) a)` is known as the Reader Monad, `a` can be regarded as
the environment. My typical usage of that is like following:

import Control.Monad

data Vec = Vec { x :: Int, y :: Int }
absolute :: Vec - Double
absolute = sqrt . fromIntegral . liftM2 (+) (square . x) (square . y)
  where
square a = a * a

The definition of `absolute` above can be rewritten as

absolute p = sqrt . fromIntegral $ square (x p) + square (y p)
  where
square a = a * a

How `square . x` and `square . y` share the argument? Because `Monad
((-) a)` is defined as

instance Monad ((-) a) where
return x = \a - x
m = f = \a - f (m a) a

Note `(=)` propagates `a` into both of its arguments. That's why the
functions read same argument.

HTH
-nwn

On Sat, Mar 27, 2010 at 3:31 PM, zaxis z_a...@163.com wrote:

 I just start ghci from shell and do nothing else. In fact, i really donot
 know `Monad ((-) a) ` . Would you mind expplain it ?


 Yusaku Hashimoto wrote:

 Did you import the module includes the instance of Monad ((-) e)
 somewhere in your code loaded in ghci?

 I tried this on a fresh ghci 6.12, but I got No instance error.

 -nwn

 On Sat, Mar 27, 2010 at 9:20 AM, zaxis z_a...@163.com wrote:

 In 6.12.1 under archlinux
let f x y z = x + y + z
 :t f
 f :: (Num a) = a - a - a - a

 :t (=) . f
 (=) . f :: (Num a) = a - ((a - a) - a - b) - a - b
 ((=) . f) 1 (\f x - f x) 2
 5

 In 6.10.4_1 under freebsd
 let f x y z = x + y + z
 *Money :t f
 f :: (Num a) = a - a - a - a

 :t (=) . f
 (=) . f  :: (Monad ((-) a), Num a) = a - ((a - a) - a - b) - a
 - b
 ((=) . f) 1 (\f x - f x) 2

 interactive:1:1:
    No instance for (Monad ((-) a))
      arising from a use of `=' at interactive:1:1-5
    Possible fix: add an instance declaration for (Monad ((-) a))
    In the first argument of `(.)', namely `(=)'
    In the expression: ((=) . f) 1 (\ f x - f x) 2
    In the definition of `it': it = ((=) . f) 1 (\ f x - f x) 2

 Sincerely!


 -
 fac n = let {  f = foldr (*) 1 [1..n] } in f
 --
 View this message in context:
 http://old.nabble.com/Why-is-it-so-different-between-6.12.1-and-6.10.4_1---tp28049329p28049329.html
 Sent from the Haskell - Haskell-Cafe mailing list archive at Nabble.com.

 ___
 Haskell-Cafe mailing list
 Haskell-Cafe@haskell.org
 http://www.haskell.org/mailman/listinfo/haskell-cafe

 ___
 Haskell-Cafe mailing list
 Haskell-Cafe@haskell.org
 http://www.haskell.org/mailman/listinfo/haskell-cafe




 -
 fac n = let {  f = foldr (*) 1 [1..n] } in f
 --
 View this message in context: 
 http://old.nabble.com/Why-is-it-so-different-between-6.12.1-and-6.10.4_1---tp28049329p28050535.html
 Sent from the Haskell - Haskell-Cafe mailing list archive at Nabble.com.

 ___
 Haskell-Cafe mailing list
 Haskell-Cafe@haskell.org
 http://www.haskell.org/mailman/listinfo/haskell-cafe

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Are there any female Haskellers?

2010-03-27 Thread Peter Verswyvelen
So the first computer nerd was a women??!!! ;-) ;-) ;-)

On Sat, Mar 27, 2010 at 9:06 PM, John Van Enk vane...@gmail.com wrote:
 http://en.wikipedia.org/wiki/Grace_Hopper
 A heck of a lady.

 On Sat, Mar 27, 2010 at 12:51 PM, Andrew Coppin
 andrewcop...@btinternet.com wrote:

 Ozgur Akgun wrote:

 Nevertheless, I guess you're right. There are very few females in most of
 the CS topics, and haskell is no different.

 This is my experience too. Although note that apparently the world's very
 first computer programmer was apparently a woman...

 ___
 Haskell-Cafe mailing list
 Haskell-Cafe@haskell.org
 http://www.haskell.org/mailman/listinfo/haskell-cafe


 ___
 Haskell-Cafe mailing list
 Haskell-Cafe@haskell.org
 http://www.haskell.org/mailman/listinfo/haskell-cafe


___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Are there any female Haskellers?

2010-03-27 Thread Luke Palmer
On Sat, Mar 27, 2010 at 2:22 PM, Peter Verswyvelen bugf...@gmail.com wrote:
 So the first computer nerd was a women??!!! ;-) ;-) ;-)

Yeah, and she was so attractive that the entire male gender spent the
next 50 years trying to impress her.

Luke

 On Sat, Mar 27, 2010 at 9:06 PM, John Van Enk vane...@gmail.com wrote:
 http://en.wikipedia.org/wiki/Grace_Hopper
 A heck of a lady.

 On Sat, Mar 27, 2010 at 12:51 PM, Andrew Coppin
 andrewcop...@btinternet.com wrote:

 Ozgur Akgun wrote:

 Nevertheless, I guess you're right. There are very few females in most of
 the CS topics, and haskell is no different.

 This is my experience too. Although note that apparently the world's very
 first computer programmer was apparently a woman...

 ___
 Haskell-Cafe mailing list
 Haskell-Cafe@haskell.org
 http://www.haskell.org/mailman/listinfo/haskell-cafe


 ___
 Haskell-Cafe mailing list
 Haskell-Cafe@haskell.org
 http://www.haskell.org/mailman/listinfo/haskell-cafe


 ___
 Haskell-Cafe mailing list
 Haskell-Cafe@haskell.org
 http://www.haskell.org/mailman/listinfo/haskell-cafe

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Are there any female Haskellers?

2010-03-27 Thread Alberto G. Corona
2010/3/27 Jason Dusek jason.du...@gmail.com

 2010/03/27 Alberto G. Corona agocor...@gmail.com:
  To say this in scientific headline jargon, it's a matter of
  division of work, time, and dimorphic fixation of abilities in
  the brain by natural selection trough dimorphic development of
  the brain of men and women by different genetic sequences. I
  don't know any kind of tool more flexible and powerful than a
  computer language. Men are good at making tools and using
  them. They invested more in engineering because this activity
  were more critical for their success than in the case of
  women. Sociological or cultural explanations don't explain the
  universal tendencies and habilities across cultures and time.

   In this passage, you seem to attribute to men a relatively
  great adaptation for making  using tools, relative to women.
  You suggest this applies to computer languages -- excellent
  tools -- and this explains the relative absence of women in
  computing.

  It's hard to take your remarks seriously; consider:

  .  There is no single adaptation for tool using. Men differ
greatly in their aptitude for working with different kinds
of tools.

The adaptation consist in the plasure for using such tools, to harness his
power to play with them that is, to invest in them. The mean male play an
appreciate new tools more than women. that is universal.  Additionally it is
clear that some mathematical abilities in which men are better are related
with the use of tools. The fact that men and woman have different abilities
and tendencies that match these abilities is beyond doubt. Cerebral scanners
shows that even there are large differences in which are of the brain is
used for each purpose in men and women. That does not ban anyone to do
whatever they please.



 .  The relevance of tools in women's lives is well known; there
are few cultures that have not allocated some essential
domain of work -- fabric arts, tanning, cooking, picking
certain plants -- to women. It's hard to see any support for
the notion that tools are more (or less) critical for the
evolutionary success of men.

  yes. but these tools are not the object of their pleasure. they just use
them for a purpose.

 Though this may be your honest theory, you don't offer much
  support for it. When offering a theory as to the relative
  success of one movie over another, I suppose there is not a
  great burden of proof; but carelessness in the matter of which
  kind of person can do which kind of work has hurt too many
  people for too long.

 This is off topic. and i can not write extensively about that here but is
just a consequence of the application of evolution to the human
speciehttp://en.wikipedia.org/wiki/Evolutionary_psychology.
Here you can find some answer to your objections. I strongly disagree with
your point. Science is made of theories. If we can even discuss them then we
are in the middle age of the politically correct empire, in a civilization
that has decide to stop thinking, that regret his achievements and that only
look back to find excuses to ate deeper himself.

 --
 Jason Dusek

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Are there any female Haskellers?

2010-03-27 Thread John Meacham
My friend named her cat Haskell after the language :)

John

-- 
John Meacham - ⑆repetae.net⑆john⑈ - http://notanumber.net/
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Testing for valid data

2010-03-27 Thread Ketil Malde
michael rice nowg...@yahoo.com writes:

 When I'm learning a new language I like to translate old programs into
 the new language as a test of my understanding. However, many of the
 old programs are from old programming texts, many written in the time
 of punch-cards for batch processing, and many containing significant
 amounts of code that only tests for valid data. Should we still be
 writing programs in this fashion, or acknowledge the fact that better
 tools for pre-screening data are now available and code only for the
 problem at hand? 

Hm - I remember test suites in a dynamically typed program with test
case upon test case checking that functions expecting integers would
throw an exception when given a string, and so on. Doesn't seem that
long ago either..

I think the whole -- well, no, but half, maybe -- point of Haskell is
that the static type system proves data validity throughout the
program.  And half the trick of writing correct programs is to design
your data types to constrain the possible values to valid ones.

-k
-- 
If I haven't seen further, it is by standing in the footprints of giants
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Are there any female Haskellers?

2010-03-27 Thread Vitali Xevet
I bet there are some people here who think women are very idiot to be
knowledgeable about haskell.

Cheers
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Re: Are there any female Haskellers?

2010-03-27 Thread Günther Schmidt

Hi guys (and I mean it),

so, in short, no female haskellers ...

Bare one which sent me an email directly, but it looks like she's not 
ready to come out of the closet yet.


Günther







___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Are there any female Haskellers?

2010-03-27 Thread Neil Davies
If you are looking for a real first - http://en.wikipedia.org/wiki/Ada_Lovelace 
 - she is even credited with writing the first algorithm for machine  
execution.



On 27 Mar 2010, at 20:06, John Van Enk wrote:


http://en.wikipedia.org/wiki/Grace_Hopper

A heck of a lady.

On Sat, Mar 27, 2010 at 12:51 PM, Andrew Coppin andrewcop...@btinternet.com 
 wrote:

Ozgur Akgun wrote:
Nevertheless, I guess you're right. There are very few females in  
most of the CS topics, and haskell is no different.


This is my experience too. Although note that apparently the world's  
very first computer programmer was apparently a woman...



___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Testing for valid data

2010-03-27 Thread michael rice
Hi Ketil,

Good point, but I think it side-steps the question. Haskell coughs on a data 
value. Do we grep our data, finding and fixing the offender, or build extensive 
data tests into our application code?

Michael

--- On Sat, 3/27/10, Ketil Malde ke...@malde.org wrote:

From: Ketil Malde ke...@malde.org
Subject: Re: [Haskell-cafe] Testing for valid data
To: haskell-cafe@haskell.org
Date: Saturday, March 27, 2010, 5:20 PM

michael rice nowg...@yahoo.com writes:

 When I'm learning a new language I like to translate old programs into
 the new language as a test of my understanding. However, many of the
 old programs are from old programming texts, many written in the time
 of punch-cards for batch processing, and many containing significant
 amounts of code that only tests for valid data. Should we still be
 writing programs in this fashion, or acknowledge the fact that better
 tools for pre-screening data are now available and code only for the
 problem at hand? 

Hm - I remember test suites in a dynamically typed program with test
case upon test case checking that functions expecting integers would
throw an exception when given a string, and so on. Doesn't seem that
long ago either..

I think the whole -- well, no, but half, maybe -- point of Haskell is
that the static type system proves data validity throughout the
program.  And half the trick of writing correct programs is to design
your data types to constrain the possible values to valid ones.

-k
-- 
If I haven't seen further, it is by standing in the footprints of giants
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe



  ___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Are there any female Haskellers?

2010-03-27 Thread wren ng thornton

Alberto G. Corona wrote:

because math abilities  are not a -primary- reason for survival.
 Tools engineering and mastering is.


I don't see the difference. Being able to use a lever, wheel, pulley, 
fire,... is obviously helpful for survival. But intellectual tools 
like mathematics, logic, and computer science don't bear any particular 
relation to physical tools. If someone's adept at using hammers, 
pliers,... there's no reason to suspect that they'd be adept with 
reasoning puzzles. And just because someone's good at category theory is 
no reason to suspect they'd be able to repair a car.


Do not be misled by the fact that CS departments are often lumped in 
with engineering. For that matter, do not be misled by modern 
engineering which bears little resemblance to any tool-using 
evolutionary advantage that may have molded homo sapiens.


--
Live well,
~wren
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Are there any female Haskellers?

2010-03-27 Thread wren ng thornton

wren ng thornton wrote:

Alberto G. Corona wrote:

because math abilities  are not a -primary- reason for survival.
 Tools engineering and mastering is.


I don't see the difference. 


(That is, the difference between CS and mathematics. Conversely, I don't 
see the similarity between physical tools and intellectual tools.)


Being able to use a lever, wheel, pulley, 
fire,... is obviously helpful for survival. But intellectual tools 
like mathematics, logic, and computer science don't bear any particular 
relation to physical tools. If someone's adept at using hammers, 
pliers,... there's no reason to suspect that they'd be adept with 
reasoning puzzles. And just because someone's good at category theory is 
no reason to suspect they'd be able to repair a car.


Do not be misled by the fact that CS departments are often lumped in 
with engineering. For that matter, do not be misled by modern 
engineering which bears little resemblance to any tool-using 
evolutionary advantage that may have molded homo sapiens.


--
Live well,
~wren
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Are there any female Haskellers?

2010-03-27 Thread Leon Smith
On Sat, Mar 27, 2010 at 1:56 PM, Jason Dagit da...@codersbase.com wrote:
 For some reason it started out as a male dominated field.  Let's assume
 for cultural reasons.  Once it became a male dominated field, us males
 unknowingly made the work and learning environments somewhat hostile
 or unattractive to women.  I bet I would feel out of place if I were the only
 male in a class of 100 women.

Is this really true?  I've heard rumors that in the early days of
programming, that women were in the majority,  or at least they
represented a much greater proportion of programmers than they do now.
  I seem to recall that this started to change sometime in the 60s.
Of course,  I can't recall when or where I heard these stories,   and
I'm not sure that my source was reliable,   so I might be completely
off on this count.

Best,
Leon
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] GHC vs GCC vs JHC

2010-03-27 Thread Jason Dagit
On Sat, Mar 27, 2010 at 3:25 AM, Neil Mitchell ndmitch...@gmail.com wrote:

 Hi John,

 Any chance of seeing the benchmark? You're not the only one with an
 optimising compiler tucked away somewhere :-)


Neil, for some reason John's reply didn't thread with the rest of the
thread.  Probably because he changed the subject.  He was referring to this
thread:
http://www.haskell.org/pipermail/haskell-cafe/2010-March/075151.html

Jason
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Are there any female Haskellers?

2010-03-27 Thread Sean Leather
On Sat, Mar 27, 2010 at 23:09, Leon Smith wrote:

 I've heard rumors that in the early days of
 programming, that women were in the majority,  or at least they
 represented a much greater proportion of programmers than they do now.


They're not just rumors:
http://www.witi.com/center/witimuseum/halloffame/1997/eniac.php

Sean
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] GHC vs GCC vs JHC

2010-03-27 Thread Rafael Cunha de Almeida
John Meacham wrote:
 Here are jhc's timings for the same programs on my machine. gcc and ghc
 both used -O3 and jhc had its full standard optimizations turned on.
 
 jhc:
 ./hs.out  5.12s user 0.07s system 96% cpu 5.380 total
 
 gcc:
 ./a.out  5.58s user 0.00s system 97% cpu 5.710 total
 
 ghc:
 ./try  31.11s user 0.00s system 96% cpu 32.200 total
 
 
 As you can see, jhc shines at this example, actually beating gcc -O3. It
 isn't too surprising, this is exactly the sort of haskell code that jhc
 excels at.

What's the property of that code which makes jhc excels in it? What
makes ghc perform so poorly in comparison?
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] GHC vs GCC vs JHC

2010-03-27 Thread Lennart Augustsson
It's important to switch from mod to rem.  This can be done by a
simple abstract interpretation.
I'm nore sure if it's jhc or gcc that does this for jhc.

  -- Lennart

On Sat, Mar 27, 2010 at 10:30 PM, Rafael Cunha de Almeida
almeida...@gmail.com wrote:
 John Meacham wrote:
 Here are jhc's timings for the same programs on my machine. gcc and ghc
 both used -O3 and jhc had its full standard optimizations turned on.

 jhc:
 ./hs.out  5.12s user 0.07s system 96% cpu 5.380 total

 gcc:
 ./a.out  5.58s user 0.00s system 97% cpu 5.710 total

 ghc:
 ./try  31.11s user 0.00s system 96% cpu 32.200 total


 As you can see, jhc shines at this example, actually beating gcc -O3. It
 isn't too surprising, this is exactly the sort of haskell code that jhc
 excels at.

 What's the property of that code which makes jhc excels in it? What
 makes ghc perform so poorly in comparison?
 ___
 Haskell-Cafe mailing list
 Haskell-Cafe@haskell.org
 http://www.haskell.org/mailman/listinfo/haskell-cafe

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Are there any female Haskellers?

2010-03-27 Thread Jason Dusek
2010/03/27 Leon Smith leon.p.sm...@gmail.com:
 I've heard rumors that in the early days of programming, that
 women were in the majority, or at least they represented a
 much greater proportion of programmers than they do now. I
 seem to recall that this started to change sometime in the
 60s. Of course, I can't recall when or where I heard these
 stories, and I'm not sure that my source was reliable, so I
 might be completely off on this count.

  Women have been computers for a long time but they were not
  generally the majority or even very well represented.

http://www.thenewatlantis.com/publications/the-age-of-female-computers

  In the Second World War, however, this changed; many, many
  women were brought into the computer corps and the first six
  programmers of the ENIAC, all women, were drawn from that
  corps.

http://en.wikipedia.org/wiki/Human_computer

  So it may have happened that women started out as the majority
  of programmers and maintained that role for awhile; but as
  computing evolved more men came to desire the position. Of
  course, all the bosses were still men; they might prefer to
  hire other men. Coupled with conservative attitudes about
  women at work, programming would've become more and more
  hostile for women and maybe they were motivated to leave.

  A friend of mine, an engineer now in San Francisco, used to
  work in defense in Australia. The defense industry there is
  apparently as conservative as it is in the United States.
  There were alot of people around who felt that women needn't
  be in the work place or have jobs like mechatronic engineer.
  She was greatly motivated to leave. In the forties, where
  would she have gone?

--
Jason Dusek
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] GHC vs GCC vs JHC

2010-03-27 Thread Rafael Cunha de Almeida
Lennart Augustsson wrote:
 It's important to switch from mod to rem.  This can be done by a
 simple abstract interpretation.
 I'm nore sure if it's jhc or gcc that does this for jhc.
 

It's not just adding rem. Ghc still runs much slower using rem. It's
only when switching to -fvia-C and using rem that ghc gets close to gcc
speed (even though, still slower). Now jhc seems to get it fast right
away. What's going on here? Is ghc backend wrose than using gcc as a
backend (which is what via-C seems to accomplish)? Are there cases when
one way is preferred over the other? What are the tradeoffs here?
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Re: Why is it so different between 6.12.1 and 6.10.4_1 ?

2010-03-27 Thread Maciej Piechotka
On Sat, 2010-03-27 at 04:28 -0700, zaxis wrote:
 Of course, you are wrong !  C is VERY important for almost every programmer 
 in the world!


Hmm. We don't deny that C is important. However importance of hammer
does not make screwdriver unimportant.

While you can say that you can use screwdriver like a hammer (like you
can use Haskell to do imperative programming or vice versa) it is
usually terribly inefficient and/or inelegant.

  Why cannot C programmer use haskell ?

(S)He can. However (s)he have to redefine him/herself from being C
programmer. As real programmer can program in Fortran in any language
you can program in any language in Haskell. You just shouldn't (as you
shouldn't program in X in Y for nearly any X != Y). 

  And Why does haskell
 support C code style ?
 


And BTW. Haskell have no 'C' style. You probably refer to do syntax
sugar which is:
- Not really C-style. It have syntax nowhere like C
- Only partially in traditional imperative style as it do distinguish
still between pure and unpure computation
- It can be use for much more then crude C


signature.asc
Description: This is a digitally signed message part
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Are there any female Haskellers?

2010-03-27 Thread Christopher Lane Hinson


Many of you may be interested in reading the Geek Feminism blog and wiki:

http://geekfeminism.wikia.com/wiki/Geek_Feminism_Wiki
http://geekfeminism.org/

It's not necessary to agree with everything, or to debate it, just try to put 
yourself in someone else's shoes.


Friendly,
--Lane


___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] GHC vs GCC vs JHC

2010-03-27 Thread John Meacham
On Sat, Mar 27, 2010 at 07:30:30PM -0300, Rafael Cunha de Almeida wrote:
 John Meacham wrote:
  Here are jhc's timings for the same programs on my machine. gcc and ghc
  both used -O3 and jhc had its full standard optimizations turned on.
  
  jhc:
  ./hs.out  5.12s user 0.07s system 96% cpu 5.380 total
  
  gcc:
  ./a.out  5.58s user 0.00s system 97% cpu 5.710 total
  
  ghc:
  ./try  31.11s user 0.00s system 96% cpu 32.200 total
  
  
  As you can see, jhc shines at this example, actually beating gcc -O3. It
  isn't too surprising, this is exactly the sort of haskell code that jhc
  excels at.

I have not thoroughly checked it, but I think there are a couple things
going on here:

jhc is able to determine that all the arguments to the various functions
are strict, so it can avoid all heap allocations and evaluations. ghc
also benefits from this optimization.

jhc sees that all the functions are fully applied to all their
arguments, this means that they can always be directly called with
optimized calling conventions as they will never have to represent
generic 'eval' thunks or partial applications.

it sees that all the functions are local to 'main' and not exported, so
it can actually translate them to local functions in main in grin,
allowing some more useful optimizations.

Now the most important one, after optimizing the local functions, jhc
sees that they are only called in tail-call position, so jhc is able to
turn the function calls into direct jumps, turning them
directly into C while/for loops operating fully on automatic variables
on the stack.

These last two optimizations are enabled by an incredibly useful
extension to boquist's GRIN which is to allow a form of local function
definitions, which solve a number of issues raised in his paper. Via a
series of Grin-Grin transformations I am able to turn these local
funciton definitions into direct conditional jumps in the resulting
code. (which translate to looping constructs, if's and goto's in C)

John


-- 
John Meacham - ⑆repetae.net⑆john⑈ - http://notanumber.net/
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] GHC vs GCC

2010-03-27 Thread Roman Leshchinskiy
On 28/03/2010, at 01:36, Jan-Willem Maessen wrote:

 It's worth pointing out that there's a bit of bang-pattern mysticism going on 
 in this conversation (which has not been uncommon of late!).  A non-buggy 
 strictness analyzer should expose the strictness of these functions without 
 difficulty.

Actually, rangeJ is lazy in i and rangeK is lazy in i and j. GHC does unbox 
everything important here but that needs more optimisations than just 
strictness analysis. You are right, though, that GHC doesn't need bang patterns 
here.

Roman


___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] GHC vs GCC vs JHC

2010-03-27 Thread Roman Leshchinskiy
On 27/03/2010, at 05:27, John Meacham wrote:

 Here are jhc's timings for the same programs on my machine. gcc and ghc
 both used -O3 and jhc had its full standard optimizations turned on.
 
 jhc:
 ./hs.out  5.12s user 0.07s system 96% cpu 5.380 total
 
 gcc:
 ./a.out  5.58s user 0.00s system 97% cpu 5.710 total
 
 ghc:
 ./try  31.11s user 0.00s system 96% cpu 32.200 total

I really don't understand these GHC numbers. I get about 3s for the C version, 
about 5s for GHC with rem and about 7.5s for GHC with mod. Is this perhaps on a 
64-bit system? What is sizeof(int) in C and sizeOf (undefined :: Int) in 
Haskell?

That said, I suspect the only thing this benchmark really measures is how fast 
the various compilers can compute i * i + j * j + k * k `mod` 7.

Roman


___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Are there any female Haskellers?

2010-03-27 Thread Jeremy Shaw
One study suggests that the perceived work environment is too geeky:

http://www.msnbc.msn.com/id/34437233/ns/technology_and_science-science/

I also suspect that much Haskell promotion is targeted towards male oriented
sites, which does not help things:

http://www.quantcast.com/slashdot.org
http://www.quantcast.com/reddit.com

So, basically, just cultural issues combined with 'poorly targeted'
marketing. So, stop being so geeky ;)

- jeremy

2010/3/27 Günther Schmidt gue.schm...@web.de

 Hi all,

 from the names of people on the list it seems that all users here are
 males.

 Just out of curiosity are there any female users here, or are we guys only
 at the moment?

 Günther


 ___
 Haskell-Cafe mailing list
 Haskell-Cafe@haskell.org
 http://www.haskell.org/mailman/listinfo/haskell-cafe

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] GHC vs GCC vs JHC

2010-03-27 Thread Roman Leshchinskiy
On 28/03/2010, at 11:07, John Meacham wrote:

 I have not thoroughly checked it, but I think there are a couple things
 going on here:

It could also be worthwhile to float out (i*i + j*j) in rangeK instead of 
computing it in every loop iteration. Neither ghc nor gcc can do this; if jhc 
can then that might explain the performance difference (although I would expect 
it to be larger in this case).

Roman


___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Why is it so different between 6.12.1 and 6.10.4_1 ?

2010-03-27 Thread zaxis

I just mean syntax.  For example. the following code snippet is C-style. In
vim, i can use `shift+%` to jump between `{' and `}', and so on.   

hitSSQ hitNum = do {
nums - fmap str_ints_pick $ readFile ssqNum.txt;
forM_ nums (\n - do {
let { hitB = if (n!!6 == hitNum!!6) then 1 else 0 ;
hitR = foldl (\acc x - if(elem x (init hitNum)) then acc+1 else
acc) 0 (init n);};
printf %s\t%d:%d\t%s\n (show n) (hitR::Int) (hitB::Int) (hit_desc
hitR hitB);
});
}


Dietrich Epp-2 wrote:
 
 I think Miljenovic was asking about this (I removed explicit braces):
 
  fac n = let f = foldr (*) 1 [1..n] in f
 
 Which is strictly equivalent to:
 
  fac n = foldr (*) 1 [1..n]
 
 Translated into C, this is kind of like doing this:
 
  int add(int x, int y)
  {
  int sum = x + y;
  return sum;
  }
 
 instead of this:
 
  int add(int x, int y)
  {
  return x + y;
  }
 
 I find it very cumbersome (though not *difficult*) and painful to use  
 a C style of programming with Haskell, so I am not sure what you mean  
 when you ask why Haskell supports C style.  Are you talking about  
 mutable state, syntax, or something else?
 
 --Dietrich
 
 On 2010 March 27, at 4:28, zaxis wrote:
 

 Of course, you are wrong !  C is VERY important for almost every  
 programmer
 in the world!  Why cannot C programmer use haskell ?   And Why does  
 haskell
 support C code style ?


 Ivan Miljenovic wrote:

 zaxis z_a...@163.com writes:

 Why do you bother with the interior definition of f in there?
 Because i want to try a C code style not layout style without `do`  
 syntax
 sugar .

 Haskell /= C, so stop trying to code as if it is.  If you like C so
 much, then use C.

 -- 
 Ivan Lazar Miljenovic
 ivan.miljeno...@gmail.com
 IvanMiljenovic.wordpress.com
 ___
 Haskell-Cafe mailing list
 Haskell-Cafe@haskell.org
 http://www.haskell.org/mailman/listinfo/haskell-cafe




 -
 fac n = let {  f = foldr (*) 1 [1..n] } in f
 -- 
 View this message in context:
 http://old.nabble.com/Why-is-it-so-different-between-6.12.1-and-6.10.4_1---tp28049329p28051693.html
 Sent from the Haskell - Haskell-Cafe mailing list archive at  
 Nabble.com.

 ___
 Haskell-Cafe mailing list
 Haskell-Cafe@haskell.org
 http://www.haskell.org/mailman/listinfo/haskell-cafe
 
 ___
 Haskell-Cafe mailing list
 Haskell-Cafe@haskell.org
 http://www.haskell.org/mailman/listinfo/haskell-cafe
 
 


-
fac n = let {  f = foldr (*) 1 [1..n] } in f 
-- 
View this message in context: 
http://old.nabble.com/Why-is-it-so-different-between-6.12.1-and-6.10.4_1---tp28049329p28056674.html
Sent from the Haskell - Haskell-Cafe mailing list archive at Nabble.com.

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] GHC vs GCC vs JHC

2010-03-27 Thread Roman Leshchinskiy
On 28/03/2010, at 09:47, Lennart Augustsson wrote:

 It's important to switch from mod to rem.  This can be done by a
 simple abstract interpretation.

Also, changing the definition of rem from

a `rem` b
 | b == 0 = divZeroError
 | a == minBound  b == (-1) = overflowError
 | otherwise  =  a `remInt` b

to

a `rem` b
 | b == 0 = divZeroError
 | b == (-1)  a == minBound = overflowError
 | otherwise  =  a `remInt` b

speeds up the GHC version by about 20%. Figuring out why is left as an exercise 
to the reader :-)

Roman 


___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Why is it so different between 6.12.1 and 6.10.4_1 ?

2010-03-27 Thread zaxis

thanks for your answer!   However, i still feel the following code snippets
have different code style.

1. C-style
winSSQ count noRed noBlue = do {
let {yesRed=[1..33] \\ noRed; yesBlue=[1..16] \\ noBlue};
ps - picoSec;
setStdGen (mkStdGen $ fromInteger ps);
result - pick_ssq_nums count yesRed yesBlue [];
forM_ result (\x - print x);
writeFile ssqNum.txt $ ints_str result;
}

2. layout style
picoSec :: IO Integer
picoSec = do
t - ctPicosec `liftM` (getClockTime = toCalendarTime)
return t

The layout style makes me think of python.


Maciej Piechotka wrote:
 
 On Sat, 2010-03-27 at 04:28 -0700, zaxis wrote:
 Of course, you are wrong !  C is VERY important for almost every
 programmer 
 in the world!
 
 
 Hmm. We don't deny that C is important. However importance of hammer
 does not make screwdriver unimportant.
 
 While you can say that you can use screwdriver like a hammer (like you
 can use Haskell to do imperative programming or vice versa) it is
 usually terribly inefficient and/or inelegant.
 
  Why cannot C programmer use haskell ?
 
 (S)He can. However (s)he have to redefine him/herself from being C
 programmer. As real programmer can program in Fortran in any language
 you can program in any language in Haskell. You just shouldn't (as you
 shouldn't program in X in Y for nearly any X != Y). 
 
  And Why does haskell
 support C code style ?
 
 
 
 And BTW. Haskell have no 'C' style. You probably refer to do syntax
 sugar which is:
 - Not really C-style. It have syntax nowhere like C
 - Only partially in traditional imperative style as it do distinguish
 still between pure and unpure computation
 - It can be use for much more then crude C
 
  
 ___
 Haskell-Cafe mailing list
 Haskell-Cafe@haskell.org
 http://www.haskell.org/mailman/listinfo/haskell-cafe
 
 


-
fac n = let {  f = foldr (*) 1 [1..n] } in f 
-- 
View this message in context: 
http://old.nabble.com/Why-is-it-so-different-between-6.12.1-and-6.10.4_1---tp28049329p28056698.html
Sent from the Haskell - Haskell-Cafe mailing list archive at Nabble.com.

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Why is it so different between 6.12.1 and 6.10.4_1 ?

2010-03-27 Thread zaxis

Both 6.10 and 6.12 use same .ghci !
%cat ~/.ghci
:cd /media/G/www/qachina/db/doc/money
:l Money

%cat Money.hs|grep import
import System( getArgs )
import System.Random
import System.IO
import System.Time
import Text.Printf (printf)
import Text.Regex
import Data.List
import Data.Time.Calendar
import Data.Time.Calendar.WeekDate 
import Control.Monad

Sincerely!


Yusaku Hashimoto wrote:
 
 Hmm, When a ghci was started, there should be the only loaded module
 (Prelude.) And in both 6.10 and 6.12, such instance is not defined or
 exported in its Prelude. So please try `ghci -ignore-dot-ghci`. It
 invokes ghci without reading ~/.ghci and ./.ghci.
 
 And `((-) a)` is known as the Reader Monad, `a` can be regarded as
 the environment. My typical usage of that is like following:
 
 import Control.Monad
 
 data Vec = Vec { x :: Int, y :: Int }
 absolute :: Vec - Double
 absolute = sqrt . fromIntegral . liftM2 (+) (square . x) (square . y)
   where
 square a = a * a
 
 The definition of `absolute` above can be rewritten as
 
 absolute p = sqrt . fromIntegral $ square (x p) + square (y p)
   where
 square a = a * a
 
 How `square . x` and `square . y` share the argument? Because `Monad
 ((-) a)` is defined as
 
 instance Monad ((-) a) where
 return x = \a - x
 m = f = \a - f (m a) a
 
 Note `(=)` propagates `a` into both of its arguments. That's why the
 functions read same argument.
 
 HTH
 -nwn
 
 On Sat, Mar 27, 2010 at 3:31 PM, zaxis z_a...@163.com wrote:

 I just start ghci from shell and do nothing else. In fact, i really donot
 know `Monad ((-) a) ` . Would you mind expplain it ?


 Yusaku Hashimoto wrote:

 Did you import the module includes the instance of Monad ((-) e)
 somewhere in your code loaded in ghci?

 I tried this on a fresh ghci 6.12, but I got No instance error.

 -nwn

 On Sat, Mar 27, 2010 at 9:20 AM, zaxis z_a...@163.com wrote:

 In 6.12.1 under archlinux
let f x y z = x + y + z
 :t f
 f :: (Num a) = a - a - a - a

 :t (=) . f
 (=) . f :: (Num a) = a - ((a - a) - a - b) - a - b
 ((=) . f) 1 (\f x - f x) 2
 5

 In 6.10.4_1 under freebsd
 let f x y z = x + y + z
 *Money :t f
 f :: (Num a) = a - a - a - a

 :t (=) . f
 (=) . f  :: (Monad ((-) a), Num a) = a - ((a - a) - a - b) - a
 - b
 ((=) . f) 1 (\f x - f x) 2

 interactive:1:1:
    No instance for (Monad ((-) a))
      arising from a use of `=' at interactive:1:1-5
    Possible fix: add an instance declaration for (Monad ((-) a))
    In the first argument of `(.)', namely `(=)'
    In the expression: ((=) . f) 1 (\ f x - f x) 2
    In the definition of `it': it = ((=) . f) 1 (\ f x - f x) 2

 Sincerely!


 -
 fac n = let {  f = foldr (*) 1 [1..n] } in f
 --
 View this message in context:
 http://old.nabble.com/Why-is-it-so-different-between-6.12.1-and-6.10.4_1---tp28049329p28049329.html
 Sent from the Haskell - Haskell-Cafe mailing list archive at
 Nabble.com.

 ___
 Haskell-Cafe mailing list
 Haskell-Cafe@haskell.org
 http://www.haskell.org/mailman/listinfo/haskell-cafe

 ___
 Haskell-Cafe mailing list
 Haskell-Cafe@haskell.org
 http://www.haskell.org/mailman/listinfo/haskell-cafe




 -
 fac n = let {  f = foldr (*) 1 [1..n] } in f
 --
 View this message in context:
 http://old.nabble.com/Why-is-it-so-different-between-6.12.1-and-6.10.4_1---tp28049329p28050535.html
 Sent from the Haskell - Haskell-Cafe mailing list archive at Nabble.com.

 ___
 Haskell-Cafe mailing list
 Haskell-Cafe@haskell.org
 http://www.haskell.org/mailman/listinfo/haskell-cafe

 ___
 Haskell-Cafe mailing list
 Haskell-Cafe@haskell.org
 http://www.haskell.org/mailman/listinfo/haskell-cafe
 
 


-
fac n = let {  f = foldr (*) 1 [1..n] } in f 
-- 
View this message in context: 
http://old.nabble.com/Why-is-it-so-different-between-6.12.1-and-6.10.4_1---tp28049329p28056706.html
Sent from the Haskell - Haskell-Cafe mailing list archive at Nabble.com.

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Internet game servers in Haskell?

2010-03-27 Thread Jason Dagit
On Sat, Mar 27, 2010 at 3:14 AM, Colin Paul Adams
co...@colina.demon.co.ukwrote:

 Has anyone ever written a server in Haskell for managing live
 game-playing (any game) across the internet?


I haven't yet, but I saw someone had a simple MUD-like game engine a few
years ago.  I don't know if Frag supports network play, but I would assume
not.  David Roundy (original author of Darcs) wrote something for bridge
years ago, but I don't know if he wrote it in Haskell or if it's still
available.

If I had infinite free time it would be a fun project!  Any particular
reason why you're interested?

Jason
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Haskell-friendly Linux Distribution

2010-03-27 Thread Chris Dornan
Hi,

 

I am choosing a Linux distribution for a production Haskell project and
would would normally just go with Debian (pedigree, stability, and of course
Haskell Platfom included) but CentOS is in the frame.

 

Are there any particularly strong reasons for preferring or avoiding any
particular distribution?

 

Chris

 

---

Chris Dornan

email : ch...@chrisdornan.com

tel   : +1 (847) 691 7945

 

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Haskell-friendly Linux Distribution

2010-03-27 Thread Jeff Wheeler
On Sat, Mar 27, 2010 at 11:11 PM, Chris Dornan ch...@chrisdornan.com wrote:

 Are there any particularly strong reasons for preferring or avoiding any
 particular distribution?

A bunch of stuff is packaged by dons for Arch; you can see a lot of
links to the Arch packages on Hackage. It might be worth looking into.

-- 
Jeff Wheeler

Undergraduate, Electrical Engineering
University of Illinois at Urbana-Champaign
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Haskell-friendly Linux Distribution

2010-03-27 Thread Ivan Lazar Miljenovic
Jeff Wheeler j...@nokrev.com writes:
 On Sat, Mar 27, 2010 at 11:11 PM, Chris Dornan ch...@chrisdornan.com wrote:
 Are there any particularly strong reasons for preferring or avoiding any
 particular distribution?
 A bunch of stuff is packaged by dons for Arch; you can see a lot of
 links to the Arch packages on Hackage. It might be worth looking into.

We may not have as many packages as Arch (because we don't just churn
them willy-nilly) but Gentoo has a fair number of up-to-date Haskell
packages in its overlay.

-- 
Ivan Lazar Miljenovic
ivan.miljeno...@gmail.com
IvanMiljenovic.wordpress.com
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe