Re: [Haskell-cafe] Number 1, at least for now

2006-02-02 Thread Gour
On Wed, 2006-02-01 at 19:14 -0800, John Meacham wrote:

 though, I think this is a great oprotunity to improve ghc's optimizer.

Huh, that would be the best thing with the whole shootout endeavour..


Sincerely,
Gour


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] Number 1, at least for now

2006-02-02 Thread Simon Peyton-Jones
|  though, I think this is a great oprotunity to improve ghc's
optimizer.
| 
| Huh, that would be the best thing with the whole shootout endeavour..

Yes indeed.  

One thing that would be really helpful, as a first step, would be to
identify a bunch of concrete examples that GHC should have optimised,
or perhaps could have optimised, and attach them to the GHC wiki
somewhere.  One place would be here
http://haskell.org/haskellwiki/Performance
or perhaps somewhere on the developers wiki, or as a task.
http://hackage.haskell.org/trac/ghc

I'm not promising that anything will happen fast (unless someone else
does it!) but it's always much more likely to happen if there's a
specific place that advertises low-hanging performance fruit.
 

This is closely related to the advice to programmers that Don
circulated yesterday, in which he explained how he optimised one
particular case.  But not quite the same.

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


[Haskell-cafe] Haskell and JVM (was: EclipseFP (Haskell IDE) 0.9.1 released)

2006-02-02 Thread Graham Klyne
Thiago Arrais wrote:
 There is one issue, though, that touches a lot of sensitive areas. The
 Eclipse platform runs inside a Java Virtual Machine. Unfortunately,
 there isn't currently a way to compile Haskell to the JVM (at least I
 don't know of any, if someone knows, please let me know). This means
 the IDE has to be written in Java, not in Haskell. That's the price we
 are paying now. Writing a tool for a language in a different language.

Ah, now there's a thing!  I don't have any good answers, but I have a friend who
is interested in such things, and may even be looking for a project in this
area.  In our discussions, a number of links came up, but I'm not sure if I can
find them all.  Here's an attempt:

  http://www.xoltar.org/languages/nice.html
  http://www.pugscode.org/
  http://scala.epfl.ch/index.html

Nothing very specific to your ideas goal, but there's some work on compiling
functional code to JVM.

I was also talking to someone from Cambridge Comlab the other week who has an
FP-like system (for web service/portal creation) that uses JVM bytecode
modification.  maybe some useful experience to draw upon there?

