
15 Feb
2007
15 Feb
'07
3:16 p.m.
mark@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