summaryrefslogtreecommitdiff
path: root/lib/modes.ml
diff options
context:
space:
mode:
Diffstat (limited to 'lib/modes.ml')
-rw-r--r--lib/modes.ml18
1 files changed, 0 insertions, 18 deletions
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 @@
1type mode = Normal | Insert
2type t = mode
3type state = int
4type 'a state_monad = state -> 'a * state
5
6let run (f : 'a state_monad) (s : state) : 'a = f s |> fst
7let return (a : 'a) : 'a state_monad = fun s -> (a, s)
8
9let ( >>= ) (f : 'a state_monad) (g : 'a -> 'b state_monad) : 'b state_monad =
10 fun s ->
11 let a, s' = f s in
12 g a s'
13
14let draw () : unit state_monad = return ()
15let get_keypress () : char state_monad = return 'a'
16let handle_key (_ : char) : unit state_monad = return ()
17let rec loop () = () |> draw >>= get_keypress >>= handle_key >>= loop
18let test = run (loop ()) 0