[Haskell-cafe] LambdaVM (was Re: Lambada and connecting Haskell to a Weblogic server)

Daniil Elovkov daniil.elovkov at googlemail.com
Mon Feb 19 16:27:04 EST 2007


Hello Brian

I wrote you on this just some hours ago, before I had looked through
haskell-cafe! That's an interesting coincidence!

Anyway, moving my questions here.

1.
How easy is it to interoperate with Java code (call methods, pass Java
objects) for Haskell code run by LambdaVM rts? And vice versa, can
Haskell code be called in a more flexible way than calling Main.main
with String[] ?

Looking at the discussion, I see that foreign import works great. What
about foreign export?

1a.
What about types? It seems like Bool in your example is automatically
mapped to java type boolean. And in the  Adam Megacz's example, where
and how are JTree and JString defined?

2.
As far as I understand, currently, GHC doesn't allow to catch
out-of-memory exception in any way, it simpy exits. This prevents from
gracefully catching this error in Java code (JVM terminates), unlike
many other errors, like paterrn match failure, undefined, etc.
Is this error reported like a Java exception in LambdaVM rts?


2007/2/15, Brian Alliet <brian at brianweb.net>:
> On Thu, Feb 15, 2007 at 02:53:47PM -0500, Mark T.B. Carroll wrote:
> > Is it easy to create Haskell stubs (in the IO monad, presumably) for
> > standard Java libraries so that your compiled-to-JVM Haskell code can
> > easily use the usual Java APIs like Swing? One source of vexation for us
> > is mapping between Java types and Haskell types.
>
> Yep. Normal FFI style foreign imports work.
>
> foreign import jvm unsafe "java.lang.Character.isDigit" isDigit :: Int -> Bool
>


More information about the Haskell-Cafe mailing list