1{-# LANGUAGE OverloadedStrings, Rank2Types #-}
17import qualified System.Exit as Exit
19import qualified Reporting.Doc as D
20import qualified Reporting.Exit as Exit
21import qualified Reporting.Progress as Progress
34 -> (Exit.Exit -> IO result)
41 { _tell :: Progress.Progress -> IO ()
42 , _ask :: D.Doc -> IO Bool
46run :: Progress.Reporter -> Task a -> IO ()
47run (Progress.Reporter pTell pAsk pEnd) (Task task) =
59throw :: Exit.Exit -> Task a
61 Task $ \_ _ err -> err exit
68notify :: Progress.Progress -> Task ()
70 Task $ \(Env pTell _) ok _ -> pTell progress >>= ok
73ask :: D.Doc -> Task Bool
75 Task $ \(Env _ pAsk) ok _ -> pAsk question >>= ok
85 Task $ \_ ok _ -> work >>= ok
88eio :: (x -> Exit.Exit) -> IO (Either x a) -> Task a
94 Left e -> err (func e)
97withKey :: (Progress.Key -> IO (Either Exit.Exit a)) -> Task a
99 Task $ \(Env pTell _) ok err ->
100 do result <- callback (Progress.Key pTell)
110instance Functor Task where
112 fmap func (Task taskA) =
113 Task $ \env ok err ->
115 okA arg = ok (func arg)
120instance Applicative Task where
123 Task $ \_ ok _ -> ok a
126 (<*>) (Task taskFunc) (Task taskArg) =
127 Task $ \env ok err ->
131 okArg arg = ok (func arg)
133 taskArg env okArg err
135 taskFunc env okFunc err
138instance Monad Task where
139 {-# INLINE return #-}
143 (>>=) (Task taskA) callback =
144 Task $ \env ok err ->
148 Task taskB -> taskB env ok err
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