From c25cd667ece351c71bc9fc89fe47a26229de1794 Mon Sep 17 00:00:00 2001 From: Asad Saeeduddin Date: Wed, 4 Sep 2019 18:27:16 -0400 Subject: [PATCH] Add newtype instance for Alternate --- bower.json | 3 ++- src/Data/Monoid/Alternate.purs | 3 +++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/bower.json b/bower.json index 3f8098d..3810192 100644 --- a/bower.json +++ b/bower.json @@ -16,7 +16,8 @@ "package.json" ], "dependencies": { - "purescript-prelude": "^4.0.0" + "purescript-prelude": "^4.0.0", + "purescript-newtype": "^3.0.0" }, "devDependencies": { "purescript-effect": "^2.0.0" diff --git a/src/Data/Monoid/Alternate.purs b/src/Data/Monoid/Alternate.purs index f0eeab3..2567d43 100644 --- a/src/Data/Monoid/Alternate.purs +++ b/src/Data/Monoid/Alternate.purs @@ -5,6 +5,7 @@ import Prelude import Control.Alternative (class Alt, class Plus, class Alternative, empty, (<|>)) import Control.Comonad (class Comonad, class Extend) import Data.Eq (class Eq1) +import Data.Newtype (class Newtype) import Data.Ord (class Ord1) -- | Monoid and semigroup instances corresponding to `Plus` and `Alt` instances @@ -16,6 +17,8 @@ import Data.Ord (class Ord1) -- | ``` newtype Alternate f a = Alternate (f a) +derive instance newtypeAlternate :: Newtype (Alternate f a) _ + derive newtype instance eqAlternate :: Eq (f a) => Eq (Alternate f a) derive newtype instance eq1Alternate :: Eq1 f => Eq1 (Alternate f)