silly questions about 'seq'

Koen Claessen koen@cs.chalmers.se
Thu, 13 Feb 2003 10:30:31 +0100 (MET)


John Meacham wondered:

 | what does it mean to apply 'seq' to a function? how
 | does one place an abstraction in WHNF? it seems that
 | the ONLY thing one can do to a function is apply it to
 | some argument so does seq need to apply the function
 | to a dummy argument or something?

Here is a simple example:

  funs :: [Int -> Int]
  funs = [ \x -> x + i | i <- [1..] ]

  f :: Int -> Int
  f = funs !! 1000000

Calculating f, without applying it to arguments, really
takes some time.

Hope this helps,

/Koen

--
Koen Claessen
http://www.cs.chalmers.se/~koen
Chalmers University, Gothenburg, Sweden.