[Haskell] Re: RFC: DData in hierarchical libraries

JP Bernardy jyp_7 at yahoo.com
Thu Mar 11 02:33:38 EST 2004


--- Johannes Waldmann <waldmann at imn.htwk-leipzig.de>
wrote:
> A few comments on the DData.Map proposal:
> 
> * nice work. I might start using it (instead of
> Data.FiniteMap)
>    just because the function names look better :-)

Cool! ;)

> * argument ordering:
> 
>    the existing Data.FiniteMap mostly has
>        f :: FiniteMap -> ... -> FiniteMap
>    while the proposal uses
>        f :: ... -> FiniteMap -> FiniteMap
>    I think the Edison guidelines are quite nice:
>
http://www.haskell.org/ghc/docs/edison/users004.html#toc10
>    Did you follow them? What exceptions?

I have this additional top-priority rule:

Whenever a function has the same name as one in
Data.List, it should have a corresponding type.

But basically, those rules are followed.

The above difference you mention is justified by ...
"Functions that modify a collection should take the
collection last."

> * types: some functions are not declared at their
> most
>    general type (I checked by commenting out the
> decl. and asking ghci)
> 
> difference :: forall a1 k a.
>                (Ord k) =>
>                Map k a1 -> Map k a -> Map k a1
> 
> differenceWithKey :: forall a1 k a.
>                       (Ord k) =>
>                       (k -> a1 -> a -> Maybe a1) ->
> Map k a1 -> Map k a
> -> Map k a1
> 
> intersection :: forall a k a1.
>                  (Ord k) =>
>                  Map k a -> Map k a1 -> Map k a
> 
> intersectionWith :: forall a k a2 a1.
>                      (Ord k) =>
>                      (a1 -> a2 -> a) -> Map k a1 ->
> Map k a2 -> Map k a
> 
> 
> intersectionWithKey :: forall a k a1 a2.
>                         (Ord k) =>
>                         (k -> a2 -> a1 -> a) -> Map
> k a2 -> Map k a1 -> 
> Map k a
> 
> isSubsetOfBy :: forall a1 k a.
>                  (Ord k) =>
>                  (a -> a1 -> Bool) -> Map k a -> Map
> k a1 -> Bool

Well spotted. I'll change those. 

Cheers,
JP.


__________________________________
Do you Yahoo!?
Yahoo! Search - Find what you’re looking for faster
http://search.yahoo.com


More information about the Libraries mailing list