1module Control.Monad.State
3import Control.Monad.Identity
9class Monad m => MonadState s (m : Set -> Set) where
13record StateT : Set -> (Set -> Set) -> Set -> Set where
14 ST : {m : Set -> Set} ->
15 (runStateT : s -> m (a, s)) -> StateT s m a
17instance Functor f => Functor (StateT s f) where
18 fmap f (ST g) = ST (\st => fmap (mapFst f) (g st)) where
19 mapFst : (a -> x) -> (a, b) -> (x, b)
20 mapFst fn (a, b) = (fn a, b)
22instance Monad f => Applicative (StateT s f) where
23 pure x = ST (\st => pure (x, st))
25 (ST f) <$> (ST a) = ST (\st => do (g, r) <- f st
29instance Monad m => Monad (StateT s m) where
30 return x = ST (\st => return (x, st))
32 (ST f) >>= k = ST (\st => do (v, st') <- f st
36instance Monad m => MonadState s (StateT s m) where
37 get = ST (\x => return (x, x))
38 put x = ST (\y => return ((), x))
40State : Set -> Set -> Set
41State s a = StateT s Identity a
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