1module Bloodhound.Import
15import Control.Applicative as X (Alternative (..), optional)
16import Control.Exception as X (Exception)
17import Control.Monad as X (MonadPlus (..), forM, (<=<))
18import Control.Monad.Catch as X (MonadCatch, MonadMask,
20import Control.Monad.Except as X (MonadError)
21import Control.Monad.Fix as X (MonadFix)
22import Control.Monad.IO.Class as X (MonadIO (..))
23import Control.Monad.Reader as X (MonadReader (..),
24 MonadTrans (..), ReaderT (..))
25import Control.Monad.State as X (MonadState)
26import Control.Monad.Writer as X (MonadWriter)
28import Data.Aeson.Types as X (Pair, Parser, emptyObject,
29 parseEither, parseMaybe,
31import Data.Bifunctor as X (first)
32import Data.Char as X (isNumber)
33import Data.Hashable as X (Hashable)
34import qualified Data.HashMap.Strict as HM
35import Data.List as X (foldl', intercalate, nub)
36import Data.List.NonEmpty as X (NonEmpty (..), toList)
37import Data.Maybe as X (catMaybes, fromMaybe,
38 isNothing, maybeToList)
39import Data.Scientific as X (Scientific)
40import Data.Semigroup as X (Semigroup (..))
41import Data.Text as X (Text)
42import Data.Time.Calendar as X (Day (..), showGregorian)
43import Data.Time.Clock as X (NominalDiffTime, UTCTime)
44import Data.Time.Clock.POSIX as X
46import qualified Data.ByteString.Lazy as BL
47import qualified Data.Text as T
48import qualified Data.Traversable as DT
49import qualified Data.Vector as V
50import qualified Network.HTTP.Types.Method as NHTM
52type LByteString = BL.ByteString
54type Method = NHTM.Method
56readMay :: Read a => String -> Maybe a
57readMay s = case reads s of
61parseReadText :: Read a => Text -> Parser a
62parseReadText = maybe mzero return . readMay . T.unpack
64showText :: Show a => a -> Text
65showText = T.pack . show
67omitNulls :: [(Text, Value)] -> Value
68omitNulls = object . filter notNull where
69 notNull (_, Null) = False
70 notNull (_, Array a) = (not . V.null) a
73parseNEJSON :: (FromJSON a) => [Value] -> Parser (NonEmpty a)
74parseNEJSON [] = fail "Expected non-empty list"
75parseNEJSON (x:xs) = DT.mapM parseJSON (x :| xs)
77deleteSeveral :: (Eq k, Hashable k) => [k] -> HM.HashMap k v -> HM.HashMap k v
78deleteSeveral ks hm = foldr HM.delete hm ks
80oPath :: ToJSON a => NonEmpty Text -> a -> Value
81oPath (k :| []) v = object [k .= v]
82oPath (k:| (h:t)) v = object [k .= oPath (h :| t) v]
84tshow :: Show a => a -> Text
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