Suppose we have the situation, perhaps not too far distant, where Haskell 
compilers generate highly efficient code.  I tend to think that even though
Haskell is (becoming) quite general purpose, there is still going to be
some resistance from programmers at large, because many are concerned with
being able to reasonably predict complexity.

Perhaps this can be dealt with, at least partially, at the language level.
Proposal: introduce a substitution operator which preserves safe semantics 
but explicitly indicates where updates may occur, so an analysis phase is 
still needed.  Such an operator could be applied to general data structures.
Example:

Instead of:
    change (_:xs) 0 y = y:xs
    change (x:xs) i y = x:change xs (i-1) y

Use (with more or less arbitrary syntax): 
    change xs@(x:_) 0 y = xs[x->y]
    change xs@(_:xs') i y = xs[xs'->change xs' (i-1) y]


Comments?

-George

Reply via email to