Re: if-then-else inside a "do"

2002-01-29 Thread Johannes Waldmann
> Forgot to mention this in my last email. I find myself writing a lot > of if-then-elses in do notation, and most often the else branch is "return ()". > This gets a bit cumbersome to write and messes up the code. There's also the Monad library http://haskell.org/onlinelibrary/monad.html that co

Hello everybody, About a Haskell WebServer ??

2002-01-29 Thread Jayhuse
Hello Haskell friends: I am looking for anybody that has information on Haskell WebServers. Currently I understand that Simon Marlow has built a 1500 line Web Server that does extremely well. My question is has anybody else out there built a web server ? and if so does it contain similar Ja

Re: if-then-else inside a "do"

2002-01-29 Thread Fergus Henderson
On 29-Jan-2002, Andre W B Furtado <[EMAIL PROTECTED]> wrote: > In the following code, will "other things" be executed or the "return ()" > will end function f? I guess the answer is yes ("other things" WILL be > executed anyway), but I'd like to understand why won't the "return ()" be > the [state

Re: if-then-else inside a "do"

2002-01-29 Thread Bernard James POPE
Hi again, Forgot to mention this in my last email. I find myself writing a lot of if-then-elses in do notation, and most often the else branch is "return ()". This gets a bit cumbersome to write and messes up the code. So now I tend to use: doIf :: Monad a => Bool -> [a b] -> a () doIf b

Re: if-then-else inside a "do"

2002-01-29 Thread Bernard James POPE
> In the following code, will "other things" be executed or the "return ()" > will end function f? I guess the answer is yes ("other things" WILL be > executed anyway), but I'd like to understand why won't the "return ()" be > the [state change/result produced] created by f. > > f :: IO () > f =

st monad

2002-01-29 Thread Andre W B Furtado
How do I find the implementation of the module ST? In the GHC documentation, I can only find the signatures of the functions.

if-then-else inside a "do"

2002-01-29 Thread Andre W B Furtado
In the following code, will "other things" be executed or the "return ()" will end function f? I guess the answer is yes ("other things" WILL be executed anyway), but I'd like to understand why won't the "return ()" be the [state change/result produced] created by f. f :: IO () f = do -- lots

Re: n+k patterns

2002-01-29 Thread Lennart Augustsson
Simon Peyton-Jones wrote: > | Hugs "demands Integral" because that's what it was told to do > | to follow the report. So in that sense, yes, the code > | depends on having only one class. But it would be easy for > | someone to change that. > | > | Then again, if we're following the rules of mi

Re: n+k patterns

2002-01-29 Thread Lennart Augustsson
Well, it was a deliberate decision to limit the n+k pattern to class Integral because people at that time felt that n+k was something that should only be used with integers. So it's not a fluke, it was quite deliberate. I kind of like Integral for this (as much as I can like anything about n+k :)

RE: n+k patterns

2002-01-29 Thread Simon Peyton-Jones
| Hugs "demands Integral" because that's what it was told to do | to follow the report. So in that sense, yes, the code | depends on having only one class. But it would be easy for | someone to change that. | | Then again, if we're following the rules of minimal change | for Haskell 98, the

RE: n+k patterns

2002-01-29 Thread Mark P Jones
| On Tue, Jan 29, 2002 at 07:36:56AM -0800, Simon Peyton-Jones wrote: | > The Haskell Report says of n+k patterns: | > | > "A n+k pattern can only be matched against a value in | > the class Integral." | > | > This seems far too strong. All that is needed are Ord (for the >=) | > and Num (for

RE: n+k patterns

2002-01-29 Thread Simon Peyton-Jones
| Btw., in 3.17.2 Informal Semantics of Pattern Matching | the end of the following sentence should be changed: Actually I've changed the entire wording of that section in consultation with Ross who has read it rather carefully. You can find the current draft of the expressions chapter at

Re: n+k patterns

2002-01-29 Thread Olaf Chitil
> In any case, I propose to change "Integral" to "Ord and Num". I agree. And nhc98 seems to actually implement this. Nonetheless I find using n+k patterns for floating point numbers pretty horrible. And it raises the question why k cannot be a rational ... But then n+k patterns are a wart anywa

Re: n+k patterns

2002-01-29 Thread Ross Paterson
On Tue, Jan 29, 2002 at 07:36:56AM -0800, Simon Peyton-Jones wrote: > The Haskell Report says of n+k patterns: > > "A n+k pattern can only be matched against a value in > the class Integral." > > This seems far too strong. All that is needed are Ord (for the >=) > and Num (for - and fromInteg

n+k patterns

2002-01-29 Thread Simon Peyton-Jones
Folks The Haskell Report says of n+k patterns: "A n+k pattern can only be matched against a value in the class Integral." This seems far too strong. All that is needed are Ord (for the >= and -) and Num (for fromInteger), and indeed that's what GHC requires. Do Hugs or nhc actually require

RE: Haskell 98 report; D Specification of Derived Instances

2002-01-29 Thread Simon Peyton-Jones
| Just before Section D.1 there is the sentence | | When inferring the context for the derived instances, type | synonyms must be expanded out first. | | I don't understand it. Which type synonyms need expansion? Consider type Foo a = [a] data T a = MkT (Foo a) deriving( Eq )