summaryrefslogtreecommitdiffhomepage
path: root/Types/Cost.hs
diff options
context:
space:
mode:
authorJoey Hess <joeyh@joeyh.name>2020-02-14 13:12:26 -0400
committerJoey Hess <joeyh@joeyh.name>2020-02-14 13:12:34 -0400
commitd083843a1f668cf1081b3fd90e390c36698ac604 (patch)
tree61ee7d13191f8a8ca11f86c823b2427179510463 /Types/Cost.hs
parent35e03f947c8c0a15f18229b8d5c6f822b88df94c (diff)
downloadkeysafe-d083843a1f668cf1081b3fd90e390c36698ac604.tar.gz
updated many dependencies, ghc 8.x
Updated many dependencies, notably secret-sharing which dropped the dep on polynomial, and so allows building with ghc 8.x. Did not try to support building with older ghc because the semigroup-monid transition would make it nontrivial. Stackage lts-14.25 is a compromise, since the stack shipped in debian (even unstable) is not able to handle newer ones. This commit was sponsored by Eric Drechsel on Patreon.
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