: Strictness annotations on type parameters
|
| I spent several days last week trying to track a cause of a 100%
| slowdown after some trivial changes I made. The profiler didn't show
any
| slowdown, presumably because it was dependent on optimizations, so I
had
| to revert to tweak-run-measure cycle
It's hard to avoid the feeling that one ought to be able to say
something useful about strictness in the types but it's swampy
territory, and hard to get right.
Fortunately, it's easy to dry up the `swampy territory'. The type
`Contract' below models strictness requirements. The function
Hello Ralf,
Wednesday, December 07, 2005, 12:43:33 PM, you wrote:
It's hard to avoid the feeling that one ought to be able to say
something useful about strictness in the types but it's swampy
territory, and hard to get right.
RH Fortunately, it's easy to dry up the `swampy territory'. The
It's not at all easy in general. Suppose we have
f :: [!a] - [a]
f xs = xs
Does f run down the list, behind the scenes, evaluating each element?
No, because what [!a] means is List !a = ([] | !a : List !a). It
does not mean ([] | !(!a : List !a)). Since the Cons thunks
I spent several days last week trying to track a cause of a 100%
slowdown after some trivial changes I made. The profiler didn't show any
slowdown, presumably because it was dependent on optimizations, so I had
to revert to tweak-run-measure cycle.
It turned out the slowdown was caused
On Tue, 2005-12-06 at 16:05 -0500, Mario Blazevic wrote:
No container data type can be annotated as strict. That means I have
to pepper my code with explicit evaluations to HNF before every
writeIORef (reference label):
newState `seq` writeIORef (reference label) newState
Or it can be