diff --git a/src/Language/Go/Syntax.hs b/src/Language/Go/Syntax.hs index c37a784f8..e9105ccf6 100644 --- a/src/Language/Go/Syntax.hs +++ b/src/Language/Go/Syntax.hs @@ -5,6 +5,7 @@ import Data.Abstract.Evaluatable import Data.Abstract.Module import qualified Data.Abstract.Package as Package import Data.Abstract.Path +import Data.Aeson import qualified Data.ByteString as B import qualified Data.ByteString.Char8 as BC import Data.JSON.Fields @@ -13,10 +14,10 @@ import Prologue import System.FilePath.Posix data Relative = Relative | NonRelative - deriving (Eq, Generic, Hashable, Ord, Show) + deriving (Eq, Generic, Hashable, Ord, Show, ToJSON) data ImportPath = ImportPath { unPath :: FilePath, pathIsRelative :: Relative } - deriving (Eq, Generic, Hashable, Ord, Show) + deriving (Eq, Generic, Hashable, Ord, Show, ToJSON) importPath :: ByteString -> ImportPath importPath str = let path = stripQuotes str in ImportPath (BC.unpack path) (pathType path) diff --git a/src/Language/Python/Syntax.hs b/src/Language/Python/Syntax.hs index 1aa99d740..fa54d53ef 100644 --- a/src/Language/Python/Syntax.hs +++ b/src/Language/Python/Syntax.hs @@ -4,23 +4,25 @@ module Language.Python.Syntax where import Data.Abstract.Environment as Env import Data.Abstract.Evaluatable 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.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 Diffing.Algorithm import GHC.Generics import Prelude hiding (fail) import Prologue 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 = QualifiedName (NonEmpty FilePath) | RelativeQualifiedName FilePath (Maybe QualifiedName) - deriving (Eq, Generic, Hashable, Ord, Show) + deriving (Eq, Generic, Hashable, Ord, Show, ToJSON) qualifiedName :: NonEmpty ByteString -> QualifiedName qualifiedName xs = QualifiedName (BC.unpack <$> xs) diff --git a/src/Language/TypeScript/Syntax.hs b/src/Language/TypeScript/Syntax.hs index 8fa467554..22e8c5d0b 100644 --- a/src/Language/TypeScript/Syntax.hs +++ b/src/Language/TypeScript/Syntax.hs @@ -6,6 +6,7 @@ import Data.Abstract.Evaluatable import qualified Data.Abstract.Module as M import Data.Abstract.Package import Data.Abstract.Path +import Data.Aeson import qualified Data.ByteString as B import qualified Data.ByteString.Char8 as BC import Data.JSON.Fields @@ -18,10 +19,10 @@ import Prologue import System.FilePath.Posix data Relative = Relative | NonRelative - deriving (Eq, Generic, Hashable, Ord, Show) + deriving (Eq, Generic, Hashable, Ord, Show, ToJSON) data ImportPath = ImportPath { unPath :: FilePath, pathIsRelative :: Relative } - deriving (Eq, Generic, Hashable, Ord, Show) + deriving (Eq, Generic, Hashable, Ord, Show, ToJSON) importPath :: ByteString -> ImportPath importPath str = let path = stripQuotes str in ImportPath (BC.unpack path) (pathType path)