From 5ba1a7767e56ae0f5144f6edb3fbe01933507d63 Mon Sep 17 00:00:00 2001 From: tzlil Date: Tue, 24 Oct 2023 06:02:34 +0300 Subject: initial commit --- Main.idr | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 Main.idr diff --git a/Main.idr b/Main.idr new file mode 100644 index 0000000..0ad36c9 --- /dev/null +++ b/Main.idr @@ -0,0 +1,30 @@ +module Main + +data Discrim = V Type | F (List Discrim) Discrim + +Sig : Type +Sig = List Discrim + +data Stack : List Discrim -> Type where + Bot : Stack [] + PushVal : {t : Type} -> (a : t) -> (Stack d) -> Stack ((V t) :: d) + PushFn : {ty : Sig} -> {r : Discrim} -> (fn : {other : Sig} -> Stack (ty ++ other) -> Stack (r :: other)) -> (Stack ds) -> Stack ((F ty r) :: ds) + +push : {t : Type} -> (a : t) -> Stack d -> Stack ((V t) :: d) +push x y = PushVal x y + +quote : {ty : Sig} -> {r : Discrim} -> ({d : Sig} -> Stack (ty ++ d) -> Stack (r :: d)) -> Stack ds -> Stack ((F ty r) :: ds) +quote f = PushFn f + +call : {rest :Sig} -> Stack ((F f r) :: (f ++ rest)) -> (Stack (r :: rest)) +call (PushFn g y) = g y + +-- compose : {rest :Sig} -> Stack ((F f r) :: (F g r') :: (f ++ g ++ rest)) -> (Stack ((F ) :: rest)) +-- compose (PushFn f s) = case s of (PushFn g s') => quote {ty = ?idk} (f . g) s' + + +add : {other : Sig} -> Stack (V Nat :: V Nat :: other) -> Stack (V Nat :: other) +add (PushVal x z) = case z of (PushVal y st) => PushVal (x + y) st + +main : IO () +main = putStrLn "a" \ No newline at end of file -- cgit 1.4.1