Re: [Haskell-cafe] Re: Hack (web) and apache configuration

2009-06-26 Thread Brandon S. Allbery KF8NH

On Jun 25, 2009, at 13:31 , Henry Laxen wrote:
It reminds me of a saying I heard once.  If carpenters built houses  
the way
programmers write programs, you could walk into any house, remove  
any single
nail, and the structure would collapse into pieces no larger than  
toothpicks.



Weinberg's Law:  If carpenters built houses the way programmers write  
programs, then the first woodpecker that came along would destroy  
civilization.


--
brandon s. allbery [solaris,freebsd,perl,pugs,haskell] allb...@kf8nh.com
system administrator [openafs,heimdal,too many hats] allb...@ece.cmu.edu
electrical and computer engineering, carnegie mellon universityKF8NH




PGP.sig
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] coding standard question

2009-06-26 Thread david48
On Thu, Jun 25, 2009 at 3:27 AM, wren ng thorntonw...@freegeek.org wrote:

 If certain warnings truly are spurious and unavoidable, then it's best to
 document this explicitly in the code by pragmas to disable the relevant
 warnings. This way the spurious nature of the warning is documented (for
 future maintainers, including yourself) and the distracting output of the
 compiler is removed as well. Unfortunately, GHC only gives whole-file scope
 for disabling warnings, but that could be fixed with enough work.

Hello all,
Forgive me if I'm a bit out of topic, but following this thread, I
decided to add -Wall -Werror for a program I'm working on.
I've spend a bit of time correcting quite a lot of warnings, most of
them being about missing type signatures. I've corrected them all, but
there remains one that I can't :  ghc refuses the type signature it
suggests me.

Anyone has any idea ?

=
da...@pcdavid2:~/projets/haskell/caimonitor$ ./g
[3 of 4] Compiling Bdd  ( Bdd.hs, Bdd.o )

Bdd.hs:27:0:
Warning: Definition but no type signature for `connecter'
 Inferred type: connecter :: IO

HDBC-mysql-0.6:Database.HDBC.MySQL.Connection.Connection

no location info:
Failing due to -Werror.
=

Here's part of the code : without -Werror, the code compiles and works fine.

==
module Bdd where

import Database.HDBC
import Database.HDBC.MySQL
import Text.Printf
import Messages

mysqlInfo :: MySQLConnectInfo
mysqlInfo = defaultMySQLConnectInfo { mysqlHost =xxx.xxx.xxx.xxx
, mysqlUser = 
, mysqlPassword = 
, mysqlDatabase = xx
, mysqlPort = 0
, mysqlUnixSocket =
}

--connecter :: IO Database.HDBC.MySQL.Connection.Connection
connecter= connectMySQL mysqlInfo
...
...
...
==

Thanks,

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


Re: [Haskell-cafe] coding standard question

2009-06-26 Thread Daniel Fischer
Am Freitag 26 Juni 2009 11:30:32 schrieb david48:
 On Thu, Jun 25, 2009 at 3:27 AM, wren ng thorntonw...@freegeek.org wrote:
  If certain warnings truly are spurious and unavoidable, then it's best to
  document this explicitly in the code by pragmas to disable the relevant
  warnings. This way the spurious nature of the warning is documented (for
  future maintainers, including yourself) and the distracting output of the
  compiler is removed as well. Unfortunately, GHC only gives whole-file
  scope for disabling warnings, but that could be fixed with enough work.

 Hello all,
 Forgive me if I'm a bit out of topic, but following this thread, I
 decided to add -Wall -Werror for a program I'm working on.
 I've spend a bit of time correcting quite a lot of warnings, most of
 them being about missing type signatures. I've corrected them all, but
 there remains one that I can't :  ghc refuses the type signature it
 suggests me.

 Anyone has any idea ?

 =
 da...@pcdavid2:~/projets/haskell/caimonitor$ ./g
 [3 of 4] Compiling Bdd  ( Bdd.hs, Bdd.o )

 Bdd.hs:27:0:
 Warning: Definition but no type signature for `connecter'
  Inferred type: connecter :: IO

 HDBC-mysql-0.6:Database.HDBC.MySQL.Connection.Connection

 no location info:
 Failing due to -Werror.
 =

 Here's part of the code : without -Werror, the code compiles and works
 fine.

 ==
 module Bdd where

 import Database.HDBC
 import Database.HDBC.MySQL
 import Text.Printf
 import Messages

 mysqlInfo :: MySQLConnectInfo
 mysqlInfo = defaultMySQLConnectInfo { mysqlHost =xxx.xxx.xxx.xxx
 , mysqlUser = 
 , mysqlPassword = 
 , mysqlDatabase = xx
 , mysqlPort = 0
 , mysqlUnixSocket =
 }

 --connecter :: IO Database.HDBC.MySQL.Connection.Connection

