diff options
author | Paul Oliver <contact@pauloliver.dev> | 2025-01-16 19:22:18 -0800 |
---|---|---|
committer | Paul Oliver <contact@pauloliver.dev> | 2025-01-17 19:16:43 -0800 |
commit | e3ea039428545e185b38c5633fe3576ab32f1f8e (patch) | |
tree | 56ab8d1248b4387ceab6094305e7a75699c4e393 /hsm-command/Hsm/Command/Readline.hs | |
parent | e1fa79eb713c249055fb23fcc6684a94f77d8368 (diff) |
Cleans excessive type annotations
Diffstat (limited to 'hsm-command/Hsm/Command/Readline.hs')
-rw-r--r-- | hsm-command/Hsm/Command/Readline.hs | 23 |
1 files changed, 7 insertions, 16 deletions
diff --git a/hsm-command/Hsm/Command/Readline.hs b/hsm-command/Hsm/Command/Readline.hs index 428ed50..1caa562 100644 --- a/hsm-command/Hsm/Command/Readline.hs +++ b/hsm-command/Hsm/Command/Readline.hs @@ -22,28 +22,19 @@ type instance DispatchOf Readline = Static S.WithSideEffects newtype instance S.StaticRep Readline = Readline H.InputState -readline :: - forall es. (Log :> es, Readline :> es) - => Eff es (Maybe String) +readline :: (Log :> es, Readline :> es) => Eff es (Maybe String) readline = do flushLogger Readline hdl <- S.getStaticRep - S.unsafeEff_ $ nextLine hdl - where - nextLine :: H.InputState -> IO (Maybe String) - nextLine hdl = - H.queryInput hdl - $ H.handleInterrupt (return Nothing) - $ H.withInterrupt - $ H.getInputLine "% " + S.unsafeEff_ + $ H.queryInput hdl + $ H.handleInterrupt (return Nothing) + $ H.withInterrupt + $ H.getInputLine "% " runReadline :: (IOE :> es, Resource :> es) => Eff (Readline : es) a -> Eff es a runReadline action = do - handle <- snd <$> allocate istate H.cancelInput + handle <- snd <$> allocate (H.initializeInput settings) H.cancelInput S.evalStaticRep (Readline handle) action where - settings :: H.Settings IO settings = H.defaultSettings {H.historyFile = Just ".hsm_command_history"} - -- - istate :: IO H.InputState - istate = H.initializeInput settings |