diff options
Diffstat (limited to 'src/Gtk')
-rw-r--r-- | src/Gtk/State.dcl | 3 | ||||
-rw-r--r-- | src/Gtk/State.icl | 18 |
2 files changed, 21 insertions, 0 deletions
diff --git a/src/Gtk/State.dcl b/src/Gtk/State.dcl index 81373e2..e97f3d3 100644 --- a/src/Gtk/State.dcl +++ b/src/Gtk/State.dcl @@ -27,4 +27,7 @@ runGtk :: !(GtkM a) !*World -> (!a, !*World) toState :: !(A.a: a -> a) -> GtkM () toStateR :: !(A.a: a -> (r,a)) -> GtkM r +appWorld :: !(*World -> *World) -> GtkM () +accWorld :: !(*World -> (r,*World)) -> GtkM r + quit :: GtkM () diff --git a/src/Gtk/State.icl b/src/Gtk/State.icl index 9d81b9a..245ea7a 100644 --- a/src/Gtk/State.icl +++ b/src/Gtk/State.icl @@ -53,5 +53,23 @@ toState f = state \st -> let w = f st.world in ((), {st & world=w}) toStateR :: !(A.a: a -> (r,a)) -> GtkM r toStateR f = state \st -> let (r,w) = f st.world in (r, {st & world=w}) +appWorld :: !(*World -> *World) -> GtkM () +appWorld f = state \st + # w = f (voidToWorld st.world) + -> ((), {st & world=worldToVoid w}) + +accWorld :: !(*World -> (r,*World)) -> GtkM r +accWorld f = state \st + # (r,w) = f (voidToWorld st.world) + -> (r, {st & world=worldToVoid w}) + +voidToWorld :: !() -> *World +voidToWorld _ = code { + no_op +} + +worldToVoid :: !*World -> () +worldToVoid _ = () + quit :: GtkM () quit = modify \st -> {st & return=True} |