@hackage inline-java0.5
Java interop via inline Java code in Haskell modules.
Deprecated
Dependencies (20)
- base >4.9.0.0 && <5
- binary >=0.7
- bytestring >=0.10
- containers >=0.5
- distributed-closure >=0.3
- filepath >=1 Show all…
Dependents (3)
@hackage/jvm-streaming, @hackage/jvm-batching, @hackage/sparkle
inline-java: Call any JVM function from Haskell
NOTE: you'll need GHC >= 8.0.2 to compile and use this package. Use
stack --nix --stack-yaml stack-HEAD.yaml build ahead of a new GHC
release.
The Haskell standard includes a native foreign function interface
(FFI). It can be a pain to use and in any case only C support is
implemented in GHC. inline-java lets you call any JVM function
directly, from Haskell, without the need to write your own foreign
import declarations using the FFI. In the style of inline-c for C and
inline-r for calling R, inline-java lets you name any function to
call inline in your code.
Example
Graphical Hello World using Java Swing:
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE QuasiQuotes #-}
{-# LANGUAGE ScopedTypeVariables #-}
module Main where
import Data.Int
import Language.Java
import Language.Java.Inline
main :: IO Int32
main = withJVM [] $ do
message <- reflect "Hello World!"
[java| { javax.swing.JOptionPane.showMessageDialog(null, $message);
return 0; } |]
License
Copyright (c) 2015-2016 EURL Tweag.
All rights reserved.
inline-java is free software, and may be redistributed under the terms specified in the LICENSE file.
About

inline-java is maintained by Tweag I/O.
Have questions? Need help? Tweet at @tweagio.