I have a developer/port/install question, which I put up here, so that more
people can respond to it:

I want to install some primitives into the Hugs kernel of the MacOS port
that should enable one to do programming with MacOS so called AppleEvent's.
These events can be thought of signals that different programs can use to
communicate with each other. The events are in reality binary structures
(dynamic links, where each link can be of a different type), but for this
discussion it suffices to think of them as being of type String.

So the MacHugs program will firstly have a function  receiveEvent  that
suddenly, unexpectedly can receive a String from some other program; it
will perform some computations, and it may optionally send back a String
away from the program. I want to install a primitive in Hugs that can take
care of this: One question is how to put this function (written in C) into
the Hugs kernel, another how to install a Haskell header with a suitable
Haskell type of this function, and a third is how to handle the situation
when the Hugs kernel is already computing something else when this event
arrives.

On the last issue, if Hugs is already computing something, is it possible
to safely interrupt those computations for a while and execute some other
Haskell code to process the event, and then resuming the original
computations? Or will that screw up something?

And second, there will be another primitive  sendEvent  doing the opposite,
sending a String to some other program and optionally awaiting a reply.
What should the Haskell type of such a function be?

I must stress that what I want to know are the Haskell types of the two
primitives  receiveEvent  and  sendEvent  above, as distinguished from the
types of the functions that may be used to process these strings.

  Hans Aberg



Reply via email to