Re: Hugs on Mac with CW6 ? ... and Haskell Graphics Lib?
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/>
Hi, My main responsibilities regarding Hugs right now is to see to that a new release is being made that incorporates all recent bug-fixes and additions. In this process I hope to able to bring the Mac version of hugs into the main distribution, although I'm not sure yet about what kind of effort that will involve. A Mac port of the Haskell Graphics Library would certainly be a valuable extra, but I don't consider that as a top priority at the moment. However, as Alastair has pointed out in a recent message, the various options for interfacing to C that now exist might significantly ease the task of making such a port if one has the necessary knowledge of the Macintosh toolbox API. I invite all interested readers to have a go with this task, preferably using the FFI that Alastair has implemented (which will be included in the next release, currently it's available at http://www.cs.utah.edu/~reid/tmp/hugs98-ffi-03122000.tgz). Since I'm using CW5 I can't say anything about the difference w.r.t CW6. I'm considering upgrading, though. My own efforts in implementing Haskell graphics on the Mac have moreover been limited to trying to make the Tk library coexist with SIOUX. Regrettably I don't have any new results to report here yet. I agree with Hans that MacOS X is where the money should be spent if one considers porting to the Mac. However, although a lot of good things follow from the fact that MacOS X is Unix-based, graphical Unix applications will still need considerable rewriting since the X Windows system will not be supported under MacOS X (at least not per default). So time spent on writing code for the current (Carbon-compatible) Mac Toolbox will probably still be a good investment. Regards, Johan Hans Aberg wrote:
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/>
Johan wrote:
the FFI that Alastair has implemented (which will be included in the next release, currently it's available at http://www.cs.utah.edu/~reid/tmp/hugs98-ffi-03122000.tgz).
I'd encourage enthusiastic hackers to take it for a spin. In particular, it uses a little machine code stub to implement foreign export dynamic. At present, we only have a stub for the x86 and it has only been tested under Linux. We need people to try it on other x86-based OSs (FreeBSD, NetBSD, Windows, ...) and we need people to write stubs for other architectures (Sparc, PPC, PA-Risc, ...). It's only 3 instructions (on the x86, at least) so it shouldn't take long :-) Alastair ps The machine code required is in mkThunk which is in hugs98/src/builtin.c. The comment preceding the function describes what the machine code has to do. pps Sadly, foreign export static is not currently implemented. There's some tricky issues involving the typechecker that I wasn't able to resolve in the time available. I'm hoping that someone at Hugs-central can fill in the missing parts.
At 16:44 -0800 0-12-08, Johan Nordlander wrote:
...although a lot of good things follow from the fact that MacOS X is Unix-based, graphical Unix applications will still need considerable rewriting since the X Windows system will not be supported under MacOS X (at least not per default). So time spent on writing code for the current (Carbon-compatible) Mac Toolbox will probably still be a good investment.
There are at least two X-Windows available under MacOS X, the Tenon's somewhat pricey commercial http://www.tenon.com/, and the FreeBSD based found at http://mrcla.com/XonX/. So a possible MacOS X development strategy might be to first make a working X-windows version, and then translate the graphics package into the MacOS X proper. -- Since all this is very time consuming development, the trick will be to figure out how pick together the pieces development made by many, I think. 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/>
participants (3)
-
Alastair Reid -
Hans Aberg -
Johan Nordlander