Is there a good way to write a program in ML and then wrap it in a graphical interface written in Java?
I don't know if this is suitable for small applications, but it is definitely a way that works for a large IDE style: Isabelle / ML vs Isabelle / Scala / JVM. This is an interactive theoretical verification application, but simple SML programming is a trivial instance of this in a way.
So, you can write the base code of Isabelle / ML, which emits some messages in the style of the old-fashioned REPL, but the output can be interpreted by the GUI components on the JVM side. Isabelle / jEdit does this for regular printing of colored text with a small amount of rich text (sub / superscript and bold).
Regarding explicitly recoding function values by pipe / socket as strings: this is quite simple in Isabelle / ML / Scala, due to some imitation of how SML will represent typed values in untyped memory, but using untyped XML trees instead of bits. The XML transfer syntax is specific to simplify simple use: YXML instead of official XML that is human readable. All this fits into approx. 8,000 bytes of SML source - I am tempted to publish the sources here, but it’s better to search the Internet for “Isabelle YXML” or “YXML PIDE”.
Since Scala / only the JVM is referred to as a standalone alternative: it definitely works, Scala is also very powerful and flexible in imitating many programming styles (oriented to a higher-order functional object), but for complex symbolic applications as a proof of the theorem, it just does not achieve purity and SML stability. (Note that the underlying SML platform here is Poly / ML.)
source share