summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGregor Kleen <gkleen@yggdrasil.li>2018-05-15 15:30:53 +0200
committerGregor Kleen <gkleen@yggdrasil.li>2018-05-15 15:30:53 +0200
commit7885042246ac4a08e0f7b3ba27a7691a4908f3b6 (patch)
tree3874d3a93048f899ae8d1ae8f2e9287fe2c6896c
parent5d38dd48cc8e5349803064eb521117b3f20b3c74 (diff)
downloadtrivmix-7885042246ac4a08e0f7b3ba27a7691a4908f3b6.tar
trivmix-7885042246ac4a08e0f7b3ba27a7691a4908f3b6.tar.gz
trivmix-7885042246ac4a08e0f7b3ba27a7691a4908f3b6.tar.bz2
trivmix-7885042246ac4a08e0f7b3ba27a7691a4908f3b6.tar.xz
trivmix-7885042246ac4a08e0f7b3ba27a7691a4908f3b6.zip
Fix read/show
-rw-r--r--src/Trivmix/Types.hs6
-rw-r--r--trivmix.cabal2
-rw-r--r--trivmix.nix2
3 files changed, 6 insertions, 4 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
diff --git a/trivmix.cabal b/trivmix.cabal
index 0ff3f01..e39d451 100644
--- a/trivmix.cabal
+++ b/trivmix.cabal
@@ -2,7 +2,7 @@
2-- documentation, see http://haskell.org/cabal/users-guide/ 2-- documentation, see http://haskell.org/cabal/users-guide/
3 3
4name: trivmix 4name: trivmix
5version: 3.1.0 5version: 3.1.1
6-- synopsis: 6-- synopsis:
7-- description: 7-- description:
8license: PublicDomain 8license: PublicDomain
diff --git a/trivmix.nix b/trivmix.nix
index 0882731..d77a0ee 100644
--- a/trivmix.nix
+++ b/trivmix.nix
@@ -5,7 +5,7 @@
5}: 5}:
6mkDerivation { 6mkDerivation {
7 pname = "trivmix"; 7 pname = "trivmix";
8 version = "3.1.0"; 8 version = "3.1.1";
9 src = ./.; 9 src = ./.;
10 isLibrary = true; 10 isLibrary = true;
11 isExecutable = true; 11 isExecutable = true;