summaryrefslogtreecommitdiffhomepage
path: root/Types
diff options
context:
space:
mode:
Diffstat (limited to 'Types')
-rw-r--r--Types/Cost.hs3
1 files changed, 3 insertions, 0 deletions
diff --git a/Types/Cost.hs b/Types/Cost.hs
index de091b8..a6a1160 100644
--- a/Types/Cost.hs
+++ b/Types/Cost.hs
@@ -51,6 +51,9 @@ unknownCostCalc = \_e -> error "No cost calculation available"
newtype Entropy t = Entropy Int
deriving (Num, Show)
+class CalcEntropy d t where
+ calcEntropy :: d -> Entropy t
+
-- | Entropy can never go negative when subtracting bits from it.
reduceEntropy :: Entropy t -> Int -> Entropy t
reduceEntropy (Entropy a) b = Entropy (max 0 (a - b))