-allow-extension-for-bottom

Carsten Schultz carsten at codimi.de
Mon Oct 11 09:15:19 EDT 2004


On Mon, Oct 11, 2004 at 04:32:08PM +0400, Serge D. Mechveliani wrote:
> First, thanks to the people who correct me about `equivalence',
> (I skip the name because the letter was addressed privately).
> 
> Because we do not mean to compile each program to the equivalent
> one of
>         error "bottom"

Your proposal is more in the direction to allow the program `print
(let x = x::Int in x)' to print 42 :-)

> The simplified version of the program is 
> 
>   main = hSetBuffering stdout NoBuffering >> putStr (out "\n")
> 
>   out :: String -> String
> 
>   out = let valueTakingLong =  last [1 .. (10^7)]  > 0
>         in
>         if  valueTakingLong  then  ('a' :) . ('b' :)
>         else                       ('a' :) . ('b' :)
> 
> The author intended 'a' to appear immediately.
> But it appears only after a long time.

Then the author has to write out accordingly.

Compare with:

primes :: [Integer]

primes = ...

main = if (odd (last primes))
       then putStrLn "There is a largest prime number!"
            >> putStrLn "It is odd!"
       else putStrLn "There is a largest prime number!"
            >> putStrLn "It is 2!"

I would not want to have that changed to        

main = putStrLn "There is a largest prime number!"
       >> if (odd (last primes))
          then putStrLn "It is odd!"
          else putStrLn "It is 2!"

Another example is in the use of `interact'.  You dot not want to
print a partial answer before a question is given.

Greetings,

Carsten

-- 
Carsten Schultz (2:38, 33:47), FB Mathematik, FU Berlin
http://carsten.codimi.de/
PGP/GPG key on the pgp.net key servers, 
fingerprint on my home page.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://www.haskell.org//pipermail/glasgow-haskell-users/attachments/20041011/ff34d30b/attachment.bin


More information about the Glasgow-haskell-users mailing list