24 Jun 2000 13:54:49 GMT, Marcin 'Qrczak' Kowalczyk <[EMAIL PROTECTED]> pisze:

> I am trying to make an unified system of classes that would catch
> three Edison's families: sequences, collections and associations.
> And maybe the fourth that does not fit into these and is missing:
> arrays. It's hard and complex :-(  Results are less ugly when
> functional dependencies are used, but I still cannot keep the whole
> functionality of current Edison.

Seems that it would get simpler if association maps were expressed as
collections of key:=value pairs (with Eq,Ord instances ignoring the
value component). Association maps would have extra functions, but
they could be always treated as appropriate collections of such pairs.

Is this idea fundamentally broken for some reason?

Advantages: simpler interface, and that concrete collections can easily
provide association maps (those extra functions would be methods with
default implementations).

Names for association maps would get rotated. E.g. instead of separate
    Collection.minElem   :: OrdColl   c a => c a   -> a
    Assoc.minElem        :: OrdAssocX m k => m k a -> a
    Assoc.minElemWithKey :: OrdAssoc  m k => m k a -> (k,a)
there would be single Collection's minElem with a special case being
equivalent to current Assoc.minElemWithKey, and a separate minValue
for association maps that returns only the value.

------------------------------------------------------------------------

Seems that an extended form of context could be useful. E.g.
    (forall a. Coll c a) => ...
means that c is constrained to types for which there exists an
appropriate instance that works for all types a.

Is this a good idea? Is it possible/easy to implement?

-- 
 __("<  Marcin Kowalczyk * [EMAIL PROTECTED] http://qrczak.ids.net.pl/
 \__/            GCS/M d- s+:-- a23 C+++$ UL++>++++$ P+++ L++>++++$ E-
  ^^                W++ N+++ o? K? w(---) O? M- V? PS-- PE++ Y? PGP+ t
QRCZAK                5? X- R tv-- b+>++ DI D- G+ e>++++ h! r--%>++ y-


Reply via email to