Hugs on Mac with CW6 ? ... and Haskell Graphics Lib?
Hans Aberg
haberg@matematik.su.se
Thu, 7 Dec 2000 11:40:19 +0100
>Hello, I was wondering whether you know if anyone has gotten
>Hugs to compile on Mac OS 9, using CodeWarrior 6. I am wanting
>to get to know Haskell a little, and I have a copy of Paul
>Hudak's book "The Haskell School of Expression", so I thought
>it would be cool to run the book's examples on my Mac at home.
I have forwarded your letter to Johan Nordlander <nordland@cse.ogi.edu> who
is interested in implementing graphics on MacOS Hugs. -- I do not know
whether he is using CW Pro 5 or 6, though.
I'm & Pablo are currently using CW Pro 5, but feel free to use CW Pro 6 for
any contributions you make. -- If I continue using CW, I will probably
upgrade in the future.
-- If you are not currently subscribing to the Hugs-Users & Hugs_bugs
mailing lists, please do so <http://haskell.org/>, because the kind of info
you look for will be posted there.
> -- has anyone gotten Hugs to compile on Mac OS 9
> under CW 6?
I would suggest you to try compile the sources I have for CW 5 under CW 6,
and see what breaks. Perhaps Johan has already done this. In these version,
I have implemented AppleEvent's using the AEGizmo's package, which might
interest you if you work at Apple -- I think a functional language light
Haskell might be suitable to describe the high level events.
> -- has anyone gotten Hugs+HGL to work on any Mac
> (OS 9 or OS X)?
Yes, GCC is available under MacOS X, in Hugs compiles straight off, Atze
Dijkstra <atze@cs.uu.nl> reports to the Hugs-users mailing list. He is
currently working on GHC. There will (hopefully) be a interpreter GHCi
possibly replacing Hugs in the future(?), so this work in important.
-- I think myself that it is not really worth developing for pre-MacOS X,
and for MacOS X, it is perhaps better to simply use the freely available
GCC.
>It looks like Metrowerks may have changed some things
>about the SIOUX interface and/or how stdarg.h works, in
>between CW 5 and CW 6. (I deduce this from my feeble
>attempts at compiling and debugging a plain Hugs with CW 6.)
The interface we use is that CW's SIOUX sources are duplicated and then
modified. So if it is not working under CW 6, it is probably because we
didn't put copies of all CW 5 SIOUX sources into the project.
Even though this is just a quick-fix way to develop the GUI, the components
could be used for developing an entirely new GUI. The SIOUX CW 5 windows
isn't a very good package, because it contains too many updates, isn't
thread safe. So it would be better to make an entirely new GUI. This is
probably an interesting topic, though time consuming, and I think one would
be better off developing a new GUI for MacOS X directly.
> -- where should I look to figure out how the mac version
> of Hugs wants to interface with a C-based library?
There is something called HDirect, I think but I have never used it. When I
implemented the AppleEvent's via the AEGizmo's package, I did that via
strings. Then the problem to overcome is that Haskell is a lazy language,
so in order to retrieve the string for a C-program, the entry on the stack
must first be evaluated. So for that I stile some code I happened to find
somewhere in the Hugs package. The lack of such an interface for common
C-types seems to be a weakness of the current Hugs, but it is not so
difficult implementing the stuff if one only figures out how Hugs works.
Another problem with Hugs is that it is not thread-safe (pure, re-entrant),
so if one interrupts (say via an AppleEvent) the current evaluations to
execute some other Haskell code, you may end up with trouble (or, if you
are luck the code doesn't break.)
-- My wish is that if a new Haskell interpreter shows up, GHCi, or
whatever, it is going to be thread-safe in the sense that multiple Haskell
threads can be executed in parallel. This would be most important for
applications, such as executing AppleEvent's and such. But I do not know if
that is the plan for GHCi.
Otherwise, it was not so difficult making Hugs working with C-code.
> -- would it be easier to work with GHC or HBC instead of Hugs?
> (High speed is not a big concern of mine at the moment,
> I just want to learn and be able to play around with
> Haskell.)
I do not know exactly what will happen in the future: For Mac's, it seems
most prudent to develop for MacOS X, as that is available already as a
beta. GHCi is said to arrive in the spring, so when that arrives, so will
be able to know. If Atze is making progress with GCC under MacOS X, that
will simplify matters, I think.
-- Perhaps somebody else can explain the exact differences between Hugs & GHCi.
-- As it is extremely time-consuming developing a MacOS GUI, probably also
under MacOS X, even though the situation would be better, I think it would
be great if people agree to different parts on the same MacHugs.
Hans Aberg
* Email: Hans Aberg <mailto:haberg@member.ams.org>
* Home Page: <http://www.matematik.su.se/~haberg/>
* AMS member listing: <http://www.ams.org/cml/>