DData in hierarchical libraries
JP Bernardy
jyp_7 at yahoo.com
Fri Feb 20 05:26:50 EST 2004
Dear Haskell Librairies Mailing List,
Some time ago we discussed the inclusion of DData in
hierachical libraries.
I remember Simon Marlow proposing someone "thrashes
out the details" and present the result for review.
So, I've played with the code, to come up with a list
of proposed changes.
The rationale behind most of these changes is better
consistency (so enventually the library can use
overloading), simplicity, and readability.
I understand that most of these are trival, mostly
naming issues, and therefore, open the door to
potentially endless and futile disscussions.
My goal is just to pinpoint potential flaws, and have
your opinions.
Then, I would propose a complete revised code, unless
Daan wishes to do so.
Here comes the changes:
* remove the Scc module
Seems to be redundant with SCC in Data.Graph
* foldL, foldR, foldI -> foldl, foldr, foldi
to match Prelude.fold[lr]
* remove find, favouring (!) and lookup.
avoids incoherency with Data.List.find
* rename "single" to "singleton"
more explicit, more usual.
* remove (Queue, Seq).append (favouring "<>")
Unneeded redundancy; addtitonally, the name doesn't
suit well partial application. (implicit infix
meaning)
>map (append q1) listOfQueues
means that q1 is "prepended" to each queue.
* Rename subset & friends.
Similarly, they have an implicit infix meaning.
>filter (subset s1) listOfSets
actually keeps sets that are supersets of s1.
Is there an agreed-upon (operator) name for this?
* Make maps look more like collections of couples.
This involves changing some functions, as such:
> filter f = Map.filterWithKey (curry f)
>
> partition f = Map.partitionWithKey (curry f)
>
> member (k,a) m =
> case Map.lookup k m of
> Nothing -> False
> Just a' -> a == a'
Similarly for fold, etc.
Most debatable issues:
* rename (<>) to (++)
* Make some types instances of Ord and Functor.
Additionnaly, a root name in the hierarchy must be
chosen. A simple "DData" looks good to me. Or Data.Aux
is better?
Cheers,
JP.
__________________________________
Do you Yahoo!?
Yahoo! Mail SpamGuard - Read only the mail you want.
http://antispam.yahoo.com/tools
More information about the Libraries
mailing list