[m-dev.] New datatype: rope

Julien Fischer juliensf at csse.unimelb.edu.au
Thu Nov 11 15:41:54 AEDT 2010


On Thu, 11 Nov 2010, Paul Bone wrote:

>>> I'd also like to see
>>> more typeclasses in the standard library for collections.  Mutterings have also
>>> been made about first class, and possibly parametric modules.  That is, rather
>>> than use type classes use modules that can be parameterised by other modules.
>>>
>>>     import cord(list) as cord_using_lists
>>>     import cord(slice) as cord_using_slices
>>
>> But that wouldn't achieve what I was after:  allowing mixing of various kinds
>> of sequences in a single rope.
>
> I don't think typeclasses will give you that either.
>
> Perhaps typeclasses and existential types will.

Something like this?

:- type cord_node
         --->    some [T] unit_node(T) => seq(T)
         ;       some [T] list_node(T, list(T)) => seq(T)
         ;       branch_node(cord_node, cord_node).

I would question how much you are going to want to mix different kinds
of sequence in a single rope though.

Julien.
--------------------------------------------------------------------------
mercury-developers mailing list
Post messages to:       mercury-developers at csse.unimelb.edu.au
Administrative Queries: owner-mercury-developers at csse.unimelb.edu.au
Subscriptions:          mercury-developers-request at csse.unimelb.edu.au
--------------------------------------------------------------------------



More information about the developers mailing list