10

I started learning Standard ML recently out of curiosity. So what I know is that is has an efficient compiler (MLton) which allows us to freely use abstractions without worrying about performance.

It would be perfect if I could do some GUI programming with Standard ML, too. Is there anything like Gtk, Qt, or WxWidgets binding for Standard ML?

Thank you very much.

Phil
  • 5,595
  • 5
  • 35
  • 55
  • 3
    You'd have better luck with OCaml, which is a more widely used ML variant (outside of academia). If you're willing to make a larger leap away from SML, Haskell has excellent GUI toolkits too. – ephemient Oct 23 '09 at 21:05
  • Oh thanks. I already learned Haskell, though not much with the GUI stuff. I was curious about SML just in case I needed performance that could compare with C, lol. – Phil Oct 29 '09 at 00:09

3 Answers3

7

Here's a paper describing the mGTK project, which is a Standard ML binding to GTK. There are also a couple of interfaces to OpenGL, although this is more 2 and 3D graphics-oriented rather than specifically a GUI toolkit. eXene is a toolkit for X Windows. sml_tk is an interface to Tk.

ire_and_curses
  • 68,372
  • 23
  • 116
  • 141
  • 1
    Thanks. I also did some googling and found the mGTK and SML-Gtk projects, but it looked like they haven't been updated for a long time :( – Phil Oct 11 '09 at 08:52
3

There are bindings for foreign toolkits, but the eXene toolkit was designed to be native for SML and to exploit the features of Concurrent ML. I used it years ago and found it a very smooth fit for the language and a pleasure to use. But it does not have the ginormous library of components that you find in the more widely used toolkits.

Norman Ramsey
  • 198,648
  • 61
  • 360
  • 533
0

Giraffe Library provides SML bindings to libraries that support GObject Introspection, which includes GTK. At the time of writing, bindings are available for the GTK 3 stack. Although the cairo graphics library does not support GObject Introspection, Giraffe Library provides bindings to some cairo functions.

Although SML has a very precise definition, the definition does not include an FFI, and there is considerable variation between compilers. At the time of writing, Giraffe Library supports only the FFIs of MLton and Poly/ML.