Skip to content

Support PartialEq and PartialOrd #285

@JordanMartinez

Description

@JordanMartinez

See Rust for example:

-- symmetric: a `eq` b == b `eq` a
-- transitive: a `eq` b == b `eq` c == a `eq` c
class PartialEq a where
  eq :: a -> a -> Boolean
  
notEq :: forall a. PartialEq a => a -> a -> Boolean
notEq = not <<< eq

-- reflexive a `eq` a
class PartialEq a <= Eq a

-- pre order
class PartialEq <= PartialOrd a where
  pcompare :: a -> a -> Maybe Ordering
  lt :: a -> a -> Boolean
  lte :: a -> a -> Boolean
  gt :: a -> a -> Boolean
  gte :: a -> a -> Boolean

-- total order
class (Eq a, PartialOrd a) <= Ord a where
  compare :: a -> a -> Ordering

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions