Subject:  Re: [Haskellcafe] Strictness leak 

From:  Jeff Polakow 
Date:  Wed, 31 Oct 2007 01:05:25 0400 
I forgot to send this reponse to haskellcafe earlier... Hello, > You mean for the IO monad, right? > Sorry. I meant divergence is unavoidable for any strict Monad, such as IO. However, sequence will always compute over the entire list; if the resulting computation itself is lazy then the result can be inspected lazily. > take 10 $ execWriter $ sequence $ repeat $ tell ([3]::[Int]) > This is a good example. Note that the computation of sequence itself is infinite. snd $ runWriter $ sequence (repeat $ tell [3]) >>= return . take 10 will result in an infinite list, but fst $ runWriter $ sequence (repeat $ tell [3]) >>= return . take 10 will return a 10 element list. Jeff  This email may contain confidential and/or privileged information. If you are not the intended recipient (or have received this email in error) please notify the sender immediately and destroy this email. Any unauthorized copying, disclosure or distribution of the material in this email is strictly forbidden. _______________________________________________ HaskellCafe mailing list [email protected] http://www.haskell.org/mailman/listinfo/haskellcafe 
<Prev in Thread]  Current Thread  [Next in Thread> 


Previous by Date:  Re: [Haskellcafe] Type inference problem with division (/), Shachaf BenKiki 

Next by Date:  [Haskellcafe] help needed packaging curl bindings, brad clawsie 
Previous by Thread:  Re: [Haskellcafe] Type inference problem with division (/), Shachaf BenKiki 
Next by Thread:  Re: [Haskellcafe] Strictness leak, Ketil Malde 
Indexes:  [Date] [Thread] [Top] [All Lists] 