[Haskell-cafe] seq - RTFM?

Christophe Poucet christophe.poucet at gmail.com
Fri Jul 21 08:21:18 EDT 2006


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 at 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
--------------------------------------------------------------------------------
<IMEC e-mail disclaimer: http://www.imec.be/wwwinter/email-disclaimer.shtml>


More information about the Haskell-Cafe mailing list