mirror of
https://github.com/github/semantic.git
synced 2024-12-25 07:55:12 +03:00
Sample definition for module stuff. Now to write some Generics code.
This commit is contained in:
parent
bb01a368fb
commit
24053a1477
@ -8,6 +8,7 @@ module Language.Python
|
||||
|
||||
-- import Control.Carrier.Reader
|
||||
-- import Control.Monad.IO.Class
|
||||
import Data.Foldable
|
||||
import Data.ScopeGraph (ToScopeGraph (..))
|
||||
import qualified Data.ScopeGraph as ScopeGraph
|
||||
import qualified Language.Python.Tags as PyTags
|
||||
@ -24,20 +25,8 @@ instance TS.Unmarshal Term where
|
||||
instance Tags.ToTags Term where
|
||||
tags src = Tags.runTagging src . PyTags.tags . getTerm
|
||||
|
||||
|
||||
instance ScopeGraph.ToScopeGraph Term where
|
||||
scopeGraph = ScopeGraph.scopeGraph . getTerm
|
||||
|
||||
instance ToScopeGraph Py.Module where
|
||||
scopeGraph _ = pure (ScopeGraph.empty)
|
||||
-- scopeGraph Py.Module { Py.extraChildren = _stmts } = do
|
||||
-- parent <- ask
|
||||
-- self <- liftIO $ ScopeGraph.scope
|
||||
-- pure $ ScopeGraph.edges [(parent, self)]
|
||||
-- parent <- ask
|
||||
-- self <- ScopeGraph . G.vertex . Node Scope <$> liftIO newUnique
|
||||
-- foldr (\item acc -> do {
|
||||
-- x <- acc;
|
||||
-- y <- scopeGraph src item;
|
||||
-- pure (x --> y);
|
||||
-- }) (pure (parent --> self)) stmts
|
||||
scopeGraph Py.Module { Py.extraChildren = stmts } = fold <$> traverse scopeGraph stmts
|
||||
|
Loading…
Reference in New Issue
Block a user