I'm also reminded of a project I was in discussion about some time ago, which
was to explore use of Haskell program transformation techniques (hopefully
adapting some ideas from BMF/Squiggol) for implementing aspects of a JIT runtime
for JVM.  Unfortunately, that never took off (and was maybe too ambitious for
the effort contemplated).  There is some related work at the kestrel Institute
[http://www.kestrel.edu/home/projects/]

#g

-- 
Graham Klyne
For email:
http://www.ninebynine.org/#Contact

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


Re[2]: [Haskell-cafe] EclipseFP (Haskell IDE) 0.9.1 released

2006-02-02 Thread Bulat Ziganshin
Hello Graham,

Thursday, February 02, 2006, 1:15:44 PM, you wrote:

 GK So is there a compelling feature in this Eclipse plugin that isn't easily
 GK achieved using simpler tools?
 
 it's a list of what-i-want-from-the-IDE:

 * autogeneration of prototypes
GK I don't know what you mean by this.

adding type signatures of functions to module. this can be done by
loading module into the hugs/ghci and using :t; or by the
programmatica tools, afair

 * context help
GK Very nice - might persuade me to use Eclipse routinely (I assume you mean 
things
GK like getting help about functions, esp. prelude and standard libraries)

yes. btw, if you need it, you can use hasktags with a vim/emacs. it
allows you to jump right to the fucntion definition, which is more
informative and anyway typically contains text for the haddock. vim
even can show this function definition in the supplementary window
without jumping to it

 * type-based function hierarchy browsing
GK Very nice.  I assume this allows functions to be located from type 
signatures,
GK including prelude and standard libraries.

seems that we say about different things. IDEs for OOP languages show
program hierarchy around the defined classes, that is unuseful for
Haskell. nevertheless, many functions typically grouped around types
they support. so, a module-type-function view and
type-function view should be handy

GK In summary, I think there's enough there to make me think seriously about 
using
GK Eclipse for Haskell development, at least some of the time.

sorry, i said about ideal IDE, not about Eclipse (what i never seen,
after all). and of course i'm not the author of this package. sorry :)))

GK Something I'd also like is in-editor warnings of features that are not 
supported
GK uniformly across different implementations -- my (rough) criteria for 
portable
GK Haskell has been to check that code runs with GHC and Hugs.

one thing that i skipped in my dream list is on-the-fly syntax checking

GK Also, some form of integrated testing support would be nice.  There was 
brief
GK discussion here some time ago about something like assert statements that 
could
GK be checked at compile time -- if you have in-context expression evaluation 
then
GK this wouldn't be a great leap:  e.g. scan the code for identifiable 
expressions
GK that are expected to be true, and report warnings if they are not.

good idea. i think that i should place all our stuff at the
IDE/Ideal wiki

-- 
Best regards,
 Bulatmailto:[EMAIL PROTECTED]



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


Re: [Haskell-cafe] Haskell and JVM

2006-02-02 Thread Arnaud Bailly
Hello,
I stumbled upon your discussion on haskell-cafe and this theme seems to pop
up one time or another. If someone is interested, I have some Java
code for compiling Haskell98 to bytecode that I would be more than
willing to share. It is not in the best shape and does not implement
all of haskell but most low-level work to generate classes and
bytecode from haskell code is implemented (patternmatching, data
constructors, lazy functions, ...). 
This is a project I started some years ago and used for specification
of simple functional behaviour (without complex type system) in Java.

Regards,

-- 
Arnaud Bailly, Dr. - Ingénieur de Recherche 
NORSYS 
1, rue de la Cense des Raines
ZAC du Moulin
59710 ENNEVELIN
Tel : (33) 3 28 76 56 76
Mob : (33) 6 17 12 19 78
Fax : (33) 3 28 76 57 00
Web : http://www.norsys.fr

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


Re: [Haskell-cafe] Haskell and JVM

2006-02-02 Thread Neil Mitchell
Hi,

 up one time or another. If someone is interested, I have some Java
 code for compiling Haskell98 to bytecode that I would be more than
 willing to share. It is not in the best shape and does not implement

You might also be interested in:
http://www.brianweb.net/personal/blog/entry.php?id=18

Currently this is only a runtime, which allows running full Haskell in
a JVM. A bytecode translator was being worked on, although I don't
know the progress that has been made recently.

Thanks

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


Re: [Haskell-cafe] Haskell and JVM

2006-02-02 Thread Krasimir Angelov
Questions about Haskell for JVM or .NET was asked quite often and it
is really interesting question. Since the JVM and .NET machines have a
lot of common if there was a compiler for one of them then it can
retargeted to the other quite easily. The major problem with such
compilers is the performance. Many attempts exists but no one has
managed to build a complete solution. There are several major
problems:

  - How to represent the G/STG machine stack in JVM/.NET? The naive
solution is to use an array but it is proven to be inefficient.
  - How to minimize the runtime typecasts? They are necessary because
the JVM/.NET type system is a lot weaker than the Haskell's one.
  - How to efficiently represent the IO monad and exceptions?
  - How to make the integration of Haskell with Java/C# easier?

Since usually the performance of all VM languages is worse than those
of the native compiled (C/C++), I think that it is acceptable for
Haskell for JVM/.NET to be slower than GHC for example. Even that if
the performance isn't so worse then it will be usable since it can be
used in existing Java/.NET projects.

Cheers,
  Krasimir

2006/2/2, Arnaud Bailly [EMAIL PROTECTED]:
 Hello,
 I stumbled upon your discussion on haskell-cafe and this theme seems to pop
 up one time or another. If someone is interested, I have some Java
 code for compiling Haskell98 to bytecode that I would be more than
 willing to share. It is not in the best shape and does not implement
 all of haskell but most low-level work to generate classes and
 bytecode from haskell code is implemented (patternmatching, data
 constructors, lazy functions, ...).
 This is a project I started some years ago and used for specification
 of simple functional behaviour (without complex type system) in Java.

 Regards,

 --
 Arnaud Bailly, Dr. - Ingénieur de Recherche
 NORSYS
 1, rue de la Cense des Raines
 ZAC du Moulin
 59710 ENNEVELIN
 Tel : (33) 3 28 76 56 76
 Mob : (33) 6 17 12 19 78
 Fax : (33) 3 28 76 57 00
 Web : http://www.norsys.fr

 ___
 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: Haskell code for this example of flow control

2006-02-02 Thread Maurício

Donald Bruce Stewart wrote:

briqueabraque:


 Hi,

 I would like to know what options I have in Haskell to do something 
similar to this C++ code:


double a = 1000;
while (a1) a/=2;

 I'm able to do that with lists, but I would like to know how to do 
that with monads and variables with state.



You'll get good code using a normal recusive loop:

main = print (loop 1000)
where
loop a | a = 1= a 
   | otherwise = loop (a/2)


All such control structures may be implemented using recursion.

-- Don


  I understand those examples, but I really would like to know how to 
do that with monads. I would like to ask the same question, but now with 
this code:


double a = 1000;
double b = 0;
while (a != b) {
a /= 2;
cout  a; // Prints a
cin  b; // User gives a number, stored in b
};

  Best,
  Maurício


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


Re: [Haskell-cafe] Re: Haskell code for this example of flow control

2006-02-02 Thread Chris Kuklewicz
Maurício wrote:

   I understand those examples, but I really would like to know how to do
 that with monads. I would like to ask the same question, but now with
 this code:
 
 double a = 1000;
 double b = 0;
 while (a != b) {
 a /= 2;
 cout  a; // Prints a
 cin  b; // User gives a number, stored in b
 };
 

A close to line-for-line translation:

import Data.IORef
import Control.Monad(liftM2,when)

main = example 1000

example :: Double - IO ()
example originalA = do
  refA - newIORef originalA  -- allocate local variable a
  refB - newIORef 0  -- allocate local variable b
  let loop = do   -- loop in scope of refA, refB
flag - liftM2 (/=) (readIORef refA) (readIORef refB)
when flag $ do
  modifyIORef refA (/2)
  print = readIORef refA
  -- This will give an error if not a number:
  writeIORef refB = readIO = getLine
  loop
  loop -- start executing loop

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


Re: [Haskell-cafe] Known Unknowns

2006-02-02 Thread Isaac Gouy


--- Ketil Malde [EMAIL PROTECTED] wrote:

 Isaac Gouy [EMAIL PROTECTED] writes:
 
  Programmer skill and effort really does matter ;-)
 
 Yes, more so, than any inherent language
 disadvantage, perhaps, which
 happens to be the general lesson from the ICFP
 contests as well.  Any
 idea if other languages have seen similar efforts?

