aboutsummaryrefslogtreecommitdiff
path: root/hsm-dummy-blinker
diff options
context:
space:
mode:
authorPaul Oliver <contact@pauloliver.dev>2025-01-16 19:22:18 -0800
committerPaul Oliver <contact@pauloliver.dev>2025-01-17 19:16:43 -0800
commite3ea039428545e185b38c5633fe3576ab32f1f8e (patch)
tree56ab8d1248b4387ceab6094305e7a75699c4e393 /hsm-dummy-blinker
parente1fa79eb713c249055fb23fcc6684a94f77d8368 (diff)
Cleans excessive type annotations
Diffstat (limited to 'hsm-dummy-blinker')
-rw-r--r--hsm-dummy-blinker/Main.hs27
1 files changed, 11 insertions, 16 deletions
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]