Looks like you must also 
import Database.HDBC.MySQL.Connection

or, if the type Connection is exported from one of the imported modules, use it 
unqualifed 
or qualified with that module name.

 connecter= connectMySQL mysqlInfo
 ...
 ...
 ...
 ==

 Thanks,

 David

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


[Haskell-cafe] Re: FFI and heap memory usage limit

2009-06-26 Thread Simon Marlow

On 22/06/2009 23:48, Bulat Ziganshin wrote:

Hello Marcin,

Tuesday, June 23, 2009, 2:31:13 AM, you wrote:


 Now this took an odd turn, because the simulation started crashing with
out-of-memory errors _after_ completing (during bz2 compression). I'm fairly
certain this is a GC/FFI bug, because increasing the max heap didn't help.
Moving the bz2 compression to a separate process provided a reasonable
solution.
 What I think is happening is that after the simulation completes, 
almost all
of the available memory (within the -M limit) is filled with garbage. Then I
run bzlib which tries to allocate more memory (from behind FFI?) to compress
the results, which in turn causes an out-of-memory error instead of
triggering a GC collection.


i can propose a quick fix - alloc 10 mb using allocBytes before
starting your algorithm, and free it just before starting bzlib. it
may help

i agree that this looks like a deficiency of memory allocator. it's
better to write at ghc-users maillist (or at least make a copy to
Simon Marlow) to attract attention to your message


Maybe bzlib allocates using malloc()?  That would not be tracked by 
GHC's memory management, but could cause OOM.


Another problem is that if you ask for a large amount of memory in one 
go, the request is usually honoured immediately, and then we GC shortly 
afterward.  If this is the problem for you, please submit a ticket and 
I'll see whether it can be changed.  You could work around it by calling 
System.Mem.performGC just before allocating the memory.


Cheers,
Simon

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


Re: [Haskell-cafe] Haskell on JVM

2009-06-26 Thread Timo B. Hübel
 Incidentally, I am looking for someone well versed in the JVM who wants
 to help spearhead a JVM back end for jhc. 

I would love to see this! With the current advent of all those languages 
targeting at the JVM (Groovy, Scala, Clojure) I think a JVM backend for a 
Haskell compiler could, together with proper Java interop, make for a major 
breakthrough of Haskell in general.

Unforunately, as I can tell from my halfknowledge, the JVM lacks some 
important functionality required for properly targeting functional language 
features on the JVM.

And here comes my question: If there is anybody with proper knowledge about 
this issue, I would really like to know what are those things that are 
missing? For example, Clojure lacks proper tail recrusion optimization due to 
some missing functionality in the JVM. But does anybody know the details?

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


Re: [Haskell-cafe] Haskell on JVM

2009-06-26 Thread Arvid Halma
Although I don't know what the current JVM lacks to properly act as a
functional backend, it appears that JVM 1.7 will be at least better
suitable to support dynamic languages.

See: The Da Vinci Machine Project
http://openjdk.java.net/projects/mlvm/

Arvid

On Fri, Jun 26, 2009 at 2:09 PM, Timo B. Hübelt...@gmx.info wrote:
 Incidentally, I am looking for someone well versed in the JVM who wants
 to help spearhead a JVM back end for jhc.

 I would love to see this! With the current advent of all those languages
 targeting at the JVM (Groovy, Scala, Clojure) I think a JVM backend for a
 Haskell compiler could, together with proper Java interop, make for a major
 breakthrough of Haskell in general.

 Unforunately, as I can tell from my halfknowledge, the JVM lacks some
 important functionality required for properly targeting functional language
 features on the JVM.

 And here comes my question: If there is anybody with proper knowledge about
 this issue, I would really like to know what are those things that are
 missing? For example, Clojure lacks proper tail recrusion optimization due to
 some missing functionality in the JVM. But does anybody know the details?

 Thanks,
 Timo
 ___
 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] Haskell on JVM

2009-06-26 Thread Maarten Hazewinkel


