
Ross Paterson wrote:
All the usual advantages of abstraction. I thought SizedSeq was pretty compelling:
data Sized s a = N !Int (s a) instance Sequence s => Sequence (Sized s) where ...
One instance gets you N new sequences.
The disadvantage for the user is that for a "Sized Seq" also "Seq" will be in scope and changing the implementation either requires to rename types, to use clever type synonyms, or to use the "Sequence" class constraint. However, I would not mind such a class if it eases other implementions, but from a user's point of view, I want different modules with the same interface (and as few as possible class constraints). "data Sized" is of course generally useful (not only for Sequence) and may be accompanied by a couple of wrap and unwrap functions for certain function profiles to be lifted. Christian