RE: Strictness annotations on type parameters

2005-12-07 Thread Simon Peyton-Jones
: 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

Re: Strictness annotations on type parameters

2005-12-07 Thread Ralf Hinze
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

Re[2]: Strictness annotations on type parameters

2005-12-07 Thread Bulat Ziganshin
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

Re: Strictness annotations on type parameters

2005-12-07 Thread Mario Blazevic
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

Strictness annotations on type parameters

2005-12-06 Thread Mario Blazevic
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

Re: Strictness annotations on type parameters

2005-12-06 Thread Duncan Coutts
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