diff options
Diffstat (limited to 'Types')
-rw-r--r-- | Types/Cost.hs | 8 | ||||
-rw-r--r-- | Types/Storage.hs | 2 |
2 files changed, 6 insertions, 4 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 diff --git a/Types/Storage.hs b/Types/Storage.hs index c83593a..c145812 100644 --- a/Types/Storage.hs +++ b/Types/Storage.hs @@ -16,7 +16,7 @@ import Data.Aeson.Types -- | All known locations where shares can be stored, ordered with -- preferred locations first. newtype StorageLocations = StorageLocations [Storage] - deriving (Monoid) + deriving (Monoid, Semigroup) newtype LocalStorageDirectory = LocalStorageDirectory FilePath |