Heirarchical name space allocation /Trees
maeder at tzi.de
Thu Apr 1 13:00:59 EST 2004
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
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.
More information about the Libraries