[Haskell-cafe] Re: Lambada and connecting Haskell to a Weblogic server

Adam Megacz megacz at cs.berkeley.edu
Thu Feb 15 15:16:34 EST 2007


mark at ixod.org (Mark T.B. Carroll) writes:
> 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.

Unbelievably easy -- check out his source code.  It works just like the
C FFI.

...
foreign import jvm safe "getHead" getHead :: JTree -> IO (Object a)
foreign import jvm safe "child" getChild :: JTree -> Int32 -> IO JTree
foreign import jvm safe "size" size :: JTree -> IO Int32
foreign import jvm safe "toString" jtoString :: (Object a) -> IO JString
...

  - a

-- 
PGP/GPG: 5C9F F366 C9CF 2145 E770  B1B8 EFB1 462D A146 C380



More information about the Haskell-Cafe mailing list