Overview

<!-- -*- markdown -*- -->

The SML Basis Prime Demo
========================

This repository contains a number of code examples demonstrating the use
of the [SML Basis Prime](http://bitbucket.org/robsimmons/prime) (SBP). 
It includes the SBP itself, though it is recommended that you download SBP
from the [main page](http://bitbucket.org/robsimmons/prime). 

With the exception of the examples described immediately below, all the 
examples are designed to be run with SML/NJ using the command 
"`sml <filename>`" while sitting in the root directory 
(the directory where this README file is).  

Using the SBP with different ML implementations
-----------------------------------------------

*  **`smlnj/demo.cm`** (not yet)

*  **`mlton/demo.mlb`** (not yet) 
   MLton can also be executed with the SML/NJ command by running
   "`mlton smlnj/sources.cm`".

*  **PolyML** (not yet)

Monads
------

Idioms
------

Idioms ("applicative functors" in Haskell) are flexible ways of programming 
with state. The `idioms` directeory contains a few examples.

*  **`idioms/evaluation.sml`** - Evaluating expressions in an environment using 
   the environment idiom; demonstrates the use of both the `Idiom` and `IdiomK`
   functors for defining idioms.

*  **`idioms/susp.sml`** - Gives an example of the `Susp` idiom for memoized
   suspensions.

*  **`idioms/maybesusp.sml`** - Two idioms can always be composed to create 
   another idiom - a fact that is not true of monads. This file gives a simple
   example of of composing `Susp` with `Maybe` - in both direcions.