From 7885042246ac4a08e0f7b3ba27a7691a4908f3b6 Mon Sep 17 00:00:00 2001 From: Gregor Kleen Date: Tue, 15 May 2018 15:30:53 +0200 Subject: Fix read/show --- src/Trivmix/Types.hs | 6 ++++-- trivmix.cabal | 2 +- trivmix.nix | 2 +- 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' dBToLin x = either error id . refine $ 10 ** (0.05 * x) instance Show Level where - show (Lin x) = show x + show (Lin (unrefine -> x)) = show x show (DB (linToDb -> x)) = (show $ (withPrec x :: Milli)) ++ "dB" instance Read Level where @@ -75,7 +75,9 @@ instance Read Level where unit' <- forM [1..lU] $ const get guard $ ((==) `on` CI.mk) unit unit' return . DB $ dBToLin db - parseLin = Lin <$> readS_to_Prec readsPrec + parseLin = do + lin <- readS_to_Prec readsPrec + either (const mzero) (return . Lin) $ refine lin instance Eq Level where (==) = (==) `on` toLin diff --git a/trivmix.cabal b/trivmix.cabal index 0ff3f01..e39d451 100644 --- a/trivmix.cabal +++ b/trivmix.cabal @@ -2,7 +2,7 @@ -- documentation, see http://haskell.org/cabal/users-guide/ name: trivmix -version: 3.1.0 +version: 3.1.1 -- synopsis: -- description: license: PublicDomain diff --git a/trivmix.nix b/trivmix.nix index 0882731..d77a0ee 100644 --- a/trivmix.nix +++ b/trivmix.nix @@ -5,7 +5,7 @@ }: mkDerivation { pname = "trivmix"; - version = "3.1.0"; + version = "3.1.1"; src = ./.; isLibrary = true; isExecutable = true; -- cgit v1.2.3