jvm: Call JVM methods from Haskell.

[ bsd3, deprecated, ffi, java, jvm, library ] [ Propose Tags ] [ Report a vulnerability ]
Deprecated

The hackage package has been superseded by the github repository which builds with Bazel. Please see https://github.com/tweag/inline-java/tree/master/jvm#readme.


[Skip to Readme]

Modules

[Last Documentation]

  • Language
    • Language.Java
      • Language.Java.Internal
      • Language.Java.Safe
      • Language.Java.Unsafe

Flags

Automatic Flags
NameDescriptionDefault
linear-types

Build the linear types interface.

Disabled

Use -f <flag> to enable a flag, or -f -<flag> to disable that flag. More info

Downloads

Note: This package has metadata revisions in the cabal description newer than included in the tarball. To unpack the package including the revisions, use 'cabal get'.

Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees

Candidates

  • No Candidates
Versions [RSS] 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.0.1, 0.4.1, 0.4.2, 0.5.0, 0.6.0 (info)
Dependencies base (>=4.14 && <5), bytestring (>=0.10), choice (>=0.1), constraints (>=0.8), distributed-closure (>=0.3), exceptions (>=0.8), jni (>=0.8.0 && <0.9), linear-base (==0.1.0.0), singletons (>=2.6), template-haskell, text (>=1.2), vector (>=0.11) [details]
License BSD-3-Clause
Copyright 2015-2016 EURL Tweag.
Author Tweag I/O
Maintainer m@tweag.io
Revised Revision 2 made by FacundoDominguez at 2021-05-04T14:58:05Z
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 FacundoDominguez at 2020-11-30T14:51:01Z
Distributions
Reverse Dependencies 4 direct, 1 indirect [details]
Downloads 7199 total (27 in the last 30 days)
Rating (no votes yet) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Docs not available [build log]
All reported builds failed as of 2020-11-30 [all 3 reports]

Readme for jvm-0.6.0

[back to package description]

jvm: Call any JVM function from Haskell

jvm on Stackage LTS jvm on Stackage Nightly

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.

Example

Graphical Hello World using Java Swing:

{-# LANGUAGE DataKinds #-}
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE UndecidableInstances #-}

import Data.Text (Text)
import Language.Java

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

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