{-# OPTIONS --cubical --safe #-} open import Prelude open import Algebra module Data.Maybe.Monoid {โ} {๐ : Type โ} (sgr : Semigroup ๐) where open import Data.Maybe open Semigroup sgr _ยซโยป_ : Maybe ๐ โ Maybe ๐ โ Maybe ๐ nothing ยซโยป y = y just x ยซโยป nothing = just x just x ยซโยป just y = just (x โ y) maybeMonoid : Monoid (Maybe ๐) maybeMonoid .Monoid._โ_ = _ยซโยป_ maybeMonoid .Monoid.ฮต = nothing maybeMonoid .Monoid.assoc nothing y z = refl maybeMonoid .Monoid.assoc (just x) nothing z = refl maybeMonoid .Monoid.assoc (just x) (just xโ) nothing = refl maybeMonoid .Monoid.assoc (just x) (just y) (just z) = cong just (assoc x y z) maybeMonoid .Monoid.ฮตโ _ = refl maybeMonoid .Monoid.โฮต nothing = refl maybeMonoid .Monoid.โฮต (just x) = refl