holy frijoles: constant factors matter.

John Meacham john at repetae.net
Thu Oct 13 21:01:54 EDT 2005


On Thu, Oct 13, 2005 at 05:28:05AM -0400, Cale Gibbard wrote:
> I'd just like to mention that I proposed these a while back :)
> (The post was titled "Data.Map, Data.Set working together")
> 
> Here are some things which I'd like to see:
> 
> Restrict a function to a finite map: restrict :: (Ord a) => (a -> b)
> -> (Set a) -> (Map a b)
> 
> Restrict one map to another: restrictMap :: (Ord a) => (Map a b) ->
> (Set a) -> (Map a b)
> (maybe a typeclass for the above two?)
> 
> Domain of a map: domain :: (Ord a) => (Map a b) -> (Set a)
> 
> Range of a map: range :: (Ord a, Ord b) => (Map a b) -> (Set b)
> 
> It would also be nice to have things like
> join :: (Ord a) => Set (Set a) -> Set a
> (this is union, will correspond to monadic join once that's possible :)
> and powerSet :: Set a -> Set (Set a).

These all seem useful too. I was thinking that the actual data
declarations for Set and Map could be split off to their own module
Data.Containers.Private?
GHC.SetMap?

and Data.Set and Data.Map could export their fully abstract versions
but would be able to get at each others internal structure.

another thing that is sorely missing is monadic versions of the mapping
functions and a FunctorM instance.

        John



-- 
John Meacham - ⑆repetae.net⑆john⑈ 


More information about the Libraries mailing list