On 26 Jun 2009, at 14:09, Timo B. Hübel wrote:

And here comes my question: If there is anybody with proper  
knowledge about

this issue, I would really like to know what are those things that are
missing? For example, Clojure lacks proper tail recrusion  
optimization due to
some missing functionality in the JVM. But does anybody know the  
details?


Basically, the JVM lacks a native ability to do tail calls. It does  
not have an
instruction to remove/replace a stack frame without executing an  
actual return

to the calling method/function.

With the heavy use of recursion in functional programs, this is an  
important

feature in a language implementation to avoid stack overflows.

Some language implementations (Scala) can do partial workarounds by  
turning
the generated code into a loop in the compiler, but this is frequently  
limited
to only deal with self-recursive calls, and does not deal with the  
general case
(X-calls-Y-calls-Z-calls-X...), which a proper implementation of tail- 
calls at

the JVM level would allow.

At the JIT level (below the JVM spec level) some implementations may  
actually do
the tail call optimization anyway, but this is beyond the control of a  
language
implementation, and would result in a situation where the behaviour of  
your
program depends on particular implementations/versions/parameters of  
the JVM

running it. That is something to be avoided if possible.


Maarten Hazewinkel
maarten.hazewin...@gmail.com



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


Re: [Haskell-cafe] Haskell on JVM

2009-06-26 Thread David Leimbach
There has been a scheme with tail recursion on the JVM for a long time
IIRC.  SISC right?

At least I am fairly certain it does.
On Friday, June 26, 2009, Timo B. Hübel t...@gmx.info wrote:
 Incidentally, I am looking for someone well versed in the JVM who wants
 to help spearhead a JVM back end for jhc.

 I would love to see this! With the current advent of all those languages
 targeting at the JVM (Groovy, Scala, Clojure) I think a JVM backend for a
 Haskell compiler could, together with proper Java interop, make for a major
 breakthrough of Haskell in general.

 Unforunately, as I can tell from my halfknowledge, the JVM lacks some
 important functionality required for properly targeting functional language
 features on the JVM.

 And here comes my question: If there is anybody with proper knowledge about
 this issue, I would really like to know what are those things that are
 missing? For example, Clojure lacks proper tail recrusion optimization due to
 some missing functionality in the JVM. But does anybody know the details?

 Thanks,
 Timo
 ___
 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] Multi-module scripts

2009-06-26 Thread Maurí­cio

Is it possible to write a Haskell script that
uses a module that is also going to be interpreted?
Like, say:

#!/usr/bin/runhaskell

module Main (main) where
import OtherModule
main = (...)



where OtherModule is available in, say, OtherModule.hs
and not in the already compiled and installed  library?

Thanks,
Maurício

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


Re: [Haskell-cafe] Haskell on JVM

2009-06-26 Thread Jason Dagit
Hi Timo,

On Fri, Jun 26, 2009 at 5:09 AM, Timo B. Hübel t...@gmx.info wrote:

  Incidentally, I am looking for someone well versed in the JVM who wants
  to help spearhead a JVM back end for jhc.

 I would love to see this! With the current advent of all those languages
 targeting at the JVM (Groovy, Scala, Clojure) I think a JVM backend for a
 Haskell compiler could, together with proper Java interop, make for a major
 breakthrough of Haskell in general.

 Unforunately, as I can tell from my halfknowledge, the JVM lacks some
 important functionality required for properly targeting functional language
 features on the JVM.

 And here comes my question: If there is anybody with proper knowledge about
 this issue, I would really like to know what are those things that are
 missing? For example, Clojure lacks proper tail recrusion optimization due
 to
 some missing functionality in the JVM. But does anybody know the details?


My brief research into why the JVM lacks tail calls indicated that tail
calls do not play nicely with the JVM security model and make stack traces
harder to manage.  Although, I have also heard that tail call of some form
is expected to appear in java 1.7.

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


Re: [Haskell-cafe] Haskell on JVM

2009-06-26 Thread David Leimbach
On Fri, Jun 26, 2009 at 7:12 AM, David Leimbach leim...@gmail.com wrote:

 There has been a scheme with tail recursion on the JVM for a long time
 IIRC.  SISC right?


