diff options
Diffstat (limited to 'src/Trivmix')
-rw-r--r-- | src/Trivmix/Types.hs | 6 |
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' | |||
62 | dBToLin x = either error id . refine $ 10 ** (0.05 * x) | 62 | dBToLin x = either error id . refine $ 10 ** (0.05 * x) |
63 | 63 | ||
64 | instance Show Level where | 64 | instance 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 | ||
68 | instance Read Level where | 68 | instance 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 | ||
80 | instance Eq Level where | 82 | instance Eq Level where |
81 | (==) = (==) `on` toLin | 83 | (==) = (==) `on` toLin |