[Haskell-cafe] Re: Tutorial uploaded
Tomasz Zielonka
tomasz.zielonka at gmail.com
Wed Dec 21 03:58:06 EST 2005
On Tue, Dec 20, 2005 at 10:04:16PM +0100, Benjamin Franksen wrote:
> and would also be unsafe without some kind of strong guarantee that each
> single 'world' value is unique. (This is how they do it in Clean.)
> Imagine
>
> g :: World -> World
> g world = let world' = putStrLn "first line" world
> in putStrLn "second line" world -- oops, forgot the "'"
A more scary example:
getLine :: World -> (World, String)
getTwoLines :: World -> (World, String, String)
getTwoLines world =
let (world', line1) = getLine world
(world'', line2) = getLine world -- oops, should use world' here
in (world'', line1, line2)
So we forgot about world', but used line1, which was produced together
with world'.
Best regards
Tomasz
--
I am searching for a programmer who is good at least in some of
[Haskell, ML, C++, Linux, FreeBSD, math] for work in Warsaw, Poland
More information about the Haskell-Cafe
mailing list