Ah SISC is interpreted.  Clojure is compiled. At least that may be the key
difference to making it work or not.



 At least I am fairly certain it does.
 On Friday, June 26, 2009, Timo B. Hübel t...@gmx.info wrote:
  Incidentally, I am looking for someone well versed in the JVM who wants
  to help spearhead a JVM back end for jhc.
 
  I would love to see this! With the current advent of all those languages
  targeting at the JVM (Groovy, Scala, Clojure) I think a JVM backend for a
  Haskell compiler could, together with proper Java interop, make for a
 major
  breakthrough of Haskell in general.
 
  Unforunately, as I can tell from my halfknowledge, the JVM lacks some
  important functionality required for properly targeting functional
 language
  features on the JVM.
 
  And here comes my question: If there is anybody with proper knowledge
 about
  this issue, I would really like to know what are those things that are
  missing? For example, Clojure lacks proper tail recrusion optimization
 due to
  some missing functionality in the JVM. But does anybody know the details?
 
  Thanks,
  Timo
  ___
  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] Haskell on JVM

2009-06-26 Thread Claus Reinke

For example, Clojure lacks proper tail recrusion  optimization due to
some missing functionality in the JVM. But does anybody know the  
details?


|Basically, the JVM lacks a native ability to do tail calls. It does  
|not have an instruction to remove/replace a stack frame without 
|executing an actual return to the calling method/function.