FreePascal and Smart Effiel, somewhat - and there have
been excellent individual efforts with Lua and Tcl and
...

imo the Haskell Cafe discussions and wiki have been a
more open and shared learning experience than we
usually see, and maybe some of the success stems from
that collaboration and competition.


__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Re: Haskell code for this example of flow control

2006-02-02 Thread Kurt Hutchinson
On 2/2/06, Maurício [EMAIL PROTECTED] wrote:
I understand those examples, but I really would like to know how to
 do that with monads. I would like to ask the same question, but now with
 this code:

 double a = 1000;
 double b = 0;
 while (a != b) {
  a /= 2;
  cout  a; // Prints a
  cin  b; // User gives a number, stored in b
 };

An idiomatic approach:
example :: Double - Double - IO ()
example a b
| a == b= return ()
| otherwise = do
let a' = a / 2
print a'
b' - readLn
example a' b'

main = example 1000 0
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Number 1, at least for now

2006-02-02 Thread Wolfgang Jeltsch
Am Mittwoch, 1. Februar 2006 08:22 schrieb Donald Bruce Stewart:
 Haskell is now ranked number 1 on the Great Language Shootout!

 http://shootout.alioth.debian.org/gp4/benchmark.php?test=alllang=all

 Hooray :)

 -- Don

It seems to be number 2 at the moment.

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


Re: [Haskell-cafe] Number 1, at least for now

2006-02-02 Thread Wolfgang Jeltsch
Am Donnerstag, 2. Februar 2006 04:26 schrieb Donald Bruce Stewart:
 [...]

 A good packed string regex library would also be useful.

But only one that gives us regular expressions which are parsed at compile 
time instead of runtime.

 [...]

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


Re: [Haskell-cafe] Number 1, at least for now

2006-02-02 Thread Sebastian Sylvan
On 2/2/06, Wolfgang Jeltsch [EMAIL PROTECTED] wrote:
 Am Mittwoch, 1. Februar 2006 08:22 schrieb Donald Bruce Stewart:
  Haskell is now ranked number 1 on the Great Language Shootout!
 
  http://shootout.alioth.debian.org/gp4/benchmark.php?test=alllang=all
 
  Hooray :)
 
  -- Don

 It seems to be number 2 at the moment.


It looks like it, all of a sudden, has one missing benchmark. Did
something break?

/S

