diff options
Diffstat (limited to 'src/Gtk/State.dcl')
-rw-r--r-- | src/Gtk/State.dcl | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/src/Gtk/State.dcl b/src/Gtk/State.dcl index e97f3d3..2a5396c 100644 --- a/src/Gtk/State.dcl +++ b/src/Gtk/State.dcl @@ -2,11 +2,9 @@ definition module Gtk.State from StdMaybe import :: Maybe -from Control.Applicative import class pure -from Control.Monad.State import :: State, :: StateT, - instance pure (StateT m s) -from Control.Monad.Identity import :: Identity, - instance pure Identity +from Control.Applicative import class pure, class <*>, class Applicative +from Control.Monad import class Monad +from Data.Functor import class Functor from Data.Map import :: Map from Gtk.Signal import :: GSignalHandlerInternal @@ -18,12 +16,22 @@ from Gtk.Signal import :: GSignalHandlerInternal , signal_counter :: !Int } -:: GtkM a :== State GtkState a +:: GtkM a =: GtkM (GtkState -> (a, GtkState)) + +instance Functor GtkM +instance pure GtkM +instance <*> GtkM +instance Monad GtkM +where + (>>|) infixl 1 :: (GtkM a) (GtkM b) -> GtkM b newGtkState :: GtkState runGtk :: !(GtkM a) !*World -> (!a, !*World) +getState :: GtkM GtkState +modState :: !(GtkState -> GtkState) -> GtkM GtkState + toState :: !(A.a: a -> a) -> GtkM () toStateR :: !(A.a: a -> (r,a)) -> GtkM r |