Skip to content

one PQueue datatype with type parameter for priority order #8

@amigalemming

Description

@amigalemming

Currently you define MaxPQueue as wrapper around MinPQueue. I would prefer a general PQueue data type with a type parameter that chooses between the Min and Max variant.
That would save the wrapper code in Data.PQueue.Max and code duplication in custom utility functions.
I think it can still be Haskell 98 with definitions like these:

class Dir dir where dirCompare :: (Ord a) => dir -> a -> a -> Ordering
data Min = Min; instance Dir Min where dirCompare Min = compare
data Max = Max; instance Dir Max where dirCompare Max = flip compare

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions