1{-# LANGUAGE FlexibleInstances #-}
2{-# LANGUAGE OverloadedStrings #-}
5-- Copyright : (c) 2015-2016 Brendan Hay
6-- License : Mozilla Public License, v. 2.0.
7-- Maintainer : Brendan Hay <brendan.g.hay@gmail.com>
8-- Stability : provisional
9-- Portability : non-portable (GHC extensions)
14import Control.Monad.Except
15import Data.Aeson hiding (decode)
16import Data.Aeson.Types
18import Data.ByteString (ByteString)
19import qualified Data.ByteString.Lazy as LBS
20import qualified Data.HashMap.Strict as Map
22import qualified Data.Text.Lazy as LText
26import qualified Text.EDE as EDE
28objectErr :: ToJSON a => String -> a -> Either Error Object
30 note (format ("Failed to extract JSON object from value " % string) n)
34load :: MonadIO m => Path -> ExceptT Error m Object
35load = readBSFile >=> hoistEither . decode
37decode :: ByteString -> Either Error Object
38decode = first LText.pack . eitherDecode' . LBS.fromStrict
40parse :: FromJSON a => Object -> Either Error a
41parse = first LText.pack . parseEither parseJSON . Object
43merge :: [Object] -> Object
44merge = foldl' go mempty
46 go :: Object -> Object -> Object
47 go = Map.unionWith value
49 value :: Value -> Value -> Value
52 (Object x, Object y) -> Object (x `go` y)
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