commit f55885a59ed7dea463187ddcf6ca7522cc2f624d
parent 076b206e37f0c2e14d4723f67a187a75bc970e73
Author: Jared Tobin <jared@jtobin.io>
Date: Wed, 15 Mar 2023 19:22:43 +0400
Use generic monoidal unit.
Diffstat:
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/lib/Okasaki/Heap/Leftist.hs b/lib/Okasaki/Heap/Leftist.hs
@@ -58,7 +58,7 @@ one x = Fix (NodeF 1 x lef lef)
ran :: Heap a -> Sum Int
ran h = case project h of
- LeafF -> 0
+ LeafF -> mempty
NodeF r _ _ _ -> r
mer :: Ord a => Heap a -> Heap a -> Heap a
@@ -139,7 +139,7 @@ gas = hylo alg lag where
wyt :: Heap a -> Int
wyt = getSum . cata alg where
alg = \case
- LeafF -> 0
+ LeafF -> mempty
NodeF _ _ l r -> 1 <> l <> r
-- reference
diff --git a/lib/Okasaki/Heap/Leftist/Weighted.hs b/lib/Okasaki/Heap/Leftist/Weighted.hs
@@ -48,12 +48,12 @@ one x = Fix (NodeF 1 x lef lef)
siz :: Heap a -> Sum Int
siz h = case project h of
- LeafF -> 0
+ LeafF -> mempty
NodeF r _ _ _ -> r
wyt :: Heap a -> Sum Int
wyt = cata $ \case
- LeafF -> 0
+ LeafF -> mempty
NodeF _ _ l r -> 1 <> l <> r
mer :: Ord a => Heap a -> Heap a -> Heap a