FiniteMap

Ross Paterson ross at soi.city.ac.uk
Tue Sep 5 09:35:11 EDT 2006


On Tue, Sep 05, 2006 at 02:13:33PM +0100, Malcolm Wallace wrote:
> > > So does anyone have any objections if I go ahead and commit the
> > > replacement (compatibility) implementation of Data.FiniteMap to the
> > > main repository for packages/base?
> > 
> > I'd rather see HaXml updated to use Data.Map, perhaps with a
> > compatibility layer for older GHCs.
> 
> OK, I've looked more closely at all uses of Data.FiniteMap in HaXml, and
> they are far from critical, so have reverted them to using simpler
> lookup structures.

Why not do it the other way round:

#if __GLASGOW_HASKELL__ >= 604 || __NHC__ >= 118 || defined(__HUGS__)
-- Data.Map, if it is available
import Prelude hiding (lookup)
import Data.Map (Map, lookup, fromList)
#else
-- otherwise, a very simple and inefficient implementation of a finite map
type Map k a = [(k,a)]
fromList :: [(k,a)] -> Map k a
fromList = id
-- Prelude.lookup :: k -> Map k a -> Maybe a
#endif



More information about the Glasgow-haskell-users mailing list