There is a conflict between preserving stack layout and efficient
tail calls. Unfortunately, stack inspection appears to be used for
security aspects in JVM. That doesn't make tail calls impossible,
but may have slowed down progress as this argument always
comes up in discussing tail calls on the JVM (since its byte code
isn't just an internal detail, but an externally used API).

None of the various partial workarounds are quite satisfactory
(jumps work only locally, there is an upper size limit on how
much code can be considered as local, trampolines return before 
each call, there are alternatives that clear the stack not before

each call, but every n calls, ..., see the various Haskell to Java/JVM
papers).

I was curious about the current state (the issue is as old as JVM),
and here's what I've found so far (more concrete/official info would
be appreciated):

   tail calls in the VM [2007]
   http://blogs.sun.com/jrose/entry/tail_calls_in_the_vm

   RFE: Tail Call Optimization [2002]
   http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4726340

   [2009]
   http://wikis.sun.com/display/mlvm/TailCalls

   Tail Call Optimization in the Java HotSpot(TM) VM [2009]
   http://www.ssw.uni-linz.ac.at/Research/Papers/Schwaighofer09Master/

Still cooking, still not done, it seems, but perhaps closer than ever?

Claus


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


Re: [Haskell-cafe] Why is Bool no instance of Num and Bits?

2009-06-26 Thread Edward Kmett
Agreed. I wound up having to add a horrible Num instance for Bool in
'monoids' in order to support a decent Boolean Ring type.

http://comonad.com/haskell/monoids/dist/doc/html/monoids/Data-Ring-Boolean.html

I would much rather be able to get rid of it!

The only problem with eliminating the constraint is that any code that uses
Bits polymorphically might have to pick up a Num annotation, but I can't see
it being a serious problem.

-Edward Kmett

On Wed, Jun 24, 2009 at 8:13 AM, John Meacham j...@repetae.net wrote:

 On Fri, May 08, 2009 at 04:36:41PM +0200, Stephan Friedrichs wrote:
  When looking for an xor function, I found one in Data.Bits but couldn't
  use it for Bool, because Bool is no instance of Bits and of Num (which
  would be necessary, because it's class (Num b) = Bits b). My question
  is: Why not?

 This has bothered me too. However, I think the root problem is that
 'Num' is a superclass of 'Bits'. There is no reason it should be, all
 the default instances can be specified without the Num dependency.

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


Re: [Haskell-cafe] Haskell on JVM

2009-06-26 Thread Casey Hawthorne
Since the JVM doesn't seem to support tail call optimization, I
suppose one could could directly manipulate the bytecodes generated by
jhc to do TCO.

One challenge would be the garbage collector, since Haskell and Java
have very different working sets of what is still being used.
--
Regards,
Casey
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Haskell on JVM

2009-06-26 Thread John A. De Goes


JVM 7 has tail calls, and if you don't want to wait for that, goto  
works perfectly well for self-recursive functions. Other techniques  
can deal with mutual recursion, albeit at the cost of performance.


Regards,

John A. De Goes
N-Brain, Inc.
The Evolution of Collaboration

http://www.n-brain.net|877-376-2724 x 101

On Jun 26, 2009, at 6:26 AM, Maarten Hazewinkel wrote:



On 26 Jun 2009, at 14:09, Timo B. Hübel wrote:

And here comes my question: If there is anybody with proper  
knowledge about
this issue, I would really like to know what are those things that  
are
missing? For example, Clojure lacks proper tail recrusion  
optimization due to
some missing functionality in the JVM. But does anybody know the  
details?


Basically, the JVM lacks a native ability to do tail calls. It does  
not have an
instruction to remove/replace a stack frame without executing an  
actual return

to the calling method/function.

With the heavy use of recursion in functional programs, this is an  
important

feature in a language implementation to avoid stack overflows.

Some language implementations (Scala) can do partial workarounds by  
turning
the generated code into a loop in the compiler, but this is  
frequently limited
to only deal with self-recursive calls, and does not deal with the  
general case
(X-calls-Y-calls-Z-calls-X...), which a proper implementation of  
tail-calls at

the JVM level would allow.

At the JIT level (below the JVM spec level) some implementations may  
actually do
the tail call optimization anyway, but this is beyond the control of  
a language
implementation, and would result in a situation where the behaviour  
of your
program depends on particular implementations/versions/parameters of  
the JVM

running it. That is something to be avoided if possible.


Maarten Hazewinkel
maarten.hazewin...@gmail.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] Haskell on JVM

2009-06-26 Thread Daniel Peebles
Maybe the JVM could be abused so that all of the haskell code is
within one function, so as to avoid java's notion of a function
boundary and implement our own using just goto? Or does the JIT
operate on entire functions at a time?


On Fri, Jun 26, 2009 at 1:23 PM, John A. De Goesj...@n-brain.net wrote:

 JVM 7 has tail calls, and if you don't want to wait for that, goto works
 perfectly well for self-recursive functions. Other techniques can deal with
 mutual recursion, albeit at the cost of performance.

 Regards,

 John A. De Goes
 N-Brain, Inc.
 The Evolution of Collaboration

 http://www.n-brain.net    |    877-376-2724 x 101

 On Jun 26, 2009, at 6:26 AM, Maarten Hazewinkel wrote:


 On 26 Jun 2009, at 14:09, Timo B. Hübel wrote:

 And here comes my question: If there is anybody with proper knowledge
 about
 this issue, I would really like to know what are those things that are
 missing? For example, Clojure lacks proper tail recrusion optimization
 due to
 some missing functionality in the JVM. But does anybody know the details?

 Basically, the JVM lacks a native ability to do tail calls. It does not
 have an
 instruction to remove/replace a stack frame without executing an actual
 return
 to the calling method/function.

 With the heavy use of recursion in functional programs, this is an
 important
 feature in a language implementation to avoid stack overflows.

 Some language implementations (Scala) can do partial workarounds by
 turning
 the generated code into a loop in the compiler, but this is frequently
 limited
 to only deal with self-recursive calls, and does not deal with the general
 case
 (X-calls-Y-calls-Z-calls-X...), which a proper implementation of
 tail-calls at
 the JVM level would allow.

 At the JIT level (below the JVM spec level) some implementations may
 actually do
 the tail call optimization anyway, but this is beyond the control of a
 language
 implementation, and would result in a situation where the behaviour of
 your
 program depends on particular implementations/versions/parameters of the
 JVM
 running it. That is something to be avoided if possible.


 Maarten Hazewinkel
 maarten.hazewin...@gmail.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

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


Re: [Haskell-cafe] Haskell on JVM

2009-06-26 Thread Andrew Hunter
On Fri, Jun 26, 2009 at 10:44 AM, Daniel Peeblespumpkin...@gmail.com wrote:
 Maybe the JVM could be abused so that all of the haskell code is
 within one function, so as to avoid java's notion of a function
 boundary and implement our own using just goto? Or does the JIT
 operate on entire functions at a time?


As I recall, this has been tried, but there's a limit (64k?) on
function body size that you immediately run in to.  Also, this would
seem likely to get seriously in the way of optimizations and use of
the JVM's slightly-higher-than-assembly level of abstraction.  I think
the second reason, for example, is why people (to my knowledge)
haven't tried the otherwise well suited Cheney-on-the-MTA
scheme...Stack as nursery is cute, but I think you want to work with
the JVM, not against it.

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


Re: [Haskell-cafe] Haskell on JVM

2009-06-26 Thread Claus Reinke
JVM 7 has tail calls, 


Source, please? JSR-292 seems the most likely candidate so far,
and its draft doesn't seem to mention tail calls yet. As of March
this year, the people working on tail calls for mlvm [1], which
seems to be the experimentation ground for this, did not seem to 
expect any fast route:


http://mail.openjdk.java.net/pipermail/mlvm-dev/2009-March/000405.html

There have been years of rumours and plans, so it would be 
nice to have concrete details, before any fp-on-jvm implementation

design starts to rely on this.

Claus

[1] http://openjdk.java.net/projects/mlvm/


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


Re: [Haskell-cafe] Haskell on JVM

2009-06-26 Thread John A. De Goes


I don't have a source, but I know tail calls have been implemented (in  
a patch) and tested, and at the JVM Summit everyone was saying this  
was definitely going to be released in JVM 7.


