From 19539108b7b5059ff02a59c40dece2c76d61c2db Mon Sep 17 00:00:00 2001
From: Clinton Mead <clinton.mead@paidright.io>
Date: Wed, 23 Aug 2023 01:57:54 +1000
Subject: [PATCH] Add action instances for Identity, Void, Semigroup.First and
 Monoid.First

---
 src/Data/Monoid/Action.hs | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/src/Data/Monoid/Action.hs b/src/Data/Monoid/Action.hs
index ad62006..247490b 100644
--- a/src/Data/Monoid/Action.hs
+++ b/src/Data/Monoid/Action.hs
@@ -19,8 +19,12 @@ module Data.Monoid.Action
        , Torsor(..)
        ) where
 
+import           Data.Functor.Identity (Identity(Identity))
 import           Data.Semigroup
+import qualified Data.Semigroup as Semigroup
 import           Data.Group
+import qualified Data.Monoid as Monoid
+import           Data.Void (Void, absurd)
 
 ------------------------------------------------------------
 --  Monoid and semigroup actions
@@ -128,3 +132,17 @@ newtype Conjugate m = Conjugate { getConjugate :: m }
 
 instance Group m => Action m (Conjugate m) where
   m1 `act` Conjugate m2 = Conjugate $ m1 <> m2 ~~ m1
+
+instance Action (Semigroup.First a) a where
+  act (Semigroup.First m) _ = m
+
+instance Action (Monoid.First a) a where 
+  act (Monoid.First m) s = case m of
+    Nothing -> s
+    Just m' -> m'
+
+instance Action Void a where
+  act = absurd
+
+instance Action m s => Action (Identity m) s where
+  act (Identity m) = act m