-----------------------------------------------------------------------------
-- |
-- License     :  BSD-3-Clause
-- Maintainer  :  Oleg Grenrus <oleg.grenrus@iki.fi>
--
module GitHub.Data.Search where

import GitHub.Data.Repos       (CodeSearchRepo)
import GitHub.Data.URL         (URL)
import GitHub.Internal.Prelude
import Prelude ()

import qualified Data.Vector as V

data SearchResult' entities = SearchResult
    { forall entities. SearchResult' entities -> Int
searchResultTotalCount :: !Int
    , forall entities. SearchResult' entities -> entities
searchResultResults    :: !entities
    }
  deriving (Int -> SearchResult' entities -> ShowS
[SearchResult' entities] -> ShowS
SearchResult' entities -> String
(Int -> SearchResult' entities -> ShowS)
-> (SearchResult' entities -> String)
-> ([SearchResult' entities] -> ShowS)
-> Show (SearchResult' entities)
forall entities.
Show entities =>
Int -> SearchResult' entities -> ShowS
forall entities. Show entities => [SearchResult' entities] -> ShowS
forall entities. Show entities => SearchResult' entities -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SearchResult' entities] -> ShowS
$cshowList :: forall entities. Show entities => [SearchResult' entities] -> ShowS
show :: SearchResult' entities -> String
$cshow :: forall entities. Show entities => SearchResult' entities -> String
showsPrec :: Int -> SearchResult' entities -> ShowS
$cshowsPrec :: forall entities.
Show entities =>
Int -> SearchResult' entities -> ShowS
Show, Typeable (SearchResult' entities)
Typeable (SearchResult' entities)
-> (forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g)
    -> SearchResult' entities
    -> c (SearchResult' entities))
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c (SearchResult' entities))
-> (SearchResult' entities -> Constr)
-> (SearchResult' entities -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d))
    -> Maybe (c (SearchResult' entities)))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e))
    -> Maybe (c (SearchResult' entities)))
-> ((forall b. Data b => b -> b)
    -> SearchResult' entities -> SearchResult' entities)
-> (forall r r'.
    (r -> r' -> r)
    -> r
    -> (forall d. Data d => d -> r')
    -> SearchResult' entities
    -> r)
-> (forall r r'.
    (r' -> r -> r)
    -> r
    -> (forall d. Data d => d -> r')
    -> SearchResult' entities
    -> r)
-> (forall u.
    (forall d. Data d => d -> u) -> SearchResult' entities -> [u])
-> (forall u.
    Int -> (forall d. Data d => d -> u) -> SearchResult' entities -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d)
    -> SearchResult' entities -> m (SearchResult' entities))
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d)
    -> SearchResult' entities -> m (SearchResult' entities))
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d)
    -> SearchResult' entities -> m (SearchResult' entities))
-> Data (SearchResult' entities)
SearchResult' entities -> DataType
SearchResult' entities -> Constr
(forall b. Data b => b -> b)
-> SearchResult' entities -> SearchResult' entities
forall {entities}.
Data entities =>
Typeable (SearchResult' entities)
forall entities.
Data entities =>
SearchResult' entities -> DataType
forall entities. Data entities => SearchResult' entities -> Constr
forall entities.
Data entities =>
(forall b. Data b => b -> b)
-> SearchResult' entities -> SearchResult' entities
forall entities u.
Data entities =>
Int -> (forall d. Data d => d -> u) -> SearchResult' entities -> u
forall entities u.
Data entities =>
(forall d. Data d => d -> u) -> SearchResult' entities -> [u]
forall entities r r'.
Data entities =>
(r -> r' -> r)
-> r
-> (forall d. Data d => d -> r')
-> SearchResult' entities
-> r
forall entities r r'.
Data entities =>
(r' -> r -> r)
-> r
-> (forall d. Data d => d -> r')
-> SearchResult' entities
-> r
forall entities (m :: * -> *).
(Data entities, Monad m) =>
(forall d. Data d => d -> m d)
-> SearchResult' entities -> m (SearchResult' entities)
forall entities (m :: * -> *).
(Data entities, MonadPlus m) =>
(forall d. Data d => d -> m d)
-> SearchResult' entities -> m (SearchResult' entities)
forall entities (c :: * -> *).
Data entities =>
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (SearchResult' entities)
forall entities (c :: * -> *).
Data entities =>
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g)
-> SearchResult' entities
-> c (SearchResult' entities)
forall entities (t :: * -> *) (c :: * -> *).
(Data entities, Typeable t) =>
(forall d. Data d => c (t d)) -> Maybe (c (SearchResult' entities))
forall entities (t :: * -> * -> *) (c :: * -> *).
(Data entities, Typeable t) =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c (SearchResult' entities))
forall a.
Typeable a
-> (forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> a -> c a)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c a)
-> (a -> Constr)
-> (a -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c a))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a))
-> ((forall b. Data b => b -> b) -> a -> a)
-> (forall r r'.
    (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall r r'.
    (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall u. (forall d. Data d => d -> u) -> a -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> a -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> Data a
forall u.
Int -> (forall d. Data d => d -> u) -> SearchResult' entities -> u
forall u.
(forall d. Data d => d -> u) -> SearchResult' entities -> [u]
forall r r'.
(r -> r' -> r)
-> r
-> (forall d. Data d => d -> r')
-> SearchResult' entities
-> r
forall r r'.
(r' -> r -> r)
-> r
-> (forall d. Data d => d -> r')
-> SearchResult' entities
-> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d)
-> SearchResult' entities -> m (SearchResult' entities)
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> SearchResult' entities -> m (SearchResult' entities)
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (SearchResult' entities)
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g)
-> SearchResult' entities
-> c (SearchResult' entities)
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c (SearchResult' entities))
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c (SearchResult' entities))
gmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> SearchResult' entities -> m (SearchResult' entities)
$cgmapMo :: forall entities (m :: * -> *).
(Data entities, MonadPlus m) =>
(forall d. Data d => d -> m d)
-> SearchResult' entities -> m (SearchResult' entities)
gmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> SearchResult' entities -> m (SearchResult' entities)
$cgmapMp :: forall entities (m :: * -> *).
(Data entities, MonadPlus m) =>
(forall d. Data d => d -> m d)
-> SearchResult' entities -> m (SearchResult' entities)
gmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d)
-> SearchResult' entities -> m (SearchResult' entities)
$cgmapM :: forall entities (m :: * -> *).
(Data entities, Monad m) =>
(forall d. Data d => d -> m d)
-> SearchResult' entities -> m (SearchResult' entities)
gmapQi :: forall u.
Int -> (forall d. Data d => d -> u) -> SearchResult' entities -> u
$cgmapQi :: forall entities u.
Data entities =>
Int -> (forall d. Data d => d -> u) -> SearchResult' entities -> u
gmapQ :: forall u.
(forall d. Data d => d -> u) -> SearchResult' entities -> [u]
$cgmapQ :: forall entities u.
Data entities =>
(forall d. Data d => d -> u) -> SearchResult' entities -> [u]
gmapQr :: forall r r'.
(r' -> r -> r)
-> r
-> (forall d. Data d => d -> r')
-> SearchResult' entities
-> r
$cgmapQr :: forall entities r r'.
Data entities =>
(r' -> r -> r)
-> r
-> (forall d. Data d => d -> r')
-> SearchResult' entities
-> r
gmapQl :: forall r r'.
(r -> r' -> r)
-> r
-> (forall d. Data d => d -> r')
-> SearchResult' entities
-> r
$cgmapQl :: forall entities r r'.
Data entities =>
(r -> r' -> r)
-> r
-> (forall d. Data d => d -> r')
-> SearchResult' entities
-> r
gmapT :: (forall b. Data b => b -> b)
-> SearchResult' entities -> SearchResult' entities
$cgmapT :: forall entities.
Data entities =>
(forall b. Data b => b -> b)
-> SearchResult' entities -> SearchResult' entities
dataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c (SearchResult' entities))
$cdataCast2 :: forall entities (t :: * -> * -> *) (c :: * -> *).
(Data entities, Typeable t) =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c (SearchResult' entities))
dataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c (SearchResult' entities))
$cdataCast1 :: forall entities (t :: * -> *) (c :: * -> *).
(Data entities, Typeable t) =>
(forall d. Data d => c (t d)) -> Maybe (c (SearchResult' entities))
dataTypeOf :: SearchResult' entities -> DataType
$cdataTypeOf :: forall entities.
Data entities =>
SearchResult' entities -> DataType
toConstr :: SearchResult' entities -> Constr
$ctoConstr :: forall entities. Data entities => SearchResult' entities -> Constr
gunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (SearchResult' entities)
$cgunfold :: forall entities (c :: * -> *).
Data entities =>
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (SearchResult' entities)
gfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g)
-> SearchResult' entities
-> c (SearchResult' entities)
$cgfoldl :: forall entities (c :: * -> *).
Data entities =>
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g)
-> SearchResult' entities
-> c (SearchResult' entities)
Data, Typeable, SearchResult' entities -> SearchResult' entities -> Bool
(SearchResult' entities -> SearchResult' entities -> Bool)
-> (SearchResult' entities -> SearchResult' entities -> Bool)
-> Eq (SearchResult' entities)
forall entities.
Eq entities =>
SearchResult' entities -> SearchResult' entities -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SearchResult' entities -> SearchResult' entities -> Bool
$c/= :: forall entities.
Eq entities =>
SearchResult' entities -> SearchResult' entities -> Bool
== :: SearchResult' entities -> SearchResult' entities -> Bool
$c== :: forall entities.
Eq entities =>
SearchResult' entities -> SearchResult' entities -> Bool
Eq, Eq (SearchResult' entities)
Eq (SearchResult' entities)
-> (SearchResult' entities -> SearchResult' entities -> Ordering)
-> (SearchResult' entities -> SearchResult' entities -> Bool)
-> (SearchResult' entities -> SearchResult' entities -> Bool)
-> (SearchResult' entities -> SearchResult' entities -> Bool)
-> (SearchResult' entities -> SearchResult' entities -> Bool)
-> (SearchResult' entities
    -> SearchResult' entities -> SearchResult' entities)
-> (SearchResult' entities
    -> SearchResult' entities -> SearchResult' entities)
-> Ord (SearchResult' entities)
SearchResult' entities -> SearchResult' entities -> Bool
SearchResult' entities -> SearchResult' entities -> Ordering
SearchResult' entities
-> SearchResult' entities -> SearchResult' entities
forall a.
Eq a
-> (a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
forall {entities}. Ord entities => Eq (SearchResult' entities)
forall entities.
Ord entities =>
SearchResult' entities -> SearchResult' entities -> Bool
forall entities.
Ord entities =>
SearchResult' entities -> SearchResult' entities -> Ordering
forall entities.
Ord entities =>
SearchResult' entities
-> SearchResult' entities -> SearchResult' entities
min :: SearchResult' entities
-> SearchResult' entities -> SearchResult' entities
$cmin :: forall entities.
Ord entities =>
SearchResult' entities
-> SearchResult' entities -> SearchResult' entities
max :: SearchResult' entities
-> SearchResult' entities -> SearchResult' entities
$cmax :: forall entities.
Ord entities =>
SearchResult' entities
-> SearchResult' entities -> SearchResult' entities
>= :: SearchResult' entities -> SearchResult' entities -> Bool
$c>= :: forall entities.
Ord entities =>
SearchResult' entities -> SearchResult' entities -> Bool
> :: SearchResult' entities -> SearchResult' entities -> Bool
$c> :: forall entities.
Ord entities =>
SearchResult' entities -> SearchResult' entities -> Bool
<= :: SearchResult' entities -> SearchResult' entities -> Bool
$c<= :: forall entities.
Ord entities =>
SearchResult' entities -> SearchResult' entities -> Bool
< :: SearchResult' entities -> SearchResult' entities -> Bool
$c< :: forall entities.
Ord entities =>
SearchResult' entities -> SearchResult' entities -> Bool
compare :: SearchResult' entities -> SearchResult' entities -> Ordering
$ccompare :: forall entities.
Ord entities =>
SearchResult' entities -> SearchResult' entities -> Ordering
Ord, (forall x.
 SearchResult' entities -> Rep (SearchResult' entities) x)
-> (forall x.
    Rep (SearchResult' entities) x -> SearchResult' entities)
-> Generic (SearchResult' entities)
forall x. Rep (SearchResult' entities) x -> SearchResult' entities
forall x. SearchResult' entities -> Rep (SearchResult' entities) x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
forall entities x.
Rep (SearchResult' entities) x -> SearchResult' entities
forall entities x.
SearchResult' entities -> Rep (SearchResult' entities) x
$cto :: forall entities x.
Rep (SearchResult' entities) x -> SearchResult' entities
$cfrom :: forall entities x.
SearchResult' entities -> Rep (SearchResult' entities) x
Generic)

type SearchResult entity = SearchResult' (V.Vector entity)

instance NFData entities => NFData (SearchResult' entities) where rnf :: SearchResult' entities -> ()
rnf = SearchResult' entities -> ()
forall a. (Generic a, GNFData (Rep a)) => a -> ()
genericRnf
instance Binary entities => Binary (SearchResult' entities)

instance (Monoid entities, FromJSON entities) => FromJSON (SearchResult' entities) where
    parseJSON :: Value -> Parser (SearchResult' entities)
parseJSON = String
-> (Object -> Parser (SearchResult' entities))
-> Value
-> Parser (SearchResult' entities)
forall a. String -> (Object -> Parser a) -> Value -> Parser a
withObject String
"SearchResult" ((Object -> Parser (SearchResult' entities))
 -> Value -> Parser (SearchResult' entities))
-> (Object -> Parser (SearchResult' entities))
-> Value
-> Parser (SearchResult' entities)
forall a b. (a -> b) -> a -> b
$ \Object
o -> Int -> entities -> SearchResult' entities
forall entities. Int -> entities -> SearchResult' entities
SearchResult
        (Int -> entities -> SearchResult' entities)
-> Parser Int -> Parser (entities -> SearchResult' entities)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Object
o Object -> Key -> Parser Int
forall a. FromJSON a => Object -> Key -> Parser a
.: Key
"total_count"
        Parser (entities -> SearchResult' entities)
-> Parser entities -> Parser (SearchResult' entities)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Object
o Object -> Key -> Parser (Maybe entities)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"items" Parser (Maybe entities) -> entities -> Parser entities
forall a. Parser (Maybe a) -> a -> Parser a
.!= entities
forall a. Monoid a => a
mempty

instance Semigroup res => Semigroup (SearchResult' res) where
    (SearchResult Int
count res
res) <> :: SearchResult' res -> SearchResult' res -> SearchResult' res
<> (SearchResult Int
count' res
res') = Int -> res -> SearchResult' res
forall entities. Int -> entities -> SearchResult' entities
SearchResult (Int -> Int -> Int
forall a. Ord a => a -> a -> a
max Int
count Int
count') (res
res res -> res -> res
forall a. Semigroup a => a -> a -> a
<> res
res')

instance Foldable SearchResult' where
    foldMap :: forall m a. Monoid m => (a -> m) -> SearchResult' a -> m
foldMap a -> m
f (SearchResult Int
_count a
results) = a -> m
f a
results

data Code = Code
    { Code -> Text
codeName    :: !Text
    , Code -> Text
codePath    :: !Text
    , Code -> Text
codeSha     :: !Text
    , Code -> URL
codeUrl     :: !URL
    , Code -> URL
codeGitUrl  :: !URL
    , Code -> URL
codeHtmlUrl :: !URL
    , Code -> CodeSearchRepo
codeRepo    :: !CodeSearchRepo
    }
  deriving (Int -> Code -> ShowS
[Code] -> ShowS
Code -> String
(Int -> Code -> ShowS)
-> (Code -> String) -> ([Code] -> ShowS) -> Show Code
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Code] -> ShowS
$cshowList :: [Code] -> ShowS
show :: Code -> String
$cshow :: Code -> String
showsPrec :: Int -> Code -> ShowS
$cshowsPrec :: Int -> Code -> ShowS
Show, Typeable Code
Typeable Code
-> (forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> Code -> c Code)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c Code)
-> (Code -> Constr)
-> (Code -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c Code))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Code))
-> ((forall b. Data b => b -> b) -> Code -> Code)
-> (forall r r'.
    (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Code -> r)
-> (forall r r'.
    (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Code -> r)
-> (forall u. (forall d. Data d => d -> u) -> Code -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> Code -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> Code -> m Code)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> Code -> m Code)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> Code -> m Code)
-> Data Code
Code -> DataType
Code -> Constr
(forall b. Data b => b -> b) -> Code -> Code
forall a.
Typeable a
-> (forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> a -> c a)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c a)
-> (a -> Constr)
-> (a -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c a))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a))
-> ((forall b. Data b => b -> b) -> a -> a)
-> (forall r r'.
    (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall r r'.
    (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall u. (forall d. Data d => d -> u) -> a -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> a -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> Data a
forall u. Int -> (forall d. Data d => d -> u) -> Code -> u
forall u. (forall d. Data d => d -> u) -> Code -> [u]
forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Code -> r
forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Code -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> Code -> m Code
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Code -> m Code
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c Code
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Code -> c Code
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c Code)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Code)
gmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Code -> m Code
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Code -> m Code
gmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Code -> m Code
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Code -> m Code
gmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> Code -> m Code
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> Code -> m Code
gmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> Code -> u
$cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> Code -> u
gmapQ :: forall u. (forall d. Data d => d -> u) -> Code -> [u]
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> Code -> [u]
gmapQr :: forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Code -> r
$cgmapQr :: forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Code -> r
gmapQl :: forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Code -> r
$cgmapQl :: forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Code -> r
gmapT :: (forall b. Data b => b -> b) -> Code -> Code
$cgmapT :: (forall b. Data b => b -> b) -> Code -> Code
dataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Code)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Code)
dataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c Code)
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c Code)
dataTypeOf :: Code -> DataType
$cdataTypeOf :: Code -> DataType
toConstr :: Code -> Constr
$ctoConstr :: Code -> Constr
gunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c Code
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c Code
gfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Code -> c Code
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Code -> c Code
Data, Typeable, Code -> Code -> Bool
(Code -> Code -> Bool) -> (Code -> Code -> Bool) -> Eq Code
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Code -> Code -> Bool
$c/= :: Code -> Code -> Bool
== :: Code -> Code -> Bool
$c== :: Code -> Code -> Bool
Eq, Eq Code
Eq Code
-> (Code -> Code -> Ordering)
-> (Code -> Code -> Bool)
-> (Code -> Code -> Bool)
-> (Code -> Code -> Bool)
-> (Code -> Code -> Bool)
-> (Code -> Code -> Code)
-> (Code -> Code -> Code)
-> Ord Code
Code -> Code -> Bool
Code -> Code -> Ordering
Code -> Code -> Code
forall a.
Eq a
-> (a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
min :: Code -> Code -> Code
$cmin :: Code -> Code -> Code
max :: Code -> Code -> Code
$cmax :: Code -> Code -> Code
>= :: Code -> Code -> Bool
$c>= :: Code -> Code -> Bool
> :: Code -> Code -> Bool
$c> :: Code -> Code -> Bool
<= :: Code -> Code -> Bool
$c<= :: Code -> Code -> Bool
< :: Code -> Code -> Bool
$c< :: Code -> Code -> Bool
compare :: Code -> Code -> Ordering
$ccompare :: Code -> Code -> Ordering
Ord, (forall x. Code -> Rep Code x)
-> (forall x. Rep Code x -> Code) -> Generic Code
forall x. Rep Code x -> Code
forall x. Code -> Rep Code x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Code x -> Code
$cfrom :: forall x. Code -> Rep Code x
Generic)

instance NFData Code where rnf :: Code -> ()
rnf = Code -> ()
forall a. (Generic a, GNFData (Rep a)) => a -> ()
genericRnf
instance Binary Code

instance FromJSON Code where
    parseJSON :: Value -> Parser Code
parseJSON = String -> (Object -> Parser Code) -> Value -> Parser Code
forall a. String -> (Object -> Parser a) -> Value -> Parser a
withObject String
"Code" ((Object -> Parser Code) -> Value -> Parser Code)
-> (Object -> Parser Code) -> Value -> Parser Code
forall a b. (a -> b) -> a -> b
$ \Object
o -> Text -> Text -> Text -> URL -> URL -> URL -> CodeSearchRepo -> Code
Code
        (Text
 -> Text -> Text -> URL -> URL -> URL -> CodeSearchRepo -> Code)
-> Parser Text
-> Parser
     (Text -> Text -> URL -> URL -> URL -> CodeSearchRepo -> Code)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Object
o Object -> Key -> Parser Text
forall a. FromJSON a => Object -> Key -> Parser a
.: Key
"name"
        Parser
  (Text -> Text -> URL -> URL -> URL -> CodeSearchRepo -> Code)
-> Parser Text
-> Parser (Text -> URL -> URL -> URL -> CodeSearchRepo -> Code)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Object
o Object -> Key -> Parser Text
forall a. FromJSON a => Object -> Key -> Parser a
.: Key
"path"
        Parser (Text -> URL -> URL -> URL -> CodeSearchRepo -> Code)
-> Parser Text
-> Parser (URL -> URL -> URL -> CodeSearchRepo -> Code)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Object
o Object -> Key -> Parser Text
forall a. FromJSON a => Object -> Key -> Parser a
.: Key
"sha"
        Parser (URL -> URL -> URL -> CodeSearchRepo -> Code)
-> Parser URL -> Parser (URL -> URL -> CodeSearchRepo -> Code)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Object
o Object -> Key -> Parser URL
forall a. FromJSON a => Object -> Key -> Parser a
.: Key
"url"
        Parser (URL -> URL -> CodeSearchRepo -> Code)
-> Parser URL -> Parser (URL -> CodeSearchRepo -> Code)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Object
o Object -> Key -> Parser URL
forall a. FromJSON a => Object -> Key -> Parser a
.: Key
"git_url"
        Parser (URL -> CodeSearchRepo -> Code)
-> Parser URL -> Parser (CodeSearchRepo -> Code)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Object
o Object -> Key -> Parser URL
forall a. FromJSON a => Object -> Key -> Parser a
.: Key
"html_url"
        Parser (CodeSearchRepo -> Code)
-> Parser CodeSearchRepo -> Parser Code
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Object
o Object -> Key -> Parser CodeSearchRepo
forall a. FromJSON a => Object -> Key -> Parser a
.: Key
"repository"