The Standard ML Programming Language
-*-Org-*-
Table of Contents
1 Overview of Standard ML (SML)
SML is a procedural computer programming language with extremely strong support for higher-order functions and abstraction. It is often called a “functional” language, and it can be used that way, but SML is an imperative language with mutable storage and side effects.
In syntax and semantics, SML stays fairly close to the λ-calculus. For example, just like in the λ-calculus, each function in SML has exactly 1 argument, so if you want to pass more than one thing you need to pack them all together into a data structure.
SML is called a “strongly typed” language, because each type has a well defined meaning which is enforced by SML's typing rules. Because the meanings of types exclude the possibility of ill-defined behavior, it is said that “a well typed SML program can not go wrong”. Although an SML program can (correctly) exit due to an exception if one is raised and not caught, this behavior will be strictly according to the rules rather than being unpredictable.
An SML implementation will automatically calculate most of the types used by a program, and typically very few types need to be written by a programmer.
You can learn about SML from the following resources.
- http://www.standardml.org/
This web site is hosted as part of the “sml” SourceForge project, so the URL http://www.standardml.org/ reaches the same web pages as http://sml.sourceforge.net/.
- Other things in the “sml” SourceForge project
This SourceForge project is intended to support cooperation among SML compiler teams.
This SourceForge project also hosts two mailing: sml-implementers and sml-list. Unfortunately, these two mailing lists appear to have fallen victim to heavy spamming and their archives are full of spam.
It appears at one point there was an intention to use the CVS repository of this SourceForge project for sharing tests and benchmarks among the various SML compiler projects, but very little has been added.
- Other things in the “sml” SourceForge project
- Standard ML @ Wikipedia
- Standard ML Language @ Scholarpedia
- Overview of “The Standard ML Language” (@ LFCS)
- A wiki page extolling the virtues of SML (by Adam Chlipala)
- Comp.Lang.ML FAQ (formerly monthly USENET posting) (not updated since 2005, but still has useful information)
- Comparisons of SML with other similar languages
- Comparison of OCaml with SML and MLton (@ MLton)
- Standard ML and Objective Caml, Side by Side (by Andreas Rossberg)
- Hyperpolyglot: Type Inference Languages: Standard ML, OCaml, Scala, Haskell: a side-by-side reference sheet
WARNING: The table of features on this web page is missing a lot of entries for SML.
Despite the problems with the table, at the end of this web page can be found a nice collection of material on the history of SML. Among other things, there are links here to all issues of Polymorphism newsletter, which includes several early proposals for the SML standard.
- Comparison of OCaml with SML and MLton (@ MLton)
2 Implementations of SML
- NOTE: This list only includes SML implementations that have been made available to the public.
- “REPL”: This means an interactive top-level “read-eval-print loop”, which allows the user to type individual top-level SML declarations and have them parsed, type checked, and executed (either interpreted, or compiled and then run as machine code), and then have the results pretty printed. After processing each declaration, the REPL will ask the user for more.
- “FFI”: This means a “foreign function interface”, generally the ability to call functions in C libraries, but sometimes the ability to call other languages, and sometimes the ability to have SML called from other languages.
- General-purpose non-proprietary implementations
- MLton
- REPL: no
- Compilation, building multi-file programs, and execution model
- Building of multi-file projects is specified with special ML Basis files.
- SUPPLY MORE DETAILS
- Development support
- Profiler.
- Some support for Emacs integration (beyond what Emacs SML Mode already provides).
- External library bindings: no non-SML library bindings are supplied as standard with MLton
(Is there a collection of them somewhere?)
- FFI
- FFI (#1)
- Allows calling C from SML, and SML from C.
- Allows turning SML into a library that can be called from C (or any other language that can call C libraries?).
- ML-NLFFI
- This is a port of NLFFI from SML/NJ. You can do everything with ML-NLFFI that NLFFI can do.
- The interfaces of NLFFI is almost completely compatible with ML-NLFFI. Only quite strange SML code would detect the difference.
- FFI (#1)
- Variations to SML: very few differences from SML 1997
- Support
- Mailing lists (MLton-user@MLton.org, MLton@MLton.org)
- Documentation
- Wiki (their entire web site is a wiki)
- Source code repository
- No bug tracker?
- Mailing lists (MLton-user@MLton.org, MLton@MLton.org)
- REPL: no
- Standard ML of New Jersey (SML/NJ)
- REPL: yes
- Compilation, building multi-file programs, and execution model
- CM (SML/NJ's compilation manager)
- SUPPLY MORE DETAILS
- CM (SML/NJ's compilation manager)
- Support
- Riccardo Pucella's Notes on Programming SML/NJ ([2001-01-10])
- Mailing lists (smlnj-list@lists.sourceforge.net, smlnj-dev-list@lists.sourceforge.net)
- Source code repository
- Bug tracker
- Documentation
- SUPPLY MORE DETAILS
- Riccardo Pucella's Notes on Programming SML/NJ ([2001-01-10])
- FFI
- SML/NJ-C
This FFI has these advantages:
- simple interface (relatively speaking)
- C can call SML (after first being called from SML, I think, i.e., you can't have a C main)
The disadvantages:
- The SML run-time support code must have the list of C functions that can be called compiled into it. You have to edit some files in the SML/NJ source code and recompile SML/NJ if you need access to additional C functions.
- The interface is simple, i.e., only a restricted set of data types can be passed across the SML/C boundary as function arguments or returned results.
- Anything complex passed to C must be presumed to live forever and can not be garbage collected. This mainly means SML function closures (because this FFI can't really pass other complex things?).
- NLFFI (“No-Longer-Foreign Function Interface”)
Advantages:
- Can build and handle arbitrary C data structures in SML code.
- Can load C libraries and find functions/variables in them at run-time. You never need to recompile SML/NJ (provided it was built with NLFFI support).
- Can manage memory of C data structures. If you know something is not used, you can free it.
Disadvantages:
- Very complex types (but presumably a type error slicer will help a lot here).
- No support for calling SML from C (I think). In principle, you could use the same method the other FFI uses to wrap SML closures so they can be called from C, but you would have to do it by hand.
- Must manage memory of C data structures.
- SML/NJ-C
- Variations to SML
See the SML/NJ list of special features and the list of SML/NJ deviations on the MLton web site.
- Limitations and errors
- Disallows multiple uses of “where” on signatures with the same name.
- Implements multiple simultaneous “withtype” incorrectly.
- Disallows non-datatype uses of datatype replication.
- Disallows certain cases of “sharing”.
- Handles the value polymorphism restriction incorrectly in some cases.
- Assigns overly liberal types to some things in the standard basis library.
- Extensions
- Allows some additional flexibility that is contrary to SML 1997.
- Vector syntax, or-patterns.
- Allows higher-order functors.
- Supports quasiquotation.
- Supports lazy evaluation of datatypes. You must do (Control.lazysml := true) to enable this. Then you have a “lazy” keyword that can be used with datatype definitions.
- SUPPLY FURTHER DETAILS
- Limitations and errors
- REPL: yes
- Poly/ML
- REPL: yes
- FFI: CInterface
- Development support
- Debugger
- PolyML jEdit Plugin (via PolyML IDE protocol)
- Debugger
- External library bindings
- Support
- Mailing list: polyml@inf.ed.ac.uk
- Mailing list: polyml@inf.ed.ac.uk
- some Poly/ML-related projects
- PolyChrome (Firefox extension to use PolyML instead of JavaScript, and SML FFI to JavaScript)
- PolyChrome (Firefox extension to use PolyML instead of JavaScript, and SML FFI to JavaScript)
- REPL: yes
- Moscow ML CORRECT URL?: http://www.itu.dk/people/sestoft/mosml.html
- REPL: yes??? VERIFY
- Development support: nothing special, use Emacs VERIFY
- FFI: yes
- External library bindings
- Comes with library bindings to Gdimage, PostgreSQL, MySQL, POSIX regular expressions, sockets (Socket, different from the SML Basis Library), GNU gdbm, etc.
- Variations to SML
- Limitations
- Moscow ML does not strictly obey SML 1997 for the dynamic semantics, because it evaluates arguments in a different order.
- In the Moscow ML library, the implementations of TextIO, Array, and Vector do not conform to the SML Basis Library standard (according to Norman Ramsey).
- Extensions
- Moscow ML extends SML 1997 with higher-order functors, first-class modules (functors and structures), and recursive signatures and structures.
- Supports quasiquotation.
- Limitations
- REPL: yes??? VERIFY
- ML Kit (with Regions)
- REPL: ??? CHECK
- Development support: nothing special, use Emacs VERIFY
- FFI: yes
- Variations to SML
- Supports quasiquotation (with –quotation command-line option).
- Support
- ML Kit documentation
Programming with Regions in the MLKit (Revised for Version 4.3.0). Mads Tofte, Lars Birkedal, Martin Elsman, Niels Hallenberg, Tommy Højfeld Olesen, and Peter Sestoft. IT University of Copenhagen. 2006-01.
- ML Kit SourceForge project (where the source code is kept)
- ML Kit documentation
- ML Kit version 1 (1993)
The ML Kit described above is “the ML Kit with Regions” which first arrived around 1997. Its predecessor is now known as the ML Kit version 1, and it was described in the announcement as follows:
“The ML Kit is a straight translation of the Definition of Standard ML into a collection of Standard ML modules. For example, every inference rule in the Definition is translated into a small piece of Standard ML code which implements it. The translation has been done with as little originality as possible – even variable conventions from the Definition are carried straight over to the Kit.
If you are primarily interested in executing Standard ML programs efficiently, the ML Kit is not the system for you! (It uses a lot of space and is very slow.) The Kit is intended as a tool box for those people in the programming language community who may want a self-contained parser or type checker for full Standard ML but do not want to understand the clever bits of a high-performance compiler. We have tried to write simple code and module interfaces; we have not paid any attention to efficiency.”
- REPL: ??? CHECK
- SML# (change history)
- Alice ML
- REPL: yes
- Development support
- Comes with a GUI interface for the interactive top-level. Includes auto-updating data inspector windows.
- Alice can also be used with SML Mode for Emacs with Alice patches.
- External library bindings
- GUI: supplied by these structures: Gtk, GLib, Pango, Atk, Gdk, Canvas
- Database: structure SQLite
- XML: structure XML, a binding for libxml2
- FFI: ??? SUPPLY DETAILS
- Support
- Mailing lists (alice-announce@ps.uni-sb.de, alice-users@ps.uni-sb.de)
- Bug tracker (Bugzilla)
- Wiki
- Mailing lists (alice-announce@ps.uni-sb.de, alice-users@ps.uni-sb.de)
- Variations to SML
See these documentation pages: limitations, incompatibilities, sugar, futures, packages, modules, types.
- Limitations
- No overloading of literal constants (e.g., 1 can not have type Int64.int).
- Some things are missing from the standard basis library.
- Valid SML 1997 code can fail in Alice ML due to variations in how functors, structures, and datatypes work, additional reserved words, extra material in the standard basis library, additional syntax for line comments, and the effect of concurrent futures on the exhaustiveness of pattern matching.
- Datatypes are structural (like SML's records) rather than generative. This can be seen as a feature.
- Extensions
- Many additional syntax options (improvements).
- Can create recursive/cyclic values without needing to use ref cells.
- User-defined extensible sum types (like SML's single built-in “exn” type).
- Futures (concurrent, lazy, promised).
- Stronger modules: first-class, higher-order, local.
- (De)serialization/(un)pickling/(un)marshalling of module values with dynamic type checking to allow storing them in files and sending them over the network.
- Limitations
- Compilation, building multi-file programs, and execution model
- Notion of “component”, with “imports” and “exports”.
- SML files become “components” by prefixing them with import announcements, or these import announcements can go in a separate file (for compatibility with other SML compilers).
- Component manager runs compiled code on Alice virtual machine, which includes JIT compiler that generates either x86 native code or bytecode. WTF?
- Components are loaded lazily, on demand, and can even be computed at run-time as first-class values of the language.
- REPL: yes
- MLton
- Specialized implementations
- SMLserver: Apache module implemented in SML that allows generating web pages via SML (compiles SML to byte code, is a modification of ML Kit)
- SMLtojs: SML compiler targeting JavaScript (is a modification of ML Kit)
- Extended ML
- Extended Moscow ML
- The EML Kit (pre-1997 SML, based on an old version of the ML Kit)
- Extended Moscow ML
- Embedded ML: SML to C and/or Forth (“home”)
This compiles Standard ML to C and/or Forth for running on very small machines.
- SMLserver: Apache module implemented in SML that allows generating web pages via SML (compiles SML to byte code, is a modification of ML Kit)
- Research implementations
- HaMLet and HaMLet-S
- TIL and TILT CHECK
- Fox ML (a modified SML/NJ 0.93)
- DML: Dependent ML: SML plus fancier types for verification (obsoleted by ATS, which is no longer SML)
dmoz.org writes:
“Conservative ML extension, has type system to enrich ML with restricted form of dependent types, to allow many interesting program properties: memory safety, termination can be captured in type system and thus be verified while compiling.”
- Extensible ML CHECK
Extensible ML (EML) is an ML-like programming language that adds support for object-oriented idioms in a functional setting. EML extends ML-style datatypes and functions with a class construct designed to be extended into hierarchies, thus allowing the programmer to seamlessly integrate the object-oriented programming paradigm with the traditional functional style.
Extensible ML is related neither to the programming language Extended ML (other than being similarly derived from ML), nor to the specification language eXtensible Markup Language, nor to extensible programming.
Millstein, Bleckner, Chambers. Modular typechecking for hierarchically extensible datatypes and functions. Proceedings of the seventh ACM SIGPLAN international conference on Functional programming, ACM Press, 2002.
- SML/E
This is Dominic Duggan's extension of SML/NJ with type error explanation.
- HaMLet and HaMLet-S
- Limited implementations (not full SML, or pre-1997 SML, or no longer available, or obsolete, or not fully working, or dependent on proprietary software)
- SML.NET
- REPL: no
- Development support
- Proprietary integration with Visual Studio (Microsoft)
- Inspection of types of spots in SML source code
- “.NET APIs are shown with their ML types”
- Continuous type inference
- Basic support for debugger
- FFI: anything written in other languages for CLR (Microsoft) but using CLR types only
- Variations from SML
- Limitations: “very minor discrepancies” (not described) from SML 1997
- Extensions: support for using the .NET framework (Microsoft)
- Limitations: “very minor discrepancies” (not described) from SML 1997
- License: compiler libre, but Visual Studio support proprietary and without source
- Support
- REPL: no
- Poplog (main web page? other main web page? SourceForge project page)
- Poplog ML (modified Standard ML 1990)
- Poplog ML (modified Standard ML 1990)
- MLj (parts of module language missing (no functors), extensions for accessing Java, tail calls are not optimized into simple jumps)
MLj compiles SML into bytecode that runs on the JVM.
It seems that the company that developed it (Persimmon IT) is defunct and sold out to Microsoft which converted the code base to target the .NET platform instead, resulting in SML.NET. At least that is my conclusion reading between the lines of the MLj web page.
- sml2c: Standard ML to C compiler (pre-1997 SML)
Based on an old version of SML/NJ from 1992 (version 0.67?).
- An implementation in PLT Scheme (now called Racket) of SML except for types
- Harlequin MLWorks (proprietary SML 1997 implementation, company now defunct, no longer available)
Some details (and a .zip file download of personal edition?) can be found here:
http://web.archive.org/web/20030801205546/http://burks.bton.ac.uk/burks/language/ml/index.htm
- ML server pages (functionality obsoleted by SMLserver)
Web page which is not working properly but is sort of readable: http://ellemose.dina.kvl.dk/~sestoft/msp/index.msp
Directory currently ([2011-09-30]) containing everything except the .msp page mentioned just above: http://www.itu.dk/people/sestoft/msp/
Author's current home page: http://www.itu.dk/people/sestoft/index.html
- Edinburgh Standard ML (core language only, predates 1997, so is therefore only for first version of standard)
- MicroML (a.k.a. uML) (pre-1997 SML, partial SML (no modules, no records))
Look at the files with names beginning with “uml” in this FTP directory: ftp://ftp.cs.umu.se/pub/
The code is very sparsely commented.
- ExSML
ExSML is a port of Moscow ML to use LLVM as its back end, replacing Moscow ML's CaML-derived back end. It seems to have gotten stuck in mid-2009 before finishing.
- http://jlouisramblings.blogspot.com/2009/07/using-twelf-to-lift-code-quality-in.html
- http://jlouisramblings.blogspot.com/2009/03/update-on-moscow-ml-for-llvm.html
- http://jlouisramblings.blogspot.com/2009/03/llvm-update.html
- http://jlouisramblings.blogspot.com/2009/01/ripping-backend-from-moscow-ml.html
- SML.NET
3 SML libraries
- The SML Basis Library
- The SML/NJ library
Most SML implementations (not just SML/NJ) include the SML/NJ library which provides a number of additional useful features not included in the standard basis.
The SML/NJ web site has partial documentation for the SML/NJ library.
Unfortunately, there are some features in the SML/NJ library that are only currently documented in the source code. The important files to read are the ones containing the definitions of signatures, which are generally well commented. It is worthwhile to fetch and unpack the source code for the SML/NJ library for a recent working version of SML/NJ to get these signature files. You unpack this file with a command like this:
tar xfz smlnj-lib.tgz
See also http://www.daimi.au.dk/designCPN/sml/libs/smlnj.html.
- The Edinburgh SML Library WTF?
Dave Berry LFCS Report Series ECS-LFCS-91-148
http://www.lfcs.inf.ed.ac.uk/reports/91/ECS-LFCS-91-148/
“It is distributed with Poly/ML, Poplog ML and Standard ML of New Jersey.” WTF?
Source can be found here: http://www.daimi.au.dk/designCPN/sml/libs/esml.html
Source can also be found at this location:
http://www.cs.bham.ac.uk/research/projects/poplog/src/master/contrib/pml/smllib/library/
Unfortunately, that location doesn't include the SML/NJ and Poly/ML compatibility code, only the Poplog ML compatibility code.
Lessons from the design of a Standard ML library Dave Berry Journal of Functional Programming (1993), 3: 527-552 DOI: 10.1017/S0956796800000873
- Big lists of links to SML libraries
- Lucas Dixon's list of SML libraries (maintained for the Poly/ML subgroup of the Mathematical Reasoning Group at U. Edinburgh)
- Magnus Jonsson's list of SML libraries
- The MLton project's library list
- The SML# project's list of substantial tools (partly libraries)
At this site are listed these:
- SMLFormat: pretty printer generator for Standard ML
- SMLDoc: documentation generator for Standard ML
- SMLUnit: regression testing framework for Standard ML
- Standard ML Basis test suite
- Lucas Dixon's list of SML libraries (maintained for the Poly/ML subgroup of the Mathematical Reasoning Group at U. Edinburgh)
- Significant individual libraries
- fxp: Functional XML Parser: fully featured XML parser in SML
- LMLML — Library of MultiLingualization for ML (heavy duty character set support)
- QCheck (semi-automatic unit test support) (github)
- fxp: Functional XML Parser: fully featured XML parser in SML
- GUI interfaces
- mGTK (binding to Gtk+ for Moscow ML and MLton) (paper)
You have to look at the project page to find the latest version, which is not linked from the home page.
- some work to connect MLton to OpenGL
- eXene (Stoughton home page) (older Reppy home page)
- smltk (works via “wish” (Tcl/Tk windowing shell) as subprocess)
- SML3d (OpenGL-based graphics, currently for MLton only)
- SML-Gtk (bindings to Gtk+ for SML/NJ, uses NLFFI)
- http://www.tardis.ed.ac.uk/~skc/VisualML.htmld/][Visual ML]]
- mGTK (binding to Gtk+ for Moscow ML and MLton) (paper)
- Big libraries and/or collections of SML modules
- isaplib: Isabelle/IsaPlanner SML Library (for PolyML)
- sml-ext (@ GitHub)
WARNING: Avoid the obsolete old location of sml-ext at googlecode.
- sml-lib (via Subversion @ SourceForge)
This is contained within the Tom 7 Misc SourceForge project, which also contains some other SML stuff (and also some C++ stuff).
WARNING: Avoid the obsolete old location of sml-lib in the neighboring CVS repository (also in the Tom 7 Misc SourceForge project), because that version of sml-lib is no longer being updated.
- The MLton Library Project (“mltonlib/trunk” Subversion directory)
- The Qwertz Toolbox VERIFY
symbolic Artificial Intelligence programming
ftp.gmd.de:gmd/ai-research/Software/qwertz.tar.gz
symbols and symbolic expressions, tables including association lists, sets, queues and priority queues, streams, heuristic search including A* and iterative deepening, and an ATMS reason maintenance system.
- isaplib: Isabelle/IsaPlanner SML Library (for PolyML)
- Lists of SML users (potential sites for finding library code)
- http://mlton.org/Users (includes a short list of places teaching with SML)
- http://www.cs.princeton.edu/~appel/smlnj/projects.html (old)
- http://mlton.org/Users (includes a short list of places teaching with SML)
- Some of the other interesting collections of SML code
- Timothy Bourke's patches and documentation
This includes patches to make various libraries compile with modern SML compiler distributions:
- Reactive SML/NJ
- SML/NJ library for use with Poly/ML
- sml_tk
- fxp
- etc
There is also documentation for ML-Doc.
- Allen Leung's SML code (SML libraries, bindings to C libraries)
- http://web.archive.org/web/20071208172442/zoogie.lugatgt.org/code/
Includes:
- SML-Term-Ansi (terminal color control escape sequences)
- http://bangmoney.org/projects/sml/
Includes:
- HTTP (fetching files from URL, sample wget-like program)
- INI (parsing/making .ini files)
- URI (handling URIs)
- http://reallylongword.org/sml/
Includes:
- GetOpt (an improved version of GetOpt from the SML/NJ library that can wrap text that does not fit within column restrictions)
- VectorPair (like ListPair, but for vectors)
- http://www.hardcoreprocessing.com/Freeware/StandardMLCode.html
- Timothy Bourke's patches and documentation
4 IDE (integrated development environment) support for SML
- SML Mode for Emacs
- Skalpel: A type error slicer for SML
- Eclipse plug-in support for SML (possibly not actually working)
- http://cs.unc.edu/~narain/projects/mldev/]]
- SMLclipse: Eclipse plug-in for SML (project description in German, a small bit of code in Subversion repository)
- http://cs.unc.edu/~narain/projects/mldev/]]
5 General guidance on writing SML
6 Books and reports on SML
- Introductory textbooks
- ML for the Working Programmer. L. C. Paulson. Cambridge University Press, 1996. (@ MLton)
- Elements of ML Programming. J. Ullman. MIT Press, 1997 or 1998. CHECK DATE (@ MLton, errata)
http://rads.stackoverflow.com/amzn/click/0137903871 (check link corresponds to title/author!)
- Programming in Standard ML. R. Harper. PUT DATE (examples from book)
- The Little MLer. M. Felleisen, D. P. Friedman, D. Bibby, R. Milner. AUTHORS CORRECT? MIT Press, 1998. (@ MLton)
- Introduction to Programming using SML. M. R. Hansen, H. Rischel. Addison-Wesley, 1999. (errata, @ MLton)
http://rads.stackoverflow.com/amzn/click/0201398206 (check link corresponds to title/authors!)
- Modern Programming Languages: A Practical Introduction. (4 chapters about SML)
- Older books (pre-1997)
- Functional Programming Using Standard ML. R. Bosworth. McGraw Hill, 1995.
- Functional Programming Using SML. Å. Wikström. Prentice Hall, 1987.
- Elementary Standard ML. Greg J. Michaelson. UCL Press, 1995.
Greg warns: “… my SML material is the old standard. So there are things I do which may no longer work. In particular, I do not use the standard libraries for I/O, building everything from scratch, and I make heavy use of partial application [which often fails with the new value polymorphism restriction] …”
- Functional Programming Using Standard ML. R. Bosworth. McGraw Hill, 1995.
- ML for the Working Programmer. L. C. Paulson. Cambridge University Press, 1996. (@ MLton)
- Introductory on-line tutorials
- Programming in Standard ML '97: An On-line Tutorial. S. Gilmore. Revised 2004-03.
- A Gentle Introduction to ML. A. Cumming.
- Programming in Standard ML '97: An On-line Tutorial. S. Gilmore. Revised 2004-03.
- Introductory guides
- Tips for Computer Scientists on Standard ML (Revised). M. Tofte. Department of Computer Science, University of Copenhagen, 2009-08-30. (source code for examples)
Norman Ramsey: “Actually “extended quick-reference card” is a better description. Runs about 20 pages. Highly recommended to have with you when hacking.”
- Essentials of Standard ML Modules. M. Tofte.
- Four Lectures on Standard ML. M. Tofte. Edinburgh University, 1989.
Norman Ramsey: “A good overview of the ML language. Lecture 2 has many nice examples of use of the modules system, and lecture 3 is the best explanation I have seen of the static semantics of modules (signature matching and constraints).”
- Tutorial on Standard ML. M. Tofte. CHECK
- Tips for Computer Scientists on Standard ML (Revised). M. Tofte. Department of Computer Science, University of Copenhagen, 2009-08-30. (source code for examples)
- Advanced books
- Notes on Programming SML/NJ. Riccardo Pucella. ([2001-01-10])
- Unix System Programming with Standard ML. A. Shipman. 2001 or 2002. CHECK DATE (@ MLton)
- Concurrent Programming in ML. J. Reppy. Cambridge University Press, 1999. (@ MLton)
- Notes on Programming SML/NJ. Riccardo Pucella. ([2001-01-10])
- SML standards
- Books on functional programming in general
- Purely Functional Data Structures. C. Okasaki. Cambridge University Press, 1998 or 1999. CHECK DATE (@ MLton)
- Purely Functional Data Structures. C. Okasaki. Cambridge University Press, 1998 or 1999. CHECK DATE (@ MLton)
- The bibliography of the MLton Project
7 SML communication channels
- Mailing lists
- sml-implementers@lists.sourceforge.net
- sml-evolution@mailman.cs.uchicago.edu
- mailing lists for specific implementations (see the listing for each implementation)
- sml-list@cs.cmu.edu / sml-redistribution@cs.cmu.edu / comp-lang-ml@moderators.isc.org (dead for now)
- sml-implementers@lists.sourceforge.net
- IRC channels
- #sml on freenode.net
- #sml on freenode.net
- Discussion forums
- USENET newsgroups
- comp.lang.functional
- comp.lang.ml (dead for now, gatewayed with sml-list@cs.cmu.edu)
- comp.lang.functional
- The ML Workshop series
As of [2011-10-02], the web site for the entire workshop series has not been updated since just before ML 2009. The series however has continued with ML 2010 and ML 2011.
8 Programming patterns in SML that involve advanced use of types
- The “binary product (pair) operator” pattern (@ MLton)
This gives an alternative to SML's built-in tuples (which are actually records with numeric field labels). The point is that it lets you define functions that operate on tuples of arbitrary size in an inductive fashion.
- The “for loop” pattern and iterator combinators (@ MLton)
This shows how to define functions that look and act like the “for loop” constructs of other programming languages.
- The “return statement” pattern (and some comments on CPS) (@ MLton)
This discusses how to emulate the “return” statement of other programming languages.
- The “fold” pattern for handling an arbitrary number of arguments (@ MLton)
This discusses how to define functions that can take an arbitrary number of (curried) arguments, i.e., you can have a function F such that (F A1 A2 A3 ⋯ An) makes sense for any value of n. (Remember that this is really (( ⋯ (((F A1) A2) A3) ⋯) An).)
- The “functional record update” (FRU) pattern (based on fold) (@ MLton)
- The “fold-0-1-n” pattern for handling an arbitrary number of arguments (based on fold) (@ MLton)
This is an advanced use of the fold pattern that deals with some special cases that can sometimes arise for which fold itself is not enough.
- The “variable tuple arity polymorphism” pattern (based on fold-0-1-n and binary product operator) (@ MLton)
This gives you polymorphic functions over tuples built with the user-defined binary product operator mentioned above.
SML's built-in tuples (records with numeric field labels) are not handled by this pattern. (Can they be handled some other way?)
- 2 patterns: “optional arguments” (based on fold), “labeled optional arguments” (based on FRU) (@ MLton)
- “static sum” pattern (@ MLton)
- Object-oriented programming in SML
- “object-oriented programming via dynamic dispatch using a recursive record of functions” pattern (@ MLton) (also includes pointers to other methods in literature)
- OO Programming styles in ML by Bernard Berthomieu (148-page report)
- Cynbe (of Mythryl) discusses issues involved in adding extensions to Mythryl to better support Berthomieu's OOP method
This web page also discusses how Berthomieu's method fails due to type system restrictions for classes where the non-constructor methods of the class might need to call a constructor of the same class.
- Cynbe (of Mythryl) discusses issues involved in adding extensions to Mythryl to better support Berthomieu's OOP method
- Phantom Types and Subtyping (author's page) (arXiv)
- “object-oriented programming via dynamic dispatch using a recursive record of functions” pattern (@ MLton) (also includes pointers to other methods in literature)
- Type-indexed values
- “fix points” pattern for computing fix points involving abstract types (from Vesa Karvonen's extended basis library) (uses an instance of type-indexed values)
- Message in 2006 on mlton-user mailing list by Stephen Weeks describing an approach to type-indexed values
- “type indexed values” following an early version of the approach in Vesa Karvonen's generic programming library
- “fix points” pattern for computing fix points involving abstract types (from Vesa Karvonen's extended basis library) (uses an instance of type-indexed values)
- Practical Datatype Specializations with Phantom Types and Recursion Schemes (author's page)
- Various ways of doing the Y combinator in SML
Date: 2012-08-01 16:04:22 BST
HTML generated by org-mode 6.33x in emacs 23