[Haskell-cafe] New to Haskell

Cristian Baboi cristi at ot.onrc.ro
Tue Dec 18 04:53:51 EST 2007


On Tue, 18 Dec 2007 10:29:43 +0200, Miguel Mitrofanov  
<miguelimo38 at yandex.ru> wrote:

>> What I should have been told about upfront:
>> - the syntax for an expression
>> - the syntax for a block

> Don't see your point.

The point is the syntax is introduced as transformation of layout form to  
non layout form.
As a user, I just want to be able to spot the basic components of a source  
file without thinking about transformation rules.

>> - the adhoc syntax rules (how to distinguish among a tuple and a
>> pharanthesized expression and how to find the start and end of a block  
>> for
>> example )

> Oh, that's pretty easy, parenthesized expression is not divided by a  
> comma.

Thanks! What is the end of a block ? What introduce new blocks ?
Is this legal (`plus`) x y ?
It's this a tuple ?  ([a,b,c,d ]) ?

etc.

>> - what guarantees are made by the LANGUAGE that an IO action (such as   
>> do
>> putStrLn "Hello world" ) is not performed twice
>
> There are no such guarantees. If you write
>
> a = putStrLn "Hello world"
> main = do {a; a;}
>
> then your putStrLn would be performed twice. IO actions are first-class  
> values, that's a feature, not a bug.


What guarantees that by running the main, the string "Hello world" will be  
printed exactly twice ?

>> - the lambda expressions can be written (input) but cannot be printed
>> (output)

> Yes, since two different lambda expressions can denote the same function.
I just want the sistem to be able to print one of these expressions !

Its this too much to ask ?
I find it very strange that I can write a lambda expresion, but the system  
cannot.


> No, pattern matching bounds variables; if you write "case x of {aa ->  
> ...} then aa becomes a LOCAL variable for the case statement, and  
> shadows the global definition. The same applies to u and v in h, except  
> that in this case local variables shadow upper-level local variables.

Ok.


________ Information from NOD32 ________
This message was checked by NOD32 Antivirus System for Linux Mail Servers.
  part000.txt - is OK
http://www.eset.com


More information about the Haskell-Cafe mailing list