edison question

paul@theV.net paul@theV.net
Wed, 31 Jul 2002 17:42:26 +0800


Thanks, and it works! Another question is where can I find some
documentation on these heap modules? What is the difference
between SkewHeap, LazyPairingHeap, SplayHeap, UnbalancedSet, etc?

I couldn't find any in GHC's documentation.

Regards,
.paul.

On Tue, Jul 30, 2002 at 11:22:26AM -0700, Brian Huffman wrote:
> The Collection module just defines the OrdColl class, without giving any 
> instances for it. To use the Collection module directly, you would have to 
> define one or more instances yourself, something like this:
> 
> data Bag a = ...
> instance OrdColl Bag a where
>   insert a c = ...
>   minElem c = ...
>   ...
> 
> But I assume that you don't want to implement your own collection datatype or 
> write your own insert, minElem, etc. Luckily, Edison comes with a few 
> pre-defined instances of OrdColl, each in a separate module. You just have to 
> import the one you want.
> 
> Replace the line
> > import qualified Collection as C
> with
> > import qualified SkewHeap as C
> (or LazyPairingHeap, or SplayHeap, or UnbalancedSet) and it should work fine.
> 
> Hope this helps.
> - Brian Huffman
>