Regards,

John A. De Goes
N-Brain, Inc.
The Evolution of Collaboration

http://www.n-brain.net|877-376-2724 x 101

On Jun 26, 2009, at 11:27 AM, Claus Reinke wrote:


JVM 7 has tail calls,


Source, please? JSR-292 seems the most likely candidate so far,
and its draft doesn't seem to mention tail calls yet. As of March
this year, the people working on tail calls for mlvm [1], which
seems to be the experimentation ground for this, did not seem to  
expect any fast route:


http://mail.openjdk.java.net/pipermail/mlvm-dev/2009-March/000405.html

There have been years of rumours and plans, so it would be nice to  
have concrete details, before any fp-on-jvm implementation

design starts to rely on this.

Claus

[1] http://openjdk.java.net/projects/mlvm/




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


Re: [Haskell-cafe] Multi-module scripts

2009-06-26 Thread Gregory D. Weber
As long as OtherModule is in the same directory, Main should have no
trouble finding it.  

Do you mean like this?


$ ls
Greet.hs  hello*

$ cat hello
#!/usr/bin/env runghc

module Main where
import Greet

main = putStrLn (greet world)
 
$ cat Greet.hs 
module Greet (greet) where

greet :: String - String
greet s = hello  ++ s

$ ./hello
hello world

Greg

On 2009-Jun-26, Maurí­cio wrote:
 Is it possible to write a Haskell script that
 uses a module that is also going to be interpreted?
 Like, say:

 #!/usr/bin/runhaskell

 module Main (main) where
 import OtherModule
 main = (...)

 

 where OtherModule is available in, say, OtherModule.hs
 and not in the already compiled and installed  library?

 Thanks,
 Maurício

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

-- 
   ___   ___  __ _  
  / _ \ / _ \| || | Gregory D. Weber, Associate Professor
 / /_\// / | | | /\ | | Indiana University East
/ /_\\/ /__| | |/  \| | http://mypage.iu.edu/~gdweber/
\/\_/\___/\__/  Tel. (765) 973-8420; FAX (765) 973-8550
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] download, download-curl ...

2009-06-26 Thread Keith Sheppard
Hello Cafe,

I'm looking to make it possible for people to use urls directly in my
haskell program (TxtSushi) and I'd like your suggestions if you have
any. I really like the API's for download and download-curl, but I'm
wondering what the practical differences are between the two? Is
download-curl a replacement for download? Will it build OK on any
platform or do I have to use something like the HTTP library if I want
it to work for people with Windows? (I really like the fact that the
download APIs support FTP too though)

Thank You
Keith

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


Re: [Haskell-cafe] download, download-curl ...

2009-06-26 Thread Don Stewart
keithshep:
 Hello Cafe,
 
 I'm looking to make it possible for people to use urls directly in my
 haskell program (TxtSushi) and I'd like your suggestions if you have
 any. I really like the API's for download and download-curl, but I'm
 wondering what the practical differences are between the two? Is
 download-curl a replacement for download? Will it build OK on any
 platform or do I have to use something like the HTTP library if I want
 it to work for people with Windows? (I really like the fact that the
 download APIs support FTP too though)

They're essentially identical, but under the hood one is using curl, one
is using libdownload. libdownload isn't really portable outside of
linux.

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


[Haskell-cafe] System.Vacuum.Ubigraph

2009-06-26 Thread Cetin Sert
Hi,

The package seems to have a connection problem on my machine.

