jvm: Call JVM methods from Haskell.

[ bsd3, ffi, java, jvm, library ] [ Propose Tags ]

Please see README.md.

[Skip to Readme]
Versions [faq] 0.1, 0.1.1, 0.1.2, 0.2.0, 0.2.1, 0.2.2, 0.3.0, 0.4.0,, 0.4.1, 0.4.2 (info)
Dependencies base (>=4.7 && <5), bytestring (>=0.10), distributed-closure (>=0.3), jni (>=0.1), singletons (>=2.0), text (>=1.2), vector (>=0.11) [details]
License BSD-3-Clause
Copyright 2015-2016 EURL Tweag.
Author Tweag I/O
Maintainer m@tweag.io
Category FFI, JVM, Java
Home page http://github.com/tweag/inline-java/tree/master/jvm#readme
Source repo head: git clone https://github.com/tweag/inline-java(jvm)
Uploaded by MathieuBoespflug at Wed Oct 19 14:08:28 UTC 2016
Distributions NixOS:0.4.2
Downloads 4408 total (254 in the last 30 days)
Rating (no votes yet) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Hackage Matrix CI
Docs not available [build log]
All reported builds failed as of 2016-11-14 [all 4 reports]


  • Language
    • Language.Java


Maintainer's Corner

For package maintainers and hackage trustees

Readme for jvm-0.1

[back to package description]

jvm: Call any JVM function from Haskell

This package enables calling any JVM function from Haskell. If you'd like to call JVM methods using Java syntax and hence get the Java compiler to scope check and type check all your foreign calls, see inline-java, which builds on top of this package.


Graphical Hello World using Java Swing:

{-# LANGUAGE DataKinds #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE OverloadedStrings #-}

import Data.Text (Text)
import Language.Java

newtype JOptionPane = JOptionPane (J ('Class "javax.swing.JOptionPane"))
instance Coercible JOptionPane ('Class "javax.swing.JOptionPane")

main :: IO ()
main = withJVM [] $ do
    message <- reflect ("Hello World!" :: Text)
      (classOf (undefined :: JOptionPane))
      [JObject nullComponent, JObject (upcast message)]
    nullComponent :: J ('Class "java.awt.Component")
    nullComponent = jnull