Hello,
thank you for the discussion on eager evaluation.
For solving my memory problem I finally used the
x == x `seq` return x
approach because it is easier to derive Eq classes automatically than to
write some sequentialisation functions.
(First I defined
class Eager a where
eager :: a -> a
and some instances:
instance Eager Int where
eager i = i `seq` i
instance Eager Char where
eager c = c `seq` c
instance Eager a => Eager [a] where
eager [] = []
eager (x : xs) = eager x `seq` eager xs `seq` (x : xs)
instance Eager a => Eager (a, a) where
eager (x, y) = eager x `seq` eager y `seq` (x, y)
(Is this correct?)
But I stopped here because its quite a lot of work to give all the
instances for the types involved. Furthermore, I was not sure how to cope
with record types.)
Michael
- RE: How to force evaluation entirely? Simon Peyton-Jones
- RE: How to force evaluation entirely? John Hughes
- RE: How to force evaluation entirely? Ch. A. Herrmann
- RE: How to force evaluation entirely? Patrik Jansson
- Re: How to force evaluation entirely? Lennart Augustsson
- Re: How to force evaluation entirely? Fergus Henderson
- RE: How to force evaluation entirely? John Hughes
- Re: How to force evaluation entirely? Marcin 'Qrczak' Kowalczyk
- Re: How to force evaluation entirely? Bjorn Lisper
- Re: How to force evaluation entirely? Carl R. Witty
- Re: How to force evaluation entirely? Michael Marte
- Re: How to force evaluation entirely? Zhanyong Wan
- Re: How to force evaluation entirely? Ch. A. Herrmann
- Re: How to force evaluation entirely? Ch. A. Herrmann
- Re: How to force evaluation entirely? Carl R. Witty
