From e3ea039428545e185b38c5633fe3576ab32f1f8e Mon Sep 17 00:00:00 2001 From: Paul Oliver Date: Thu, 16 Jan 2025 19:22:18 -0800 Subject: Cleans excessive type annotations --- hsm-dummy-blinker/Main.hs | 27 +++++++++++---------------- 1 file changed, 11 insertions(+), 16 deletions(-) (limited to 'hsm-dummy-blinker') diff --git a/hsm-dummy-blinker/Main.hs b/hsm-dummy-blinker/Main.hs index cfc6654..88b7b5f 100644 --- a/hsm-dummy-blinker/Main.hs +++ b/hsm-dummy-blinker/Main.hs @@ -27,30 +27,25 @@ data Env = Env $(deriveFromYaml ''Env) stateOn :: F.FsmState () Bool Env Bool -stateOn = F.FsmState "on" action - where - action :: () -> Env -> Bool -> F.FsmOutput () Bool Env Bool - action _ _ sta = - F.FsmOutput - (Just $ F.FsmResult sta False stateOff) - [(LogInfo, "Turning on blinker")] +stateOn = + F.FsmState "on" $ \_ _ sta -> + F.FsmOutput + (Just $ F.FsmResult sta False stateOff) + [(LogInfo, "Turning on blinker")] stateOff :: F.FsmState () Bool Env Bool -stateOff = F.FsmState "off" action - where - action :: () -> Env -> Bool -> F.FsmOutput () Bool Env Bool - action _ _ sta = - F.FsmOutput - (Just $ F.FsmResult sta True stateOn) - [(LogInfo, "Turning off blinker")] +stateOff = + F.FsmState "off" $ \_ _ sta -> + F.FsmOutput + (Just $ F.FsmResult sta True stateOn) + [(LogInfo, "Turning off blinker")] handle :: - forall es. (GPIOEffect () :> es, Log :> es, Reader Env :> es) + (GPIOEffect () :> es, Log :> es, Reader Env :> es) => S.Stream (Eff es) Bool -> Eff es () handle = S.fold S.drain . S.mapM handler where - handler :: Bool -> Eff es () handler sta = do env <- ask @Env toggle sta () [env.period, 0] -- cgit v1.2.1