andy at galois.com
Fri Apr 7 17:38:26 EDT 2006
On Apr 7, 2006, at 3:59 AM, Rene de Visser wrote:
> As deepSeq has a non local effect, I think it requires a non-local
> source transformation to implement it. One option would be for the
> compiler to create a second deepSeq version of every function
> If the user defines a function f
> f x = g h x
> then the compile creates an additional function !!f
> !!f x = temp `seq` temp
> where temp = !!g !!h x
> which uses the compiler generated functions !!g and !!h.
> It looks like library writers are increasingly doing this manually.
> Creating a strict and non strict version of a number of the
> functions provided. This would automate that.
It depend on the semantics of deepSeq. If deepSeq just performs seq
on all constructors recursively, then
that can be implemented as a runtime primitive. If deepSeq is making
all embedded partial applications
strict, then yes this might be a non-local effect.
What are the semantics of !!(\ x -> ...)?
I am calling for the version of deepSeq/strict that evaluates all
thunks, but does not strictify the arguments
to partial application, because
- I believe this is straightforward to implement
- It does not change the semantics (any more than seq)
- I will address the problems we are trying to solve by ad-hoc
means at Galois.
More information about the Haskell-prime