Re: compiling concurrent haskell with ghc
Hi all, I have a question on compiling a concurrent haskell source code using GHC. Today is my first time playing around with concurrency in Haskell, and this afternoon, GHC seemed to be able to compile my code and produced an executable. However, that executable did not seem to run the program correctly. In fact, it just did not do anything. FYI, GHCi interpreted the code succesfully, and the program runs normally under GHCi. I compiled the code this way: ghc --make source.hs -o output Please post the code, a description of what it did, and what you expected it to do. If the code is too large for an email, put it on your web server and point us at it, or cut it down to a smaller version that still exhibits the problem, and include that. We can't help you if we don't have this information. --KW 8-) ___ Haskell-Cafe mailing list [EMAIL PROTECTED] http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: compiling concurrent haskell with ghc
Hi Keith, With this email I attached the source code. As you can see, it is very simple. And in case you would like to know, I wrote that program for a short tutorial on Haskell for a programming language courseI took last semester. Thank you very much. Blessings, Dennis Keith Wansbrough [EMAIL PROTECTED] wrote: Hi all, I have a question on compiling a concurrent haskell source code using GHC. Today is my first time playing around with concurrency in Haskell, and this afternoon, GHC seemed to be able to compile my code and produced an executable. However, that executable did not seem to run the program correctly. In fact, it just did not do anything. FYI, GHCi interpreted the code succesfully, and the program runs normally under GHCi. I compiled the code this way: ghc --make source.hs -o outputPlease post the code, a description of what it did, and what youexpected it to do. If the code is too large for an email, put it onyour web server and point us at it, or cut it down to a smallerversion that still exhibits the problem, and include that. We can'thelp you if we don't have this information.--KW 8-)___Haskell-Cafe mailing list[EMAIL PROTECTED]http://www.haskell.org/mailman/listinfo/haskell-cafe Do you Yahoo!? Yahoo! SiteBuilder - Free, easy-to-use web site design software mySource.hs Description: mySource.hs
Re: Type design question
On Friday 25 July 2003 21:48, Dylan Thurston wrote: Another approach is to make Universe a multi-parameter type class: class (RealFrac a, Floating a) = Universe u a | u - a where distanceVector :: u - Vector a - Vector a - Vector a ... You need to use ghc with '-fglasgow-exts' for this. What is the general attitude in the Haskell community towards compiler-specific extensions? My past experience with Fortran and C/C++ tells me to stay away from them. Portability is an important criterion for me. Konrad. ___ Haskell-Cafe mailing list [EMAIL PROTECTED] http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: compiling concurrent haskell with ghc
Dennis Sidharta wrote: [ problems with concurrent Haskell ] I can see two problems in your code: * forkIO creates daemon threads, so the program terminates immediately. * Chan is an unbounded channel, so you won't get a ping pong, which is probably what you expected. MVar is your friend here. See http://haskell.org/ghc/docs/latest/html/base/Control.Concurrent.html Cheers, S. ___ Haskell-Cafe mailing list [EMAIL PROTECTED] http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: Type design question
On Mon, 28 Jul 2003, Konrad Hinsen wrote: What is the general attitude in the Haskell community towards compiler-specific extensions? My past experience with Fortran and C/C++ tells me to stay away from them. Portability is an important criterion for me. It depends which ones. Some are implemented in multiple compilers in a consistent way and widely liked and used, and are rather likely to make it into the next standard version of Haskell in much their current form. (For instance, portability is an important criterion for us, too, but we still use multi-parameter typeclasses.) Others are still sufficiently experimental that ideas really are just being played with. It would be interesting to see a list of what people think will make it into Haskell 2 though. -- Mark ___ Haskell-Cafe mailing list [EMAIL PROTECTED] http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: Type design question
On Mon, 28 Jul 2003 09:54:11 -0400 (EDT) Mark Carroll [EMAIL PROTECTED] wrote: It would be interesting to see a list of what people think will make it into Haskell 2 though. http://haskell.org/hawiki/HaskellTwo ___ Haskell-Cafe mailing list [EMAIL PROTECTED] http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: Type design question
On Mon, Jul 28, 2003 at 03:42:11PM +0200, Konrad Hinsen wrote: On Friday 25 July 2003 21:48, Dylan Thurston wrote: Another approach is to make Universe a multi-parameter type class: class (RealFrac a, Floating a) = Universe u a | u - a where distanceVector :: u - Vector a - Vector a - Vector a ... You need to use ghc with '-fglasgow-exts' for this. What is the general attitude in the Haskell community towards compiler-specific extensions? My past experience with Fortran and C/C++ tells me to stay away from them. Portability is an important criterion for me. I think it depends on the extension. I find multi-parameter type classes genuinely very useful, and the functional dependencies notation (the '| u - a' above) has been around for a while and seems to be becoming standard. Hugs, for instance, implements these same extensions, and it seems very likely to me to be part of the next Haskell standard. On the other hand, some ghc extensions, like generic Haskell, seem much more preliminary to me; if you want portable code, I would stay away from them. There was some discussion earlier about formalising some of these extensions. As far as I know, the FFI is the only one for which this has been completed; but I think multi-parameter type classes would be a natural next choice. Peace, Dylan pgp0.pgp Description: PGP signature
Re: Type design question
At 15:40 28/07/03 +0200, Konrad Hinsen wrote: This is beginning to get a little ugly, but I think that's largely because you're using type classes in too much of an OO style (this is I am coming from OO indeed... Me too. Twice now I have used Haskell classes in a way suggested by an OO programming background, and have later ended up replacing the class by a 'data' containing functions. Here's a point to consider: suppose you want to have a list of class instances: if you use the class mechanism, then every member of the list must be a member of the same instance type of the class, which is not what is usually required for OO programming. An alternative is to define something like: data MyInterface = MyInterface { method1 :: Int - String - Blob , method2 :: Bool - String - Blob , method3 :: Blob - String } then if you have: anObj :: MyInterface and write functions like foo = method1 anObj 5 hello bar = method3 anObj foo etc. In creating instances of MyInterface, the higher order function features of Haskell, and currying, are most useful. Functions that return values of type MyInterface take on the role of OO class constructors (or kit classes). (The above code completely unchecked, but I hope it illustrates an approach.) #g --- Graham Klyne [EMAIL PROTECTED] PGP: 0FAA 69FF C083 000B A2E9 A131 01B9 1C7A DBCA CB5E ___ Haskell-Cafe mailing list [EMAIL PROTECTED] http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: compiling concurrent haskell with ghc
Hi Sven, Thanks for the pointer! I will try to play around with MVar. Sincerely, DennisSven Panne [EMAIL PROTECTED] wrote: Dennis Sidharta wrote: [ problems with concurrent Haskell ]I can see two problems in your code:* forkIO creates "daemon threads", so the program terminates immediately.* Chan is an unbounded channel, so you won't get a "ping pong", whichis probably what you expected. MVar is your friend here.See http://haskell.org/ghc/docs/latest/html/base/Control.Concurrent.htmlCheers,S. Do you Yahoo!? Yahoo! SiteBuilder - Free, easy-to-use web site design software