Using Mondrian and Haskell for .NET

Before using either compiler start up a command shell.

Mondrian

Mondrian source files use the “.ms” extension. To compile a Mondrian file use:

mdc <file>.ms

This will produce a <file>.exe. You can pass any number of Mondrian (.ms), C# (.cs), and library (.dll) files to mdc. Any of the C# compiler options may also be used, mdc adds two of its own:

/keepcs   Mondrian (.ms) files are compiled into C# (.cs) as part of the compilation process. Specifiying this option instructs mdc to not delete these files for all subsequent Mondrian files on the command line up. Toggles with /delcs.
/delcs Remove C# intermediate files for all subseqent Mondrian files. Toggles with /keepcs.

Haskell

The process for Haskell is a little longer. First compile your Haskell source file:

monghc <file>.hs

This will produce a “.mc” file which the Mondrian compiler can compile:

mondrian <file>.mc

You now have a C# file, for this use:

hcs <file1>.cs ... <fileN>.cs

This compiles the C# files, attaches the Haskell and Mondrian RTS’s and produces a main.exe. The hcs command is just a simple batch file which ends up calling csc, the C# compiler, and you may use any of csc options as needed.

Combining Haskell and Mondrian

You can of course combine Haskell and Mondrian code. There is direct calling between the two languages, however the GHC compiler will require a dummy Haskell Interface, “.hi”, to describe the Mondrian functions if you are calling from Haskell to Mondrian. Either build one by hand or write a dummy Haskell file and compile it to produce the interface file.

Last modified: 15/10/2001