--
Sebastian Sylvan
+46(0)736-818655
UIN: 44640862
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Number 1, at least for now

2006-02-02 Thread Isaac Gouy
--- Sebastian Sylvan [EMAIL PROTECTED]
wrote:
  It seems to be number 2 at the moment.
 
 
 It looks like it, all of a sudden, has one missing
 benchmark. Did
 something break?

Previously the GHC program was shown incorrectly as
completing regex-dna within the timeout - now it's
shown correctly.

__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Known Unknowns

2006-02-02 Thread Chris Kuklewicz
Joel Koerwer wrote:
 Don, that's a great little mini tutorial, exactly what I was hoping for.
 I'm looking forward to learning more tricks.
 
 On an unrelated note, I have an STUArray nbody. I haven't really looked
 closely at the chris+dons version, but I suspect they amount to doing
 the same thing. I get commensurate runtimes at least. But I'll post it
 on the wiki in a while in case there is some optimization I missed.
 
 On an even more unrelated note, I get slower runtimes with -optc-O3 and
 -optc-ffast-math than without. Individually or in tandem. Odd. This is
 ghc 6.4.1 and gcc 4.0.3 on a (Banias) Pentium M.

More architecture benchmarking:

On a powerbook G4, Joel Koerwer's entry on http://haskell.org/hawiki/NbodyEntry
runs faster than dons+chris.

And I edited it to make it smaller, but by hoisting 'size' and 'dt' I also made
it run quite a bit faster.  It now takes 1.7x less time than dons+chris.

Don, could you check the speed on your architecture?

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


Re: [Haskell-cafe] Known Unknowns

2006-02-02 Thread Donald Bruce Stewart
haskell:
 Joel Koerwer wrote:
  Don, that's a great little mini tutorial, exactly what I was hoping for.
  I'm looking forward to learning more tricks.
  
  On an unrelated note, I have an STUArray nbody. I haven't really looked
  closely at the chris+dons version, but I suspect they amount to doing
  the same thing. I get commensurate runtimes at least. But I'll post it
  on the wiki in a while in case there is some optimization I missed.
  
  On an even more unrelated note, I get slower runtimes with -optc-O3 and
  -optc-ffast-math than without. Individually or in tandem. Odd. This is
  ghc 6.4.1 and gcc 4.0.3 on a (Banias) Pentium M.
 
 More architecture benchmarking:
 
 On a powerbook G4, Joel Koerwer's entry on 
 http://haskell.org/hawiki/NbodyEntry
 runs faster than dons+chris.
 
 And I edited it to make it smaller, but by hoisting 'size' and 'dt' I also 
 made
 it run quite a bit faster.  It now takes 1.7x less time than dons+chris.
 
 Don, could you check the speed on your architecture?

Yes! I was missing the -funbox-strict-fields, it makes a huge
difference.  Check the wiki page, these stuarrays are the fastest yet.

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


Re: [Haskell-cafe] Haskell to call Microsoft COM (Dispatch)

2006-02-02 Thread Marc Weber
On Mon, Jan 30, 2006 at 08:40:43PM +0100, Gracjan Polak wrote:
Hi all,
Is there any library to make Haskell call Microsoft COM functions
using Dispatch? E.g I don't need the full COM binary functionality,
scripting is enough. Google didn't seem to find anything
interesting... beside rolling my own using FFI :)
Thanks in advance!

Hi. I spent much time trying to get it to work.. you have to download
the whole fptools directory (from cvs!).. and I think i did some little
patches but I can check out again and compare..
It did compile and I think it's working well but I'm still struggling
getting to use it.. At least the examples do compile!

If you are really interested I would appreciate getting in contact with
you (my private email: marco-oweber a t gmx.de) .. Perhaps we can help
each other. (Becaue I'm not an experienced haskell programmer, yet ;-) 

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


Re: [Haskell-cafe] Known Unknowns

2006-02-02 Thread Joel Koerwer
Hey this is great. Chris your improvements are awesome. I mean the
speed is nice, but you really cleaned up the code.

There's an extraneous call to energy in the second runST block, but it
should be insignificant. Also, -fglasgow-exts is necessary for the
left-hand-side type declarations of size and dt.

One question, in:

calcMomentum (i+1) $! (px+vx*m,py+vy*m,pz+vz*m)

that $! doesn't actually do much for a tuple, does it? Of course,
there's not much point in further optimizing the initialization
routine, as we'd never be able to detect the difference in runtime.

The shootout has been a great learning tool for me :-)

Thanks to Chris, Don, and the rest of the Haskell community.

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