From aef39a581a43df0fe00d00015d667fb51b7ff66f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Hamal=20Dvo=C5=99=C3=A1k?= <mordae@anilinux.org> Date: Sun, 26 Jan 2020 18:00:33 +0100 Subject: [PATCH] Make NoteLevel a Monoid MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Jan Hamal Dvořák <mordae@anilinux.org> --- lib/Hikaru/Form.hs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/Hikaru/Form.hs b/lib/Hikaru/Form.hs index 6cb07b3..b25a558 100644 --- a/lib/Hikaru/Form.hs +++ b/lib/Hikaru/Form.hs @@ -128,7 +128,13 @@ where = NoteError | NoteNeutral | NoteSuccess - deriving (Eq, Ord) + deriving (Eq, Ord, Show) + + instance Semigroup NoteLevel where + (<>) = min + + instance Monoid NoteLevel where + mempty = NoteSuccess newtype FormT l m a -- GitLab