diff --git a/CHANGELOG.md b/CHANGELOG.md index d1b2aed..cf6f925 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,7 @@ Notable changes to this project are documented in this file. The format is based Breaking changes: New features: +- Added `Eq1` and `Ord1` instances to `NonEmptyList` and `LazyNonEmptyList` (#188) Bugfixes: diff --git a/src/Data/List/Lazy/Types.purs b/src/Data/List/Lazy/Types.purs index 57f9d26..5dbf82c 100644 --- a/src/Data/List/Lazy/Types.purs +++ b/src/Data/List/Lazy/Types.purs @@ -211,6 +211,12 @@ derive instance newtypeNonEmptyList :: Newtype (NonEmptyList a) _ derive newtype instance eqNonEmptyList :: Eq a => Eq (NonEmptyList a) derive newtype instance ordNonEmptyList :: Ord a => Ord (NonEmptyList a) +instance eq1NonEmptyList :: Eq1 NonEmptyList where + eq1 (NonEmptyList lhs) (NonEmptyList rhs) = eq1 lhs rhs + +instance ord1NonEmptyList :: Ord1 NonEmptyList where + compare1 (NonEmptyList lhs) (NonEmptyList rhs) = compare1 lhs rhs + instance showNonEmptyList :: Show a => Show (NonEmptyList a) where show (NonEmptyList nel) = "(NonEmptyList " <> show nel <> ")" diff --git a/src/Data/List/Types.purs b/src/Data/List/Types.purs index abefc0d..eb2b28a 100644 --- a/src/Data/List/Types.purs +++ b/src/Data/List/Types.purs @@ -202,6 +202,9 @@ derive instance newtypeNonEmptyList :: Newtype (NonEmptyList a) _ derive newtype instance eqNonEmptyList :: Eq a => Eq (NonEmptyList a) derive newtype instance ordNonEmptyList :: Ord a => Ord (NonEmptyList a) +derive newtype instance eq1NonEmptyList :: Eq1 NonEmptyList +derive newtype instance ord1NonEmptyList :: Ord1 NonEmptyList + instance showNonEmptyList :: Show a => Show (NonEmptyList a) where show (NonEmptyList nel) = "(NonEmptyList " <> show nel <> ")"