summaryrefslogtreecommitdiffhomepage
path: root/Types/Cost.hs
diff options
context:
space:
mode:
Diffstat (limited to 'Types/Cost.hs')
-rw-r--r--Types/Cost.hs8
1 files changed, 5 insertions, 3 deletions
diff --git a/Types/Cost.hs b/Types/Cost.hs
index 521d6c1..cd0a9f6 100644
--- a/Types/Cost.hs
+++ b/Types/Cost.hs
@@ -26,13 +26,15 @@ newtype Divisibility = Divisibility Integer
data UsingHardware = UsingCPU | UsingGPU | UsingASIC
deriving (Show)
-instance Monoid (Cost t) where
- mempty = CPUCost (Seconds 0) (Divisibility 1)
- CPUCost (Seconds a) (Divisibility x) `mappend` CPUCost (Seconds b) (Divisibility y) =
+instance Semigroup (Cost t) where
+ CPUCost (Seconds a) (Divisibility x) <> CPUCost (Seconds b) (Divisibility y) =
-- Take maximum divisibility, to avoid over-estimating
-- the total cost.
CPUCost (Seconds (a+b)) (Divisibility $ max x y)
+instance Monoid (Cost t) where
+ mempty = CPUCost (Seconds 0) (Divisibility 1)
+
-- | Operations whose cost can be measured.
data DecryptionOp
data CreationOp