mirror of
https://github.com/github/semantic.git
synced 2024-12-24 07:25:44 +03:00
Need a few toJSON instances here
This commit is contained in:
parent
9a8c117515
commit
eef8d34d43
@ -5,6 +5,7 @@ import Data.Abstract.Evaluatable
|
|||||||
import Data.Abstract.Module
|
import Data.Abstract.Module
|
||||||
import qualified Data.Abstract.Package as Package
|
import qualified Data.Abstract.Package as Package
|
||||||
import Data.Abstract.Path
|
import Data.Abstract.Path
|
||||||
|
import Data.Aeson
|
||||||
import qualified Data.ByteString as B
|
import qualified Data.ByteString as B
|
||||||
import qualified Data.ByteString.Char8 as BC
|
import qualified Data.ByteString.Char8 as BC
|
||||||
import Data.JSON.Fields
|
import Data.JSON.Fields
|
||||||
@ -13,10 +14,10 @@ import Prologue
|
|||||||
import System.FilePath.Posix
|
import System.FilePath.Posix
|
||||||
|
|
||||||
data Relative = Relative | NonRelative
|
data Relative = Relative | NonRelative
|
||||||
deriving (Eq, Generic, Hashable, Ord, Show)
|
deriving (Eq, Generic, Hashable, Ord, Show, ToJSON)
|
||||||
|
|
||||||
data ImportPath = ImportPath { unPath :: FilePath, pathIsRelative :: Relative }
|
data ImportPath = ImportPath { unPath :: FilePath, pathIsRelative :: Relative }
|
||||||
deriving (Eq, Generic, Hashable, Ord, Show)
|
deriving (Eq, Generic, Hashable, Ord, Show, ToJSON)
|
||||||
|
|
||||||
importPath :: ByteString -> ImportPath
|
importPath :: ByteString -> ImportPath
|
||||||
importPath str = let path = stripQuotes str in ImportPath (BC.unpack path) (pathType path)
|
importPath str = let path = stripQuotes str in ImportPath (BC.unpack path) (pathType path)
|
||||||
|
@ -4,23 +4,25 @@ module Language.Python.Syntax where
|
|||||||
import Data.Abstract.Environment as Env
|
import Data.Abstract.Environment as Env
|
||||||
import Data.Abstract.Evaluatable
|
import Data.Abstract.Evaluatable
|
||||||
import Data.Abstract.Module
|
import Data.Abstract.Module
|
||||||
import qualified Data.ByteString.Char8 as BC
|
import Data.Aeson
|
||||||
|
import Data.Align.Generic
|
||||||
import Data.Functor.Classes.Generic
|
import Data.Functor.Classes.Generic
|
||||||
import Data.JSON.Fields
|
import Data.JSON.Fields
|
||||||
import qualified Data.Language as Language
|
|
||||||
import qualified Data.List.NonEmpty as NonEmpty
|
|
||||||
import qualified Data.Semigroup.Reducer as Reducer
|
|
||||||
import Data.Mergeable
|
import Data.Mergeable
|
||||||
import Diffing.Algorithm
|
import Diffing.Algorithm
|
||||||
import GHC.Generics
|
import GHC.Generics
|
||||||
import Prelude hiding (fail)
|
import Prelude hiding (fail)
|
||||||
import Prologue
|
import Prologue
|
||||||
import System.FilePath.Posix
|
import System.FilePath.Posix
|
||||||
|
import qualified Data.ByteString.Char8 as BC
|
||||||
|
import qualified Data.Language as Language
|
||||||
|
import qualified Data.List.NonEmpty as NonEmpty
|
||||||
|
import qualified Data.Semigroup.Reducer as Reducer
|
||||||
|
|
||||||
data QualifiedName
|
data QualifiedName
|
||||||
= QualifiedName (NonEmpty FilePath)
|
= QualifiedName (NonEmpty FilePath)
|
||||||
| RelativeQualifiedName FilePath (Maybe QualifiedName)
|
| RelativeQualifiedName FilePath (Maybe QualifiedName)
|
||||||
deriving (Eq, Generic, Hashable, Ord, Show)
|
deriving (Eq, Generic, Hashable, Ord, Show, ToJSON)
|
||||||
|
|
||||||
qualifiedName :: NonEmpty ByteString -> QualifiedName
|
qualifiedName :: NonEmpty ByteString -> QualifiedName
|
||||||
qualifiedName xs = QualifiedName (BC.unpack <$> xs)
|
qualifiedName xs = QualifiedName (BC.unpack <$> xs)
|
||||||
|
@ -6,6 +6,7 @@ import Data.Abstract.Evaluatable
|
|||||||
import qualified Data.Abstract.Module as M
|
import qualified Data.Abstract.Module as M
|
||||||
import Data.Abstract.Package
|
import Data.Abstract.Package
|
||||||
import Data.Abstract.Path
|
import Data.Abstract.Path
|
||||||
|
import Data.Aeson
|
||||||
import qualified Data.ByteString as B
|
import qualified Data.ByteString as B
|
||||||
import qualified Data.ByteString.Char8 as BC
|
import qualified Data.ByteString.Char8 as BC
|
||||||
import Data.JSON.Fields
|
import Data.JSON.Fields
|
||||||
@ -18,10 +19,10 @@ import Prologue
|
|||||||
import System.FilePath.Posix
|
import System.FilePath.Posix
|
||||||
|
|
||||||
data Relative = Relative | NonRelative
|
data Relative = Relative | NonRelative
|
||||||
deriving (Eq, Generic, Hashable, Ord, Show)
|
deriving (Eq, Generic, Hashable, Ord, Show, ToJSON)
|
||||||
|
|
||||||
data ImportPath = ImportPath { unPath :: FilePath, pathIsRelative :: Relative }
|
data ImportPath = ImportPath { unPath :: FilePath, pathIsRelative :: Relative }
|
||||||
deriving (Eq, Generic, Hashable, Ord, Show)
|
deriving (Eq, Generic, Hashable, Ord, Show, ToJSON)
|
||||||
|
|
||||||
importPath :: ByteString -> ImportPath
|
importPath :: ByteString -> ImportPath
|
||||||
importPath str = let path = stripQuotes str in ImportPath (BC.unpack path) (pathType path)
|
importPath str = let path = stripQuotes str in ImportPath (BC.unpack path) (pathType path)
|
||||||
|
Loading…
Reference in New Issue
Block a user