summaryrefslogtreecommitdiff
path: root/src/Trivmix
diff options
context:
space:
mode:
Diffstat (limited to 'src/Trivmix')
-rw-r--r--src/Trivmix/Types.hs6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/Trivmix/Types.hs b/src/Trivmix/Types.hs
index f01e023..abfdc43 100644
--- a/src/Trivmix/Types.hs
+++ b/src/Trivmix/Types.hs
@@ -62,7 +62,7 @@ dBToLin :: Float -> Level'
62dBToLin x = either error id . refine $ 10 ** (0.05 * x) 62dBToLin x = either error id . refine $ 10 ** (0.05 * x)
63 63
64instance Show Level where 64instance Show Level where
65 show (Lin x) = show x 65 show (Lin (unrefine -> x)) = show x
66 show (DB (linToDb -> x)) = (show $ (withPrec x :: Milli)) ++ "dB" 66 show (DB (linToDb -> x)) = (show $ (withPrec x :: Milli)) ++ "dB"
67 67
68instance Read Level where 68instance Read Level where
@@ -75,7 +75,9 @@ instance Read Level where
75 unit' <- forM [1..lU] $ const get 75 unit' <- forM [1..lU] $ const get
76 guard $ ((==) `on` CI.mk) unit unit' 76 guard $ ((==) `on` CI.mk) unit unit'
77 return . DB $ dBToLin db 77 return . DB $ dBToLin db
78 parseLin = Lin <$> readS_to_Prec readsPrec 78 parseLin = do
79 lin <- readS_to_Prec readsPrec
80 either (const mzero) (return . Lin) $ refine lin
79 81
80instance Eq Level where 82instance Eq Level where
81 (==) = (==) `on` toLin 83 (==) = (==) `on` toLin