From ccd7117c31074069414eb00dd0b7ed6b648ddeff Mon Sep 17 00:00:00 2001 From: tv Date: Fri, 25 Jan 2019 01:43:05 +0100 Subject: Blessings: satisfy Semigroup and Monoid laws --- src/Blessings.hs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/Blessings.hs b/src/Blessings.hs index 21fe3d8..56c1af0 100644 --- a/src/Blessings.hs +++ b/src/Blessings.hs @@ -5,7 +5,6 @@ module Blessings where import Control.Applicative import Data.List -import Data.Semigroup import Data.String import Data.Ix (inRange) @@ -37,11 +36,14 @@ instance Functor Blessings where instance Semigroup (Blessings a) where - (<>) = Append + t <> Empty = t + Empty <> t = t + Append t1 t2 <> Append t3 t4 = t1 <> t2 <> t3 <> t4 + Append t1 t2 <> t3 = t1 <> t2 <> t3 + t1 <> t2 = Append t1 t2 instance Monoid (Blessings a) where - mappend = Append mempty = Empty -- cgit v1.2.3