Re: [Haskell-cafe] Question on "case x of g" when g is a function

2005-01-27 Thread Hamilton Richards
If he really wanted to use a case-expression, he could write it this way: f x = case x of False -> 0 True -> 1 --Ham At 1:02 PM +0100 2005/1/27, Henning Thielemann wrote: On Thu, 27 Jan 2005 [EMAIL PROTECTED] wrote: Can a kind soul please enlighten me on why f bit0 and f bit1 bo

RE: [Haskell-cafe] Question on "case x of g" when g is a function

2005-01-27 Thread Bayley, Alistair
m: Salvador Lucas [mailto:[EMAIL PROTECTED] > Sent: 27 January 2005 09:59 > To: [EMAIL PROTECTED] > Cc: haskell-cafe@haskell.org > Subject: Re: [Haskell-cafe] Question on "case x of g" when g > is a function > > Because both bit0 and bit1 are free *local* variables >

Re: [Haskell-cafe] Question on "case x of g" when g is a function

2005-01-27 Thread Henning Thielemann
On Thu, 27 Jan 2005 [EMAIL PROTECTED] wrote: > Can a kind soul please enlighten me on why f bit0 and f bit1 > both return 0? > > > bit0 = False > > bit1 = True > > f x = case x of > > bit0 -> 0 > > bit1 -> 1 If you compile with 'ghc -Wall' GHC should report that the ident

Re: [Haskell-cafe] Question on "case x of g" when g is a function

2005-01-27 Thread Salvador Lucas
Because both bit0 and bit1 are free *local* variables within the case expression. So, they have nothing to do with your defined functions bit0 and bit1. Best regards, Salvador. [EMAIL PROTECTED] wrote: Can a kind soul please enlighten me on why f bit0 and f bit1 both return 0? bit0 = False

[Haskell-cafe] Question on "case x of g" when g is a function

2005-01-27 Thread yeoh
Can a kind soul please enlighten me on why f bit0 and f bit1 both return 0? > bit0 = False > bit1 = True > f x = case x of > bit0 -> 0 > bit1 -> 1 ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mai