Haskell and Maple FFI [RELASED 0.0.1]

Rafael Martinez Torres rmartine at fdi.ucm.es
Fri Oct 22 11:41:11 EDT 2004


>
> Yes, now use Haskell's ffi to import all those OpenMaple calls you made in the
> above.  That is, MapleNumArgs, ToMapleExpressionSequence, etc.
>
> Having done that, translate the code into Haskell in the obvious way and check
> it works.
>

Done !!!

> After you've done a bunch of examples, show us them and we can suggest how to
> use type classes to reduce most maple calls to just a line or two of Haskell
> code.
>

Attached file. Waiting for your comments...
-------------- next part --------------
A non-text attachment was scrubbed...
Name: HOpenMaple-0.0.1.tar.gz
Type: application/x-gunzip
Size: 5271 bytes
Desc: 
Url : http://www.haskell.org//pipermail/ffi/attachments/20041022/19fb4517/HOpenMaple-0.0.1.tar.bin
-------------- next part --------------
HOpenMaple (0.0.1)
==================

Rafael Martinez Torres ( rmartine at fdi dot ucm dot es )

- Abstract.
- Future Guide-Lines .

Abstract:
---------

This is not a complet work. Much more like a seed, it's rather intended to show the
feasibility of a future project to make both languages (Haskell and
Maple) interoperables, as suggested on FFI mailing list discusions.

Past efforts on this subject (Wolfgang Schreiner, Hans-Wolfgang Loidl,
http://www0.risc.uni-linz.ac.at/research/software/ghc-maple/) were
forced by the fact that previous verions of Maple software suite were
released as an end-user product, making very hard to integrate both
systems, GHC and Maple (system programming, openning pipes, forking
processes, etc...)

As Maple 9 has been released, Open Maple eventually allows your
program in C,Java to access the Maple kernel (runtime system?) through a
given API. Our goal is to setup a new calling convention "maple" for Haskell,
taking care of marshall/unmarshall issues, using FFI and existing
preprocessors to import the C API into Haskell.

Status is still unmatured and many technical support is required from
involved areas: FFI, Maple, Haskell-GHC, Type-System Theory...

Future guide-lines:
-------------------

+ Type-System question: Concerning function signatures, for the time beeing
the API is designed on the trivial case, the IO a monad, to prevent
the fact that functions may not be  referentially tranparent, since
each call modifies the Maple-Kernel state.

However, as IO a is defined like

	 type IO a = (WorldState) -> (WorldState,a)
	 instance Monad IO where
	 ...

I think it would be desirable to define a new Monad type like

	type Maple a = (MapleKernel) -> (MapleKernel, a)
	instance Monad Maple where
	...

+ Refining Maple call: How to make the runtime-system to load Maple
code in order to "link" the simbols specified by FFI calling
convention "maple" ?

+ Formal semantics: What about a formal model for a mixed code
program ? This could be done abstracting GHC-STG and Maple-Kernel underlying machines...



More information about the FFI mailing list