1
1
mirror of https://github.com/github/semantic.git synced 2024-12-19 12:51:52 +03:00

Generalize parsePythonPackage over the term type.

This commit is contained in:
Rob Rix 2019-10-18 13:56:32 -04:00
parent 7b9b1ecd2e
commit 95abbb3ce1
No known key found for this signature in database
GPG Key ID: F188A01508EA1CF7

View File

@ -57,7 +57,6 @@ import Data.Graph.ControlFlowVertex (VertexDeclaration)
import Data.Language as Language
import Data.List (isPrefixOf, isSuffixOf)
import Data.Project
import Data.Term
import Data.Text (pack, unpack)
import Language.Haskell.HsColour
import Language.Haskell.HsColour.Colourise
@ -273,26 +272,28 @@ parseModules parser p = distributeFor (projectBlobs p) (parseModule p parser)
-- | Parse a list of packages from a python project.
parsePythonPackage :: forall syntax sig m .
( Declarations1 syntax
, Evaluatable syntax
, FreeVariables1 syntax
, AccessControls1 syntax
, Functor syntax
parsePythonPackage :: forall term sig m .
( Declarations term
, Evaluatable (Base term)
, FreeVariables term
, AccessControls term
, Recursive term
, Member Distribute sig
, Member Parse sig
, Member Resolution sig
, Member Trace sig
, HasSpan term
, Show term
, Carrier sig m
, Effect sig
)
=> Parser (Term syntax Loc) -- ^ A parser.
-> Project -- ^ Project to parse into a package.
-> m (Package (Term syntax Loc))
=> Parser term -- ^ A parser.
-> Project -- ^ Project to parse into a package.
-> m (Package term)
parsePythonPackage parser project = do
let runAnalysis = runEvaluator @_ @_ @(Value (Term syntax Loc) (Hole (Maybe Name) Precise))
let runAnalysis = runEvaluator @_ @_ @(Value term (Hole (Maybe Name) Precise))
. raiseHandler (runState PythonPackage.Unknown)
. raiseHandler (runState (lowerBound @(Heap (Hole (Maybe Name) Precise) (Hole (Maybe Name) Precise) (Value (Term syntax Loc) (Hole (Maybe Name) Precise)))))
. raiseHandler (runState (lowerBound @(Heap (Hole (Maybe Name) Precise) (Hole (Maybe Name) Precise) (Value term (Hole (Maybe Name) Precise)))))
. raiseHandler runFresh
. resumingLoadError
. resumingUnspecialized