Prelude import System.Vacuum.Ubigraph
Prelude System.Vacuum.Ubigraph view (0,1)
Loading package syb ... linking ... done.
Loading package base-3.0.3.1 ... linking ... done.
Loading package parsec-2.1.0.1 ... linking ... done.
Loading package network-2.2.1.3 ... linking ... done.
Loading package array-0.2.0.0 ... linking ... done.
Loading package containers-0.2.0.1 ... linking ... done.
Loading package bytestring-0.9.1.4 ... linking ... done.
Loading package old-locale-1.0.0.1 ... linking ... done.
Loading package old-time-1.0.0.2 ... linking ... done.
Loading package pretty-1.0.1.0 ... linking ... done.
Loading package filepath-1.1.0.2 ... linking ... done.
Loading package unix-2.3.2.0 ... linking ... done.
Loading package directory-1.0.0.3 ... linking ... done.
Loading package process-1.0.1.1 ... linking ... done.
Loading package random-1.0.0.1 ... linking ... done.
Loading package haskell98 ... linking ... done.
Loading package mtl-1.1.0.2 ... linking ... done.
Loading package time-1.1.3 ... linking ... done.
Loading package vacuum-0.0.95 ... linking ... done.
Loading package HTTP-4000.0.7 ... linking ... done.
Loading package HaXml-1.13.3 ... linking ... done.
Loading package dataenc-0.13.0.0 ... linking ... done.
Loading package haxr-3000.2.1 ... linking ... done.
Loading package vacuum-ubigraph-0.1.0.3 ... linking ... done.
*** Exception: user error (Error calling ubigraph.clear: �: openFile: does
not exist (No such file or directory))

In ubigraph.clear: �: openFile: the part between clear and openFile is not
always the same character or sequence of characters!

I guess it's a problem with Network.XmlRpc.Client but couldn't locate it.
Anyone else that has (had) this problem?

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


Re: [Haskell-cafe] Haskell on JVM

2009-06-26 Thread John Meacham
On Fri, Jun 26, 2009 at 03:26:34PM +0200, Maarten Hazewinkel wrote:

 On 26 Jun 2009, at 14:09, Timo B. Hübel wrote:

 And here comes my question: If there is anybody with proper knowledge 
 about
 this issue, I would really like to know what are those things that are
 missing? For example, Clojure lacks proper tail recrusion optimization 
 due to
 some missing functionality in the JVM. But does anybody know the  
 details?

 Basically, the JVM lacks a native ability to do tail calls. It does not 
 have an
 instruction to remove/replace a stack frame without executing an actual 
 return
 to the calling method/function.

 With the heavy use of recursion in functional programs, this is an  
 important
 feature in a language implementation to avoid stack overflows.

This is part of the reason I think jhc might be a good haskell compiler
for the jvm, it requires no special tail call support of its back end.
It translates all recursion into explicit code flow operations. (even
complex things, like co-recursive functions and join points)

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] Rigid type variable error

2009-06-26 Thread Darryn
  From: 
Darryn djr...@aapt.net.au
To: 
beginn...@haskell.org
   Subject: 
Rigid type variables match error
  Date: 
Sat, 27 Jun 2009 10:18:13 +0930


Hi, I wonder if anyone can explain what is going on here and what to do
about it. I'm fairly new to Haskell, so apologies in advance if my
question seems naive. I've cut my code down to a minimum that reproduces
the problem. I receive an error in GHCI in the following code,
complaining that it cannot match the rigid type variables for the
instance definition for Ainst for the function a3. Can anyone advise
about what to do about it?


class A a where
a1 :: a
a2 :: a - a
a3 :: (B b) = b - a

class B b where
b1 :: Int - b

data (B b) = Ainst b = I | J (Ainst b) | K b

instance (B b) = A (Ainst b) where
a1 = I
--  a2 :: (B b, A a) = a - a
a2 = J
--  a3 :: (B b, A a) = b - a
a3 = K -- Error!
--  a3 = K `asTypeOf` a3   -- Error even with this!

data Binst = Val Int

instance B Binst where
b1 = Val


Test5.hs:17:9:
Couldn't match expected type `b1' against inferred type `b'
  `b1' is a rigid type variable bound by
   the instance declaration at Test5.hs:12:12
  `b' is a rigid type variable bound by
  the type signature for `a3' at Test5.hs:5:13
  Expected type: b - Ainst b1
  Inferred type: b - Ainst b
In the expression: K `asTypeOf` a3
In the definition of `a3': a3 = K `asTypeOf` a3
Failed, modules loaded: none.

Thanks in advance for any help anyone can provide.


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