RE: [Haskell-cafe] The implementation of Functional

2005-01-07 Thread Simon Peyton-Jones
The online-readable copy is all ready to go. I'm just awaiting a final ok from Marnie and I'll announce it. For a paper copy we'll await John's Cafepress efforts. Much thanks to both Marnie and John. Simon | -Original Message- | From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On

RE: [Haskell-cafe] Some random newbie questions

2005-01-07 Thread Simon Peyton-Jones
| * As far as I can determine, there is no way to check pattern matches for | exhaustiveness. Coming from OCaml, this feels like losing a significant | safety net! How do people program so as not to be getting dynamic match | failures all the time? GHC has -fwarn-incomplete-patterns and

[Haskell-cafe] Guards (Was: Some random newbie questions)

2005-01-07 Thread Henning Thielemann
On Fri, 7 Jan 2005, Simon Peyton-Jones wrote: | * As far as I can determine, there is no way to check pattern matches for | exhaustiveness. Coming from OCaml, this feels like losing a significant | safety net! How do people program so as not to be getting dynamic match | failures

RE: [Haskell-cafe] Hugs vs GHC (again) was: Re: Some random newbiequestions

2005-01-07 Thread Simon Marlow
Here's a summary of the state of Unicode support in GHC and other compilers. There are several aspects: - Can the Char type hold the full range of Unicode characters? This has been true in GHC for some time, and is now true in Hugs. I don't think it's true in nhc98 (please correct me if

Re: [Haskell-cafe] Some random newbie questions

2005-01-07 Thread Ketil Malde
[EMAIL PROTECTED] writes: I'm constantly surprised hearing from so many people about their space problems. I cannot remember having space problems with my programs. I don't know what everybody else is doing wrong :-) At least two common cases. Extracting compact data structures from large

Re: [Haskell-cafe] Hugs vs GHC (again) was: Re: Some random newbiequestions

2005-01-07 Thread Malcolm Wallace
Simon Marlow [EMAIL PROTECTED] writes: Here's a summary of the state of Unicode support in GHC and other compilers. There are several aspects: - Can the Char type hold the full range of Unicode characters? This has been true in GHC for some time, and is now true in Hugs. I don't

Re: [Haskell-cafe] Unicode: Hugs vs GHC (again) was: Re: Some random newbie questions

2005-01-07 Thread Dimitry Golubovsky
Hi, Lennart Augustsson wrote: Simon Marlow wrote: Here's a summary of the state of Unicode support in GHC and other compilers. There are several aspects: - Can the Char type hold the full range of Unicode characters? This has been true in GHC for some time, and is now true in Hugs. I don't

[Haskell-cafe] Implementing computations with timeout

2005-01-07 Thread Einar Karttunen
Hello What is the best way of doing an computation with a timeout? A naive implementation using two threads is easy to create - but what is the preferred solution? withTimeout :: forall a. Int - IO a - IO (Maybe a) withTimeout time fun = do mv - newEmptyMVar tid - forkIO (fun =

RE: [Haskell-cafe] Hugs vs GHC (again) was: Re: Some randomnewbiequestions

2005-01-07 Thread Simon Marlow
On 07 January 2005 12:30, Malcolm Wallace wrote: Simon Marlow [EMAIL PROTECTED] writes: Here's a summary of the state of Unicode support in GHC and other compilers. There are several aspects: - Can the Char type hold the full range of Unicode characters? This has been true in GHC

Re: [Haskell-cafe] Some random newbie questions

2005-01-07 Thread Paul Hudak
Benjamin Pierce wrote: OK, I'm taking the plunge and using Haskell in a course I'm teaching this semester. To get ready, I've been doing quite a bit of Haskell programming myself, and this has raised a few questions... * What are the relative advantages of Hugs and GHC, beyond the obvious (Hugs

Re: [Haskell-cafe] Hugs vs GHC (again) was: Re: Some randomnewbiequestions

2005-01-07 Thread Lennart Augustsson
Simon Marlow wrote: Many years ago, hbc claimed to be the only compiler with support for this. What encoding(s) did hbc allow in source files? The docs only mention unicode characters inside character string literals. The Java encoding, i.e., \u. -- Lennart

Re: [Haskell-cafe] Implementing computations with timeout

2005-01-07 Thread Tomasz Zielonka
On Fri, Jan 07, 2005 at 03:31:10PM +0200, Einar Karttunen wrote: Hello What is the best way of doing an computation with a timeout? A naive implementation using two threads is easy to create - but what is the preferred solution? withTimeout :: forall a. Int - IO a - IO (Maybe a) btw

Re: [Haskell-cafe] Implementing computations with timeout

2005-01-07 Thread Einar Karttunen
Tomasz Zielonka [EMAIL PROTECTED] writes: import Control.Concurrent (forkIO, threadDelay) import Control.Concurrent.STM withTimeout :: Int - STM a - IO (Maybe a) withTimeout time fun = do mv - atomically newEmptyTMVar tid - forkIO $ do threadDelay time

Re: [Haskell-cafe] Implementing computations with timeout

2005-01-07 Thread Tomasz Zielonka
On Fri, Jan 07, 2005 at 02:57:19PM +0100, Tomasz Zielonka wrote: My guess is it would be something like this, however you may want to do it differently to get better compositionality (withTimeout returns an IO action, not a STM action): Maybe this will suffice, but I don't know if the delay

Re: [Haskell-cafe] Implementing computations with timeout

2005-01-07 Thread Tomasz Zielonka
On Fri, Jan 07, 2005 at 04:55:05PM +0200, Einar Karttunen wrote: Isn't this buggy if fun just keeps working without throwing an exception or using retry? I meant wholly inside STM There is not that much that you can do inside STM. This may be a problem if you want to wait for a genuine IO

Re: [Haskell-cafe] Guards (Was: Some random newbie questions)

2005-01-07 Thread Christian Maeder
Henning Thielemann wrote: What about dropping Guards? :-) Are they necessary? Do they lead to more readable source code? Do they lead to more efficient code? I could perfectly live without them up to now. I hardly need guards too, but their advantage is that they let pattern matching fail,

Re: [Haskell-cafe] Implementing computations with timeout

2005-01-07 Thread Tomasz Zielonka
On Fri, Jan 07, 2005 at 04:55:05PM +0200, Einar Karttunen wrote: if we use IO as the signature then using the TMVar has few advantages over using an MVar. Yes, I think you are right here. Best regards, Tomasz ___ Haskell-Cafe mailing list

[Haskell-cafe] Re: Implementing computations with timeout

2005-01-07 Thread Peter Simons
Einar Karttunen writes: What is the best way of doing an computation with a timeout? At http://cryp.to/child/ you'll find a very readable and straightforward implementation of a generic timeout function: type Timeout = Int timeout :: Timeout - IO a - IO (Maybe a) The function uses the

Re: [Haskell-cafe] Hugs vs GHC (again) was: Re: Some randomnewbiequestions

2005-01-07 Thread Malcolm Wallace
Simon Marlow [EMAIL PROTECTED] writes: - Can the Char type hold the full range of Unicode characters? This has been true in GHC for some time, and is now true in Hugs. I don't think it's true in nhc98 (please correct me if I'm wrong). You're wrong :-). nhc98 has always had

Re: [Haskell-cafe] Hugs vs GHC (again) was: Re: Some randomnewbiequestions

2005-01-07 Thread Lennart Augustsson
Malcolm Wallace wrote: Lennart writes: What encoding(s) did hbc allow in source files? The docs only mention unicode characters inside character string literals. The Java encoding, i.e., \u. Well, in that case, nhc98 also supports Unicode in source files, identically to hbc. Well, you have

Re: [Haskell-cafe] Implementing computations with timeout

2005-01-07 Thread Sebastian Sylvan
On Fri, 07 Jan 2005 15:31:10 +0200, Einar Karttunen ekarttun@cs.helsinki.fi wrote: Hello What is the best way of doing an computation with a timeout? I like the approach taken in Tackling the ackward squad: First a funcion which will race two IO computations against each other, returning

Re: [Haskell-cafe] Implementing computations with timeout

2005-01-07 Thread Sebastian Sylvan
On Fri, 7 Jan 2005 20:56:42 +0100, Sebastian Sylvan [EMAIL PROTECTED] wrote: On Fri, 07 Jan 2005 15:31:10 +0200, Einar Karttunen ekarttun@cs.helsinki.fi wrote: Hello What is the best way of doing an computation with a timeout? I like the approach taken in Tackling the ackward squad:

Re: [Haskell-cafe] Implementing computations with timeout

2005-01-07 Thread Tomasz Zielonka
On Fri, Jan 07, 2005 at 04:47:12PM +0100, Tomasz Zielonka wrote: On Fri, Jan 07, 2005 at 04:55:05PM +0200, Einar Karttunen wrote: if we use IO as the signature then using the TMVar has few advantages over using an MVar. Yes, I think you are right here. Hmmm, TMVar's seem to be

[Haskell-cafe] Re: Unicode: Hugs vs GHC (again) was: Re: Some random newbie questions

2005-01-07 Thread Ashley Yakeley
In article [EMAIL PROTECTED] ft.com, Simon Marlow [EMAIL PROTECTED] wrote: True. Anyone care to take Hugs' implementation of the character class functions and put it in GHC? There's extensive character property tables in code in http://cvs.sourceforge.net/viewcvs.py/haskell-i18n/Source/.