Fix warnings

This commit is contained in:
2026-08-20 14:36:38 +03:00
parent 81159ade69
commit 54622a0b07
3 changed files with 14 additions and 22 deletions
+10 -3
View File
@@ -9,6 +9,7 @@ module HomeAssistant.Runtime
, CallIdGen
, mkCallIdGen
, hassEval
, dryRunHassEval
, receiveJSON
, wsCallService
) where
@@ -21,7 +22,7 @@ import qualified Data.Text as T
import qualified Network.WebSockets as WS
import Network.Socket (withSocketsDo)
import System.Environment (getEnv)
import Data.Time (UTCTime, getCurrentTime)
import Data.Time (getCurrentTime)
import Data.IORef (newIORef, atomicModifyIORef')
step :: (forall x. eff x -> IO x) -> Mealy eff a b -> a -> IO (b, Mealy eff a b)
@@ -72,7 +73,7 @@ app gen token conn = do
go f = do
msg <- WS.receiveData conn :: IO BL.ByteString
let decoded = Event $ either (const Null) id $ eitherDecode @Value msg
(x, f') <- step (hassEval gen conn) f decoded
(x, f') <- step (dryRunHassEval gen) f decoded
mapM_ print x
go f'
@@ -112,6 +113,12 @@ hassEval :: CallIdGen -> WS.Connection -> HASSEff a -> IO a
hassEval gen conn = \case
CallService x -> do
callId <- generateCallId gen
wsCallService conn callId (serviceDomain x) (serviceName x) (serviceTarget x)
Pure a -> pure a
dryRunHassEval :: CallIdGen -> HASSEff a -> IO a
dryRunHassEval gen = \case
CallService x -> do
callId <- generateCallId gen
print (callId, x)
-- wsCallService conn callId (serviceDomain x) (serviceName x) (serviceTarget x)
Pure a -> pure a