[Haskell-beginners] Forcing output of show

Hugo Ferreira hmf at inescporto.pt
Wed Oct 26 16:23:20 CEST 2011


Hello,

Apologies for this newbie question.
I have a test function:

testLearnRules train = do
   h <- IO.openFile train IO.ReadMode
   c <- IO.hGetContents h
   let proposedRules = instRules $ words c
   let rs = take 10 $ M.assocs proposedRules
   let _ = show rs
   -- let _ = length rs
   return ()

I realize that nothing is executed due to Haskell's
lazy evaluation. How can I force show to print
something to the screen?

Appreciate any pointers,

TIA,
Hugo F.



More information about the Beginners mailing list