Browse Source

Незначительные синтаксические правки

master
Maxim Lihachev 9 years ago
parent
commit
b8980ff64b
  1. 15
      audioread.hs

15
audioread.hs

@ -1,7 +1,7 @@ @@ -1,7 +1,7 @@
{-# LANGUAGE DeriveDataTypeable, RecordWildCards #-}
-- Создан: Ср 28 сен 2016 10:18:53
-- Изменен: Вт 25 окт 2016 15:45:52
-- Изменен: Пн 07 ноя 2016 09:30:26
-- Copyright (C) 2011-2013, Maxim Lihachev, <envrm@yandex.ru>
@ -55,7 +55,7 @@ notEmpty = (/=) (show "") @@ -55,7 +55,7 @@ notEmpty = (/=) (show "")
-- Проверка на действительное ненулевое значение
notZero :: RealFloat a => a -> Bool
notZero x = (not $ isNaN x) && (x /= 0)
notZero x = not (isNaN x || x == 0)
-- Синтаксический сахар
(<@) = map -- a <@ b = map a b
@ -152,18 +152,17 @@ defaultOptions = cmdArgs $ Audioread { @@ -152,18 +152,17 @@ defaultOptions = cmdArgs $ Audioread {
-- Вывод строки с префиксом и суффиксом
describe :: (Show s) => Int -> String -> s -> String -> IO ()
describe o p ms s = let message = show ms in do
when (o == 1) $ putStr $ p
when (notEmpty message) $ putStr message
when (o == 1) $ putStr $ s
putStrLn ""
describe o p m s = putStrLn message where
str = if notEmpty (show s) then show s else ""
message | o == 1 = p ++ str ++ s
| otherwise = str
main :: IO ()
main = do
args <- getArgs
cmd <- (if null args then withArgs ["--help"] else id) defaultOptions
unless (isInfixOf ".wav" $ file cmd) $ do
unless (".wav" `isInfixOf` file cmd) $ do
putStrLn "ERROR: You must specify a correct filename."
exitFailure

Loading…
Cancel
Save