Re: [Haskell] return?

2004-04-30 Thread Wolfgang Lux
John Meacham wrote: you can make things somewhat better with this construct foo = do baz if cond then return bar else do bua bam Except that this is invalid according to the Haskell report. In note 1 in section 9.3 (Layout), the report explicitly states that "A nes

Re: [Haskell] return?

2004-04-30 Thread Ben_Yu
This actually does do the work, although I don't understand why an extra indentation is not needed. The "do" gives me a big surprise.

Re: [Haskell] return?

2004-04-30 Thread Ben_Yu
Hal Daume III <[E

Re: [Haskell] return?

2004-04-30 Thread Hal Daume III
You can also do something like: myfunction = do ... if somecondition then return 5 else do more stuff here if someothercondition then return 6 else do more stuff here return 7 which will do what you want On Fri, 30 Apr 2004 [EMAIL PROTECTED] wrote: > > > > > Thanks you guys. I r

Re: [Haskell] return?

2004-04-30 Thread Ben_Yu
Thanks you guys. I really love this mail list. Can always learn nice tips from experienced people here. :-) I guess I'll go with the guard suggestion. ContT is nice, but don't want to introduce too much extras to the program just for syntax reason. I do agree with you, Graham. Actually do d

[Haskell] how to print the Report in CM fonts?

2004-04-30 Thread Boyko Bantchev
Hello all, The Haskell98 Report, in its printed form, uses Times and Courier fonts. I would like to have the Report printed in the TeX-standard cm family of fonts (including the tt font which I like much more than Courier as a `computer font'). Some time ago, I tried to do this from the sources i

Re: [Haskell] return?

2004-04-30 Thread Graham Klyne
Is this possible at all? I don't think so, in the form that you suggest. Ultimately, it all comes down to function applications, for which there is no such "bail out". Rather, I think something like this is required: do { ... ; if cond then return 1 else do (the rest)

Re: [Haskell] return?

2004-04-30 Thread John Meacham
On Thu, Apr 29, 2004 at 06:27:32PM -0500, [EMAIL PROTECTED] wrote: > While writing monad programs, I sometimes want to do a return as it is in > imperative program. i.e., > do{return 1; return 2} is same as return 1 > I know I can do > if cond then return 1 else ( > ...--subsequent actions > )

Re: [Haskell] return?

2004-04-30 Thread Tomasz Zielonka
On Thu, Apr 29, 2004 at 06:27:32PM -0500, [EMAIL PROTECTED] wrote: > Hi, > While writing monad programs, I sometimes want to do a return as it is in > imperative program. i.e., > do{return 1; return 2} is same as return 1 > > Is this possible at all? Someone already proposed an Error monad, but I

Re: [Haskell] return?

2004-04-30 Thread Chung-chieh Shan
On 2004-04-29T18:27:32-0500, [EMAIL PROTECTED] wrote: > While writing monad programs, I sometimes want to do a return as it is in > imperative program. i.e., > do{return 1; return 2} is same as return 1 Hello, You can build an error monad transformer along the lines of the Control.Monad.Error mod

[Haskell] APLAS'04: Second Call For Papers

2004-04-30 Thread QIN Shengchao
CALL FOR PAPERS The Second ASIAN Symposium on Programming Languages and Systems (APLAS 2004) Taipei, Taiwan, November 4-6 2004 http://www.comp.nus.edu.sg/~aplas (co-located with ATVA 2004 in Taipei)