> 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...

Attachment: HOpenMaple-0.0.1.tar.gz
Description: application/gunzip

HOpenMaple (0.0.1)

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

- Abstract.
- Future Guide-Lines .


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 

FFI mailing list

Reply via email to