Skip to content

Support PartialEq and PartialOrd #285

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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions