
Hello all, my question is probably dull. So answers to better investigate manual are welcome. Why is this correct? ___ ___ _ / _ \ /\ /\/ __(_) / /_\// /_/ / / | | GHC Interactive, version 6.4.1, for Haskell 98. / /_\\/ __ / /___| | http://www.haskell.org/ghc/ \____/\/ /_/\____/|_| Type :? for help. Loading package base-1.0 ... linking ... done. Prelude> putStr "Ahoj\n" Ahoj Prelude> putStr "Ahoj\n" `seq` 3+3 6 Prelude> :q Leaving GHCi. And not Prelude> putStr "Ahoj\n" Ahoj Prelude> putStr "Ahoj\n" `seq` 3+3 Ahoj 6 ??? Does it have something common with monads or is it a behavior of seq? Thanks, Dusan

On 21/07/06, Dusan Kolar
Prelude> putStr "Ahoj\n" Ahoj Prelude> putStr "Ahoj\n" `seq` 3+3 6 Prelude> :q Leaving GHCi.
And not
Prelude> putStr "Ahoj\n" Ahoj Prelude> putStr "Ahoj\n" `seq` 3+3 Ahoj 6
Well, I understand that seq evaluates the first argument. But the result of evaluating putStr is a monadic action. Not execution of that action. Regards, Piotr Kalinowski -- Intelligence is like a river: the deeper it is, the less noise it makes

Hi Dusan,
my question is probably dull. So answers to better investigate manual are welcome. Why is this correct?
the Haskell Report is probably better in explaining the behaviour of 'seq' than me: http://haskell.org/onlinereport/basic.html#sect6.2 Regards, Jens

Hello Dusan, The reason why that does not work as you expect it to is because the type of the whole expression is not monadic. Therefore it will basically evaluate the action until it's an action ready to be executed, but not execute it, cause it's not in the IO monad. It's the same as having a list of [putStr "a", putStr "b"]. Until you start placing these actions in the IO monad, they'll just be values. Hope that's somewhat clear Dusan Kolar wrote:
Hello all,
my question is probably dull. So answers to better investigate manual are welcome. Why is this correct?
___ ___ _ / _ \ /\ /\/ __(_) / /_\// /_/ / / | | GHC Interactive, version 6.4.1, for Haskell 98. / /_\\/ __ / /___| | http://www.haskell.org/ghc/ \____/\/ /_/\____/|_| Type :? for help.
Loading package base-1.0 ... linking ... done. Prelude> putStr "Ahoj\n" Ahoj Prelude> putStr "Ahoj\n" `seq` 3+3 6 Prelude> :q Leaving GHCi.
And not
Prelude> putStr "Ahoj\n" Ahoj Prelude> putStr "Ahoj\n" `seq` 3+3 Ahoj 6
???
Does it have something common with monads or is it a behavior of seq?
Thanks,
Dusan
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
--
Christophe Poucet
Ph.D. Student
DESICS - DDT
Phone:+32 16 28 87 20
E-mail: Christophe (dot) Poucet (at) imec (dot) be
IMEC vzw -- Register of Legal Entities Leuven VAT BE 0425.260.668 --
Kapeldreef 75, B-3001 Leuven, Belgium -- http://www.imec.be
--------------------------------------------------------------------------------
participants (4)
-
Christophe Poucet
-
Dusan Kolar
-
Jens Fisseler
-
Piotr Kalinowski