{-# LANGUAGE DeriveAnyClass #-}
{-# LANGUAGE DuplicateRecordFields #-}
module Ide.Plugin.CallHierarchy.Types where
import Data.Aeson
import Database.SQLite.Simple
import Database.SQLite.Simple.ToField
import GHC.Generics
data Vertex = Vertex {
Vertex -> String
mod :: String
, Vertex -> String
occ :: String
, Vertex -> String
hieSrc :: FilePath
, Vertex -> Int
sl :: Int
, Vertex -> Int
sc :: Int
, Vertex -> Int
el :: Int
, Vertex -> Int
ec :: Int
, Vertex -> Int
casl :: Int
, Vertex -> Int
casc :: Int
, Vertex -> Int
cael :: Int
, Vertex -> Int
caec :: Int
} deriving (Vertex -> Vertex -> Bool
(Vertex -> Vertex -> Bool)
-> (Vertex -> Vertex -> Bool) -> Eq Vertex
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: Vertex -> Vertex -> Bool
== :: Vertex -> Vertex -> Bool
$c/= :: Vertex -> Vertex -> Bool
/= :: Vertex -> Vertex -> Bool
Eq, Int -> Vertex -> ShowS
[Vertex] -> ShowS
Vertex -> String
(Int -> Vertex -> ShowS)
-> (Vertex -> String) -> ([Vertex] -> ShowS) -> Show Vertex
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> Vertex -> ShowS
showsPrec :: Int -> Vertex -> ShowS
$cshow :: Vertex -> String
show :: Vertex -> String
$cshowList :: [Vertex] -> ShowS
showList :: [Vertex] -> ShowS
Show, (forall x. Vertex -> Rep Vertex x)
-> (forall x. Rep Vertex x -> Vertex) -> Generic Vertex
forall x. Rep Vertex x -> Vertex
forall x. Vertex -> Rep Vertex x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. Vertex -> Rep Vertex x
from :: forall x. Vertex -> Rep Vertex x
$cto :: forall x. Rep Vertex x -> Vertex
to :: forall x. Rep Vertex x -> Vertex
Generic, Maybe Vertex
Value -> Parser [Vertex]
Value -> Parser Vertex
(Value -> Parser Vertex)
-> (Value -> Parser [Vertex]) -> Maybe Vertex -> FromJSON Vertex
forall a.
(Value -> Parser a)
-> (Value -> Parser [a]) -> Maybe a -> FromJSON a
$cparseJSON :: Value -> Parser Vertex
parseJSON :: Value -> Parser Vertex
$cparseJSONList :: Value -> Parser [Vertex]
parseJSONList :: Value -> Parser [Vertex]
$comittedField :: Maybe Vertex
omittedField :: Maybe Vertex
FromJSON, [Vertex] -> Value
[Vertex] -> Encoding
Vertex -> Bool
Vertex -> Value
Vertex -> Encoding
(Vertex -> Value)
-> (Vertex -> Encoding)
-> ([Vertex] -> Value)
-> ([Vertex] -> Encoding)
-> (Vertex -> Bool)
-> ToJSON Vertex
forall a.
(a -> Value)
-> (a -> Encoding)
-> ([a] -> Value)
-> ([a] -> Encoding)
-> (a -> Bool)
-> ToJSON a
$ctoJSON :: Vertex -> Value
toJSON :: Vertex -> Value
$ctoEncoding :: Vertex -> Encoding
toEncoding :: Vertex -> Encoding
$ctoJSONList :: [Vertex] -> Value
toJSONList :: [Vertex] -> Value
$ctoEncodingList :: [Vertex] -> Encoding
toEncodingList :: [Vertex] -> Encoding
$comitField :: Vertex -> Bool
omitField :: Vertex -> Bool
ToJSON)
instance ToRow Vertex where
toRow :: Vertex -> [SQLData]
toRow (Vertex String
a String
b String
c Int
d Int
e Int
f Int
g Int
h Int
i Int
j Int
k) =
[ String -> SQLData
forall a. ToField a => a -> SQLData
toField String
a, String -> SQLData
forall a. ToField a => a -> SQLData
toField String
b, String -> SQLData
forall a. ToField a => a -> SQLData
toField String
c, Int -> SQLData
forall a. ToField a => a -> SQLData
toField Int
d
, Int -> SQLData
forall a. ToField a => a -> SQLData
toField Int
e, Int -> SQLData
forall a. ToField a => a -> SQLData
toField Int
f, Int -> SQLData
forall a. ToField a => a -> SQLData
toField Int
g, Int -> SQLData
forall a. ToField a => a -> SQLData
toField Int
h
, Int -> SQLData
forall a. ToField a => a -> SQLData
toField Int
i, Int -> SQLData
forall a. ToField a => a -> SQLData
toField Int
j, Int -> SQLData
forall a. ToField a => a -> SQLData
toField Int
k
]
instance FromRow Vertex where
fromRow :: RowParser Vertex
fromRow = String
-> String
-> String
-> Int
-> Int
-> Int
-> Int
-> Int
-> Int
-> Int
-> Int
-> Vertex
Vertex (String
-> String
-> String
-> Int
-> Int
-> Int
-> Int
-> Int
-> Int
-> Int
-> Int
-> Vertex)
-> RowParser String
-> RowParser
(String
-> String
-> Int
-> Int
-> Int
-> Int
-> Int
-> Int
-> Int
-> Int
-> Vertex)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> RowParser String
forall a. FromField a => RowParser a
field RowParser
(String
-> String
-> Int
-> Int
-> Int
-> Int
-> Int
-> Int
-> Int
-> Int
-> Vertex)
-> RowParser String
-> RowParser
(String
-> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Vertex)
forall a b. RowParser (a -> b) -> RowParser a -> RowParser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> RowParser String
forall a. FromField a => RowParser a
field RowParser
(String
-> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Vertex)
-> RowParser String
-> RowParser
(Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Vertex)
forall a b. RowParser (a -> b) -> RowParser a -> RowParser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> RowParser String
forall a. FromField a => RowParser a
field
RowParser
(Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Vertex)
-> RowParser Int
-> RowParser
(Int -> Int -> Int -> Int -> Int -> Int -> Int -> Vertex)
forall a b. RowParser (a -> b) -> RowParser a -> RowParser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> RowParser Int
forall a. FromField a => RowParser a
field RowParser (Int -> Int -> Int -> Int -> Int -> Int -> Int -> Vertex)
-> RowParser Int
-> RowParser (Int -> Int -> Int -> Int -> Int -> Int -> Vertex)
forall a b. RowParser (a -> b) -> RowParser a -> RowParser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> RowParser Int
forall a. FromField a => RowParser a
field RowParser (Int -> Int -> Int -> Int -> Int -> Int -> Vertex)
-> RowParser Int
-> RowParser (Int -> Int -> Int -> Int -> Int -> Vertex)
forall a b. RowParser (a -> b) -> RowParser a -> RowParser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> RowParser Int
forall a. FromField a => RowParser a
field
RowParser (Int -> Int -> Int -> Int -> Int -> Vertex)
-> RowParser Int -> RowParser (Int -> Int -> Int -> Int -> Vertex)
forall a b. RowParser (a -> b) -> RowParser a -> RowParser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> RowParser Int
forall a. FromField a => RowParser a
field RowParser (Int -> Int -> Int -> Int -> Vertex)
-> RowParser Int -> RowParser (Int -> Int -> Int -> Vertex)
forall a b. RowParser (a -> b) -> RowParser a -> RowParser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> RowParser Int
forall a. FromField a => RowParser a
field RowParser (Int -> Int -> Int -> Vertex)
-> RowParser Int -> RowParser (Int -> Int -> Vertex)
forall a b. RowParser (a -> b) -> RowParser a -> RowParser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> RowParser Int
forall a. FromField a => RowParser a
field
RowParser (Int -> Int -> Vertex)
-> RowParser Int -> RowParser (Int -> Vertex)
forall a b. RowParser (a -> b) -> RowParser a -> RowParser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> RowParser Int
forall a. FromField a => RowParser a
field RowParser (Int -> Vertex) -> RowParser Int -> RowParser Vertex
forall a b. RowParser (a -> b) -> RowParser a -> RowParser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> RowParser Int
forall a. FromField a => RowParser a
field
data SymbolPosition = SymbolPosition {
SymbolPosition -> Int
psl :: Int
, SymbolPosition -> Int
psc :: Int
} deriving (SymbolPosition -> SymbolPosition -> Bool
(SymbolPosition -> SymbolPosition -> Bool)
-> (SymbolPosition -> SymbolPosition -> Bool) -> Eq SymbolPosition
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: SymbolPosition -> SymbolPosition -> Bool
== :: SymbolPosition -> SymbolPosition -> Bool
$c/= :: SymbolPosition -> SymbolPosition -> Bool
/= :: SymbolPosition -> SymbolPosition -> Bool
Eq, Int -> SymbolPosition -> ShowS
[SymbolPosition] -> ShowS
SymbolPosition -> String
(Int -> SymbolPosition -> ShowS)
-> (SymbolPosition -> String)
-> ([SymbolPosition] -> ShowS)
-> Show SymbolPosition
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> SymbolPosition -> ShowS
showsPrec :: Int -> SymbolPosition -> ShowS
$cshow :: SymbolPosition -> String
show :: SymbolPosition -> String
$cshowList :: [SymbolPosition] -> ShowS
showList :: [SymbolPosition] -> ShowS
Show, (forall x. SymbolPosition -> Rep SymbolPosition x)
-> (forall x. Rep SymbolPosition x -> SymbolPosition)
-> Generic SymbolPosition
forall x. Rep SymbolPosition x -> SymbolPosition
forall x. SymbolPosition -> Rep SymbolPosition x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. SymbolPosition -> Rep SymbolPosition x
from :: forall x. SymbolPosition -> Rep SymbolPosition x
$cto :: forall x. Rep SymbolPosition x -> SymbolPosition
to :: forall x. Rep SymbolPosition x -> SymbolPosition
Generic, Maybe SymbolPosition
Value -> Parser [SymbolPosition]
Value -> Parser SymbolPosition
(Value -> Parser SymbolPosition)
-> (Value -> Parser [SymbolPosition])
-> Maybe SymbolPosition
-> FromJSON SymbolPosition
forall a.
(Value -> Parser a)
-> (Value -> Parser [a]) -> Maybe a -> FromJSON a
$cparseJSON :: Value -> Parser SymbolPosition
parseJSON :: Value -> Parser SymbolPosition
$cparseJSONList :: Value -> Parser [SymbolPosition]
parseJSONList :: Value -> Parser [SymbolPosition]
$comittedField :: Maybe SymbolPosition
omittedField :: Maybe SymbolPosition
FromJSON, [SymbolPosition] -> Value
[SymbolPosition] -> Encoding
SymbolPosition -> Bool
SymbolPosition -> Value
SymbolPosition -> Encoding
(SymbolPosition -> Value)
-> (SymbolPosition -> Encoding)
-> ([SymbolPosition] -> Value)
-> ([SymbolPosition] -> Encoding)
-> (SymbolPosition -> Bool)
-> ToJSON SymbolPosition
forall a.
(a -> Value)
-> (a -> Encoding)
-> ([a] -> Value)
-> ([a] -> Encoding)
-> (a -> Bool)
-> ToJSON a
$ctoJSON :: SymbolPosition -> Value
toJSON :: SymbolPosition -> Value
$ctoEncoding :: SymbolPosition -> Encoding
toEncoding :: SymbolPosition -> Encoding
$ctoJSONList :: [SymbolPosition] -> Value
toJSONList :: [SymbolPosition] -> Value
$ctoEncodingList :: [SymbolPosition] -> Encoding
toEncodingList :: [SymbolPosition] -> Encoding
$comitField :: SymbolPosition -> Bool
omitField :: SymbolPosition -> Bool
ToJSON)
instance ToRow SymbolPosition where
toRow :: SymbolPosition -> [SQLData]
toRow (SymbolPosition Int
a Int
b) = (Int, Int) -> [SQLData]
forall a. ToRow a => a -> [SQLData]
toRow (Int
a, Int
b)
instance FromRow SymbolPosition where
fromRow :: RowParser SymbolPosition
fromRow = Int -> Int -> SymbolPosition
SymbolPosition (Int -> Int -> SymbolPosition)
-> RowParser Int -> RowParser (Int -> SymbolPosition)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> RowParser Int
forall a. FromField a => RowParser a
field RowParser (Int -> SymbolPosition)
-> RowParser Int -> RowParser SymbolPosition
forall a b. RowParser (a -> b) -> RowParser a -> RowParser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> RowParser Int
forall a. FromField a => RowParser a
field