From 53916fc3f7dcbefd90e3d0340a2a8f32bf331d1d Mon Sep 17 00:00:00 2001 From: Federico Igne Date: Sun, 28 Jan 2024 01:22:52 +0100 Subject: feat: add plain search functionality (with history) --- lib/modes.ml | 18 ------------------ 1 file changed, 18 deletions(-) delete mode 100644 lib/modes.ml (limited to 'lib/modes.ml') diff --git a/lib/modes.ml b/lib/modes.ml deleted file mode 100644 index 3d0e354..0000000 --- a/lib/modes.ml +++ /dev/null @@ -1,18 +0,0 @@ -type mode = Normal | Insert -type t = mode -type state = int -type 'a state_monad = state -> 'a * state - -let run (f : 'a state_monad) (s : state) : 'a = f s |> fst -let return (a : 'a) : 'a state_monad = fun s -> (a, s) - -let ( >>= ) (f : 'a state_monad) (g : 'a -> 'b state_monad) : 'b state_monad = - fun s -> - let a, s' = f s in - g a s' - -let draw () : unit state_monad = return () -let get_keypress () : char state_monad = return 'a' -let handle_key (_ : char) : unit state_monad = return () -let rec loop () = () |> draw >>= get_keypress >>= handle_key >>= loop -let test = run (loop ()) 0 -- cgit v1.2.3