Skip to content

Default type class member implementations #3067

@gabejohnson

Description

@gabejohnson

@joneshf suggests in #361 (comment) the following (old syntax?)

class Eq a where
  (==) :: a -> a -> Boolean
  (/=) :: a -> a -> Boolean

  instance Eq a where
    (==) x y = not (x /= y)
    (/=) x y = not (x == y)

As an alternative I would like to propose

class Eq a where
  eq :: a -> a -> Boolean
  eq x y = not (notEq x y)

  notEq :: a -> a -> Boolean
  notEq x y = not (eq x y)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions