diff options
author | Amir Saeid <amir@glgdgt.com> | 2021-06-30 08:56:01 +0100 |
---|---|---|
committer | Amir Saeid <amir@glgdgt.com> | 2021-07-13 08:40:45 +0100 |
commit | fe92b6e5912c58890a2c393df73b6ab97c8d7449 (patch) | |
tree | 77357cfe4e82b972391added4e8f3d12a0f5da4b /src/Xmobar/Plugins/Kraken.hs | |
parent | 7d4e3efca1cb1164040a4a64c1747a9aa163a9f0 (diff) | |
download | xmobar-fe92b6e5912c58890a2c393df73b6ab97c8d7449.tar.gz xmobar-fe92b6e5912c58890a2c393df73b6ab97c8d7449.tar.bz2 |
Remove redundancies
Diffstat (limited to 'src/Xmobar/Plugins/Kraken.hs')
-rw-r--r-- | src/Xmobar/Plugins/Kraken.hs | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/Xmobar/Plugins/Kraken.hs b/src/Xmobar/Plugins/Kraken.hs index 68b3394..afe04db 100644 --- a/src/Xmobar/Plugins/Kraken.hs +++ b/src/Xmobar/Plugins/Kraken.hs @@ -21,7 +21,7 @@ import qualified Data.Map as Map import qualified Data.Vector as V data Kraken = Kraken [String] String - deriving (Read,Show) + deriving (Read, Show) instance Exec Kraken where alias (Kraken _ a) = a @@ -42,7 +42,7 @@ instance Exec Kraken where wsClientApp :: [String] -> MVar (Text, Double) -> ClientApp () wsClientApp ps mvar connection = do - sendTextData connection (encode (Subscribe { event = "subscribe", pair = map pack ps, subscription = Subscription { name = "ticker" }} )) + sendTextData connection (encode Subscribe { event = "subscribe", pair = map pack ps, subscription = Subscription { name = "ticker" }}) void . forever $ do message <- receiveData connection case (eitherDecode message :: Either String Message) of @@ -71,7 +71,7 @@ instance FromJSON Ask where p <- parseDoubleString $ v V.! 0 w <- parseJSON $ v V.! 1 l <- parseDoubleString $ v V.! 2 - return $ Ask { askPrice = p, askWholeLotVolume = w, askLotVolume = l } + return Ask { askPrice = p, askWholeLotVolume = w, askLotVolume = l } | otherwise = mzero parseJSON nonArray = typeMismatch "Array" nonArray @@ -87,7 +87,7 @@ instance FromJSON Bid where p <- parseDoubleString $ v V.! 0 w <- parseJSON $ v V.! 1 l <- parseDoubleString $ v V.! 2 - return $ Bid { bidPrice = p, bidWholeLotVolume = w, bidLotVolume = l } + return Bid { bidPrice = p, bidWholeLotVolume = w, bidLotVolume = l } | otherwise = mzero parseJSON nonArray = typeMismatch "Array" nonArray @@ -101,7 +101,7 @@ instance FromJSON Close where | V.length v == 2 = do p <- parseDoubleString $ v V.! 0 l <- parseDoubleString $ v V.! 1 - return $ Close { closePrice= p, closeLotVolume = l } + return Close { closePrice= p, closeLotVolume = l } | otherwise = mzero parseJSON nonArray = typeMismatch "Array" nonArray @@ -149,6 +149,6 @@ instance FromJSON Message where info <- parseJSON $ a V.! 1 cName <- parseJSON $ a V.! 2 p <- parseJSON $ a V.! 3 - pure $ TickerMessage { channelId = cId, tickerInformation = info, channelName = cName, tickerPair = p } + pure TickerMessage { channelId = cId, tickerInformation = info, channelName = cName, tickerPair = p } | otherwise = mzero parseJSON v = typeMismatch "Object or Array" v |