Re: [JVM-B] The best way to use a JVMBridge-based module.
Status: Beta
Brought to you by:
ashley-y
From: Artem Gr <ar...@bi...> - 2006-12-23 01:00:29
|
Attached is the version of the JDBC module which displays how JVMUser monad is hidden from the user. The user is provided by the module with following methods: startJVMcp :: [FilePath] -> IO AttachedJVM jdbcDriverConnection :: String -> String -> String -> String -> AttachedJVM -> IO JConnection > Artem Gr wrote: >> What i'm currently bothered with, is the imposing requirement of the >> JVM monad on the user of the module. >> Is it possible to do (in the user code): >> >> main = runWithClasspath cp do >> jdbc <- jdbcDriverConnection ... >> callIO (mainProg jdbc) >> mainProg jdbc = do >> rs <- query "select 0 from dual" jdbc >> close jdbc >> >> That is, to wrap the created JVM monad in the "jdbc" variable and >> wrap all the JDBC functions except the jdbcDriverConnection in the IO >> monad, but make them do the JVM monad work inside. I suppose it is >> somehow possible by merging the IO and JVM monads into another monad, >> but i haven't yet used such mechanics. >> >> That is, is it possible to write the "callJVM" function, which, like >> "callIO", invokes the code inside the JVM monad (without trying to >> create a second JVM every time). |