From 3330185393f1275c8090e9ac08018e480db0adba Mon Sep 17 00:00:00 2001 From: Rockingcool Date: Fri, 9 May 2025 12:17:22 -0500 Subject: [PATCH] Make MdToken a Semigroup and a Monoid, so that I can use 'mempty' for it. --- src/MdToHTML.hs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/MdToHTML.hs b/src/MdToHTML.hs index 0192dd3..d491290 100644 --- a/src/MdToHTML.hs +++ b/src/MdToHTML.hs @@ -60,6 +60,12 @@ instance Show MdToken where show (Strikethrough token) = "" ++ show token ++ "" show (Unit unit) = printf "%s" unit +instance Semigroup MdToken where + a <> b = Document [a, b] + +instance Monoid MdToken where + mempty = Unit "" + -- --------------- -- Helpers leftmostLongest :: (Foldable t) => [(a, t b)] -> (a, t b)