Clean hlint and cabal warnings
This commit is contained in:
+4
-6
@@ -1,5 +1,4 @@
|
||||
{-# LANGUAGE LambdaCase #-}
|
||||
{-# LANGUAGE Arrows #-}
|
||||
|
||||
module AFRP
|
||||
( Mealy(..)
|
||||
@@ -129,7 +128,7 @@ instance Monad m => Applicative (Auto m a) where
|
||||
pure a = Fun (\_req -> const a)
|
||||
fa <*> fb =
|
||||
case (fa,fb) of
|
||||
(Fun af, Fun bf) -> Fun $ \req -> (af req <*> bf req)
|
||||
(Fun af, Fun bf) -> Fun $ \req -> af req <*> bf req
|
||||
(Stateful codec s af, Fun bf) -> Stateful codec s
|
||||
(\s' req x -> do
|
||||
let a = bf req x
|
||||
@@ -179,7 +178,7 @@ instance (Monad m, Monoid b) => Monoid (Auto m a b) where
|
||||
|
||||
|
||||
instance Monad m => Category (Auto m) where
|
||||
id = Fun $ \_ -> id
|
||||
id = Fun $ const id
|
||||
af . ag =
|
||||
case (af, ag) of
|
||||
(Fun f, Fun g) -> Fun (\req -> f req . g req)
|
||||
@@ -272,8 +271,6 @@ instance Semigroup b => Semigroup (Mealy eff a b) where
|
||||
|
||||
instance Monoid b => Monoid (Mealy eff a b) where
|
||||
mempty = Mealy mempty $ \_nt -> mempty
|
||||
-- where
|
||||
-- m = Mealy mempty $ \_ _ _ -> pure (Pair mempty m)
|
||||
|
||||
eff :: (Request -> a -> eff b) -> Mealy eff a b
|
||||
eff f = Mealy mempty $ \nt -> do
|
||||
@@ -288,7 +285,8 @@ withEntities :: S.Set T.Text -> Mealy eff a b -> Mealy eff a b
|
||||
withEntities es (Mealy _ f) = Mealy es f
|
||||
|
||||
instance Category (Mealy eff) where
|
||||
id = Mealy mempty (\_ -> id)
|
||||
{- HLINT ignore "Use const" -}
|
||||
id = Mealy mempty $ \_nt -> id
|
||||
(Mealy ast f) . (Mealy bst g) = Mealy (ast <> bst) $ \nt -> do
|
||||
f nt . g nt
|
||||
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
{-# LANGUAGE Arrows #-}
|
||||
{-# LANGUAGE OverloadedStrings #-}
|
||||
module HomeAssistant.Controller.Ruuvi
|
||||
( Ruuvi(..)
|
||||
|
||||
@@ -36,10 +36,9 @@ import Data.UUID (toText)
|
||||
import AFRP (Request(..), Event(..))
|
||||
import Control.Monad.IO.Class (liftIO, MonadIO)
|
||||
import HomeAssistant.Runtime.RateLimit (RateLimited, RateLimiter, runRateLimited)
|
||||
import Control.Monad.Catch (MonadCatch)
|
||||
import GHC.Stack (HasCallStack)
|
||||
import UnliftIO (MonadUnliftIO, race, withRunInIO)
|
||||
import Control.Monad.Catch (onException)
|
||||
import Control.Monad.Catch (MonadCatch, onException)
|
||||
|
||||
-- | Connect, authenticate, subscribe, then receive and broadcast forever.
|
||||
-- Restarting this action reconnects. All setup sends happen before the
|
||||
|
||||
@@ -44,7 +44,7 @@ loadFlags rootPath allNames = do
|
||||
let path = rootPath </> "handlers.json"
|
||||
fileMap <- readFlagsFile path
|
||||
let defaults = M.fromList [(n, True) | n <- allNames]
|
||||
initial = M.unionWith (\fileVal -> const fileVal) fileMap defaults
|
||||
initial = M.unionWith const fileMap defaults
|
||||
tv <- liftIO $ newTVarIO initial
|
||||
lock <- liftIO $ newMVar ()
|
||||
pure Flags
|
||||
|
||||
@@ -190,10 +190,10 @@ cfName = \case
|
||||
|
||||
defArgs :: FilePath -> Series -> [String]
|
||||
defArgs rrdPath series =
|
||||
[ "DEF:" ++ rawF ++ "=" ++ rrdPath ++ ":"
|
||||
( "DEF:" ++ rawF ++ "=" ++ rrdPath ++ ":"
|
||||
++ srcDs source ++ ":" ++ cfName (srcCF source)
|
||||
]
|
||||
++ transformArgs
|
||||
)
|
||||
: transformArgs
|
||||
where
|
||||
source = serSource series
|
||||
alias = serAlias series
|
||||
|
||||
+1
-1
@@ -43,7 +43,7 @@ data API mode = API
|
||||
|
||||
|
||||
getFlagsHandler :: Flags -> LoggingHandler (Map Text Bool)
|
||||
getFlagsHandler flags = allFlags flags
|
||||
getFlagsHandler = allFlags
|
||||
|
||||
putFlagHandler :: Flags -> Text -> Bool -> LoggingHandler (Map Text Bool)
|
||||
putFlagHandler flags name val
|
||||
|
||||
Reference in New Issue
Block a user