diff options
| author | Edoardo La Greca | 2025-09-11 16:16:33 +0200 |
|---|---|---|
| committer | Edoardo La Greca | 2025-09-11 16:16:33 +0200 |
| commit | 80c99d3eb8cef4b14d06c5e38dec113125bcbfbf (patch) | |
| tree | e8458dc8e68cb2e2e13420eb790371175202ecca /lec07 | |
| parent | 04edf91c24af0cbe29a056c1a05ccffce05c293d (diff) | |
change Sized module due to old age
Diffstat (limited to 'lec07')
| -rw-r--r-- | lec07/Sized.hs | 13 |
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 + (<>) = (+) + |