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