summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEdoardo La Greca2025-09-11 16:16:33 +0200
committerEdoardo La Greca2025-09-11 16:16:33 +0200
commit80c99d3eb8cef4b14d06c5e38dec113125bcbfbf (patch)
treee8458dc8e68cb2e2e13420eb790371175202ecca
parent04edf91c24af0cbe29a056c1a05ccffce05c293d (diff)
change Sized module due to old age
-rw-r--r--lec07/Sized.hs13
1 files changed, 13 insertions, 0 deletions
diff --git a/lec07/Sized.hs b/lec07/Sized.hs
index 9214b76..762d8fb 100644
--- a/lec07/Sized.hs
+++ b/lec07/Sized.hs
@@ -23,6 +23,19 @@ instance Sized Size where
instance Sized b => Sized (a,b) where
size = size . snd
+-- Since (<>) has been moved from Monoid to Semigroup, this little change is required
+
+-- Old version
+{-
instance Monoid Size where
mempty = Size 0
mappend = (+)
+-}
+
+-- New version
+instance Monoid Size where
+ mempty = Size 0
+
+instance Semigroup Size where
+ (<>) = (+)
+