5data Tuple a b = Tuple a b
7class MonadState s m where
11data State s a = State (s -> Tuple s a)
13runState s (State f) = f s
15instance functorState :: Functor (State s) where
18instance applyState :: Apply (State s) where
21instance applicativeState :: Applicative (State s) where
22 pure a = State $ \s -> Tuple s a
24instance bindState :: Bind (State s) where
25 (>>=) f g = State $ \s -> case runState s f of
26 Tuple s1 a -> runState s1 (g a)
28instance monadState :: Monad (State s)
30instance monadStateState :: MonadState s (State s) where
31 get = State (\s -> Tuple s s)
32 put s = State (\_ -> Tuple s {})
34modify :: forall m s. (Prelude.Monad m, MonadState s m) => (s -> s) -> m {}
39test :: Tuple String String
40test = runState "" $ do
41 modify $ (++) "World!"
42 modify $ (++) "Hello, "
47 Debug.Trace.trace "Done"
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list