-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Java interop via inline Java code in Haskell modules. -- -- Please see README.md. @package inline-java @version 0.9.0 -- | This module contains Cabal Setup.hs hooks to set the -- CLASSPATH to use when compiling inline code. The -- CLASSPATH environment variable specifies where to find JVM -- package dependencies, such as third party packages downloaded from -- Maven Central. -- -- You can set the CLASSPATH manually, or extract one from an -- external build system configuration. Currently supported build -- systems: -- --
-- {-# LANGUAGE DataKinds #-}
-- {-# LANGUAGE QuasiQuotes #-}
-- module Object where
--
-- import Language.Java as J
-- import Language.Java.Inline
--
-- newtype Object = Object (J ('Class "java.lang.Object"))
-- instance Coercible Object
--
-- clone :: Object -> IO Object
-- clone obj = [java| $obj.clone() |]
--
-- equals :: Object -> Object -> IO Bool
-- equals obj1 obj2 = [java| $obj1.equals($obj2) |]
--
-- ...
--
module Language.Java.Inline.Internal
javaWithConfig :: QQConfig -> QuasiQuoter
-- | Customizes how quasiquotations are desugared.
data QQConfig
QQConfig :: Name -> ([ExpQ] -> ExpQ) -> (ExpQ -> ExpQ) -> QQConfig
-- | This is the name of the function to use to indicate to the plugin the
-- presence of a java quasiquotation.
[qqMarker] :: QQConfig -> Name
-- | This produces the call invoke the Java stub. It takes the list of
-- arguments that should be passed to the call.
[qqCallStatic] :: QQConfig -> [ExpQ] -> ExpQ
-- | This is given as argument the invocation of the Java stub, and is
-- expected to prepend it with code that ensures that the stub is
-- previously loaded in the JVM.
[qqWrapMarker] :: QQConfig -> ExpQ -> ExpQ
-- | Declares import statements to be included in the java
-- compilation unit. e.g.
--
-- -- imports "java.util.*" --imports :: String -> Q [Dec] -- | Idempotent action that loads all wrappers in every module of the -- current program into the JVM. You shouldn't need to call this -- yourself. loadJavaWrappers :: IO () module Language.Java.Inline.Internal.QQMarker -- | A function to indicate to the plugin the occurrence of java -- quasiquotations qqMarker :: forall k (args_tys :: k) tyres (input :: Symbol) (mname :: Symbol) (antiqs :: Symbol) (line :: Nat) args_tuple b m. (tyres ~ Ty b, Coercibles args_tuple args_tys, Coercible b, HasCallStack) => Proxy input -> Proxy mname -> Proxy antiqs -> Proxy line -> args_tuple -> Proxy args_tys -> (args_tuple -> m b) -> m b class Coercibles xs (tys :: k) | xs -> tys instance Language.Java.Inline.Internal.QQMarker.Coercibles () () instance forall k (ty :: Foreign.JNI.Types.JType) x xs (tys :: k). (ty GHC.Types.~ Language.Java.Unsafe.Ty x, Language.Java.Unsafe.Coercible x, Language.Java.Inline.Internal.QQMarker.Coercibles xs tys) => Language.Java.Inline.Internal.QQMarker.Coercibles (x, xs) '(ty, tys) module Language.Java.Inline.Internal.QQMarker.Names -- | Get the names of all markers used for java quasiquotations. getQQMarkers :: CoreM [Name] -- | This plugin generates Java bytecode from modules using the java -- QuasiQuoter and inserts it in a global bytecode table from where it is -- loaded at runtime. module Language.Java.Inline.Plugin plugin :: Plugin -- |
-- {-# LANGUAGE DataKinds #-}
-- {-# LANGUAGE QuasiQuotes #-}
-- module Object where
--
-- import Language.Java as J
-- import Language.Java.Inline.Unsafe
--
-- newtype Object = Object (J ('Class "java.lang.Object"))
-- instance Coercible Object
--
-- clone :: Object -> IO Object
-- clone obj = [java| $obj.clone() |]
--
-- equals :: Object -> Object -> IO Bool
-- equals obj1 obj2 = [java| $obj1.equals($obj2) |]
--
-- ...
--
--
-- The functions in this module are considered unsafe in opposition to
-- those in Language.Java.Inline.Safe, which ensure that local
-- references are not leaked.
module Language.Java.Inline.Unsafe
-- | Java code quasiquoter. Example:
--
--
-- imports "javax.swing.JOptionPane"
--
-- hello :: IO ()
-- hello = do
-- message <- reflect ("Hello World!" :: Text)
-- [java| JOptionPane.showMessageDialog(null, $message) |]
--
--
-- A quasiquote is a snippet of Java code. The code is assumed to be a
-- block (sequence of statements) if the first non whitespace character
-- is a { (curly brace) character. Otherwise it's parsed as an
-- expression. Variables with an initial $ (dollar) sign are
-- allowed. They have a special meaning: they stand for antiqotation
-- variables (think of them as format specifiers in printf format
-- string). An antiquotation variable $foo is well-scoped if
-- there exists a variable with the name foo in the Haskell
-- context of the quasiquote, whose type is Coercible to a Java
-- primitive or reference type.
java :: QuasiQuoter
-- | Declares import statements to be included in the java
-- compilation unit. e.g.
--
-- -- imports "java.util.*" --imports :: String -> Q [Dec] -- | Idempotent action that loads all wrappers in every module of the -- current program into the JVM. You shouldn't need to call this -- yourself. loadJavaWrappers :: IO () -- | This module reexports Language.Java.Inline.Unsafe. module Language.Java.Inline