From d5f7d96e89142b9b2c78ee3c93ab2e3d386267f8 Mon Sep 17 00:00:00 2001 From: Miles Frain Date: Mon, 11 Jan 2021 00:30:20 -0800 Subject: [PATCH 1/4] Add Eq1 Ord1 to NonEmptyList --- src/Data/List/Types.purs | 3 +++ 1 file changed, 3 insertions(+) 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 <> ")" From e1a39df172b942449e19eb9e0b45fffcd417d027 Mon Sep 17 00:00:00 2001 From: Miles Frain Date: Mon, 11 Jan 2021 00:32:55 -0800 Subject: [PATCH 2/4] Add Eq1 Ord1 to Lazy NonEmptyList --- src/Data/List/Lazy/Types.purs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/Data/List/Lazy/Types.purs b/src/Data/List/Lazy/Types.purs index 57f9d26..c2727ea 100644 --- a/src/Data/List/Lazy/Types.purs +++ b/src/Data/List/Lazy/Types.purs @@ -211,6 +211,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 <> ")" From 3ae92a24c2a191c338c606d2aeecfc39e00f6b33 Mon Sep 17 00:00:00 2001 From: Miles Frain Date: Wed, 13 Jan 2021 19:09:50 -0800 Subject: [PATCH 3/4] Fix Eq1 Ord1 for Lazy NonEmptyList --- src/Data/List/Lazy/Types.purs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/Data/List/Lazy/Types.purs b/src/Data/List/Lazy/Types.purs index c2727ea..5dbf82c 100644 --- a/src/Data/List/Lazy/Types.purs +++ b/src/Data/List/Lazy/Types.purs @@ -211,8 +211,11 @@ 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 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 <> ")" From beb1765a1aaad26566756acfdb4bb4db8fc5a4a4 Mon Sep 17 00:00:00 2001 From: milesfrain Date: Thu, 14 Jan 2021 10:39:27 -0800 Subject: [PATCH 4/4] Update changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) 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: