[Haskell] Strange "let"

Jinwoo Lee blue6811 at freechal.com
Wed Jul 21 01:49:25 EDT 2004


I didn't think that this could be a function definition.
Thank you.
 

> -----Original Message-----
> From: Ben Lippmeier [mailto:Ben.Lippmeier at anu.edu.au] 
> Sent: Wednesday, July 21, 2004 2:41 PM
> To: Jinwoo Lee
> Cc: haskell at haskell.org
> Subject: Re: [Haskell] Strange "let"
> 
> 
> Ha!,
> 
> What you've done is redefine the (+) function.. try 10 + 30 
> and see what 
> you get.
> Your local definition shadows the "real" (+) function defined in the 
> prelude.
> 
> let a + b = 3
> 
> is equivalent to
> 
> let (+) a b = 3
> 
> ...
> 
> 
> 
> Jinwoo Lee wrote:
> 
> >Hi,
> > 
> >I'm a Haskell newbie.
> > 
> >I was trying several things with GHCi and found out that the 
> expression "let
> >a + b = 3" does not generate any errors.
> > 
> >Prelude> let a + b = 3
> >Prelude> a
> >
> ><interactive>:1: Variable not in scope: `a'
> >Prelude> b
> >
> ><interactive>:1: Variable not in scope: `b'
> >Prelude>
> >
> >What does "let a + b = 3" mean in this case?
> >
> >I also tries with GHC compiler using the code below, but it 
> generates no
> >error.
> >
> >main :: IO ()
> >main =
> >  do let a + b = 3
> >     putStrLn "Hello"
> >
> >Could somebody answer this?
> >
> >Jinwoo
> >
> >
> >_______________________________________________
> >Haskell mailing list
> >Haskell at haskell.org
> >http://www.haskell.org/mailman/listinfo/haskell
> >
> >  
> >
> 
> 




More information about the Haskell mailing list