Set.lookup?

Serge D. Mechveliani mechvel at botik.ru
Thu Sep 15 06:46:06 EDT 2005


Dear GHC developers,

How do you think, maybe,  Data.Set  also needs to provide
`lookup' ?

For example, I have   data D = D Int String,

with the instances  Eq and Ord  defined by the first coordinate.
I do use  Map Int String,  and for a certain reason, also use  
Set D.
Then, for example, the function

  check :: D -> Set D -> Bool
  check (D i name) s  =  case Set.lookup (D i name) s
                         of
                         Just (D _ nm) -> name == nm
                         _             -> False
        
looks natural, apart that there is no  Set.lookup.

-----------------
Serge Mechveliani
mechvel at botik.ru


More information about the Glasgow-haskell-users mailing list