> Actually I think you would be better off with a class like
> this:
> 
>   class (Eq key, Ord key) => Dictionary dict key where
>      delete :: key -> dict dat -> dict dat
>      search :: key -> dict dat -> (key, SearchResult dat, dict dat)
>      searchList :: [key] -> dict dat -> ([(key,SearchResult dat)],dict dat)

Ok, I did not reconize this solution, it seems to me the (nearly) proper one.
But why not write:

   class => Dictionary dict where
       delete :: (Eq key, Ord key) => key -> dict key dat -> dict key dat
       ...

So one could avoid multiparamter classes at all. The two types key and dat
should be inferred by the type of dict (which is expressed by 'dict key dat'). I
can't think about a dictionary where key or dat are not associated with dict.

Martin Stein


Reply via email to