1
1
mirror of https://github.com/github/semantic.git synced 2024-11-24 08:54:07 +03:00

Generalize Analysis over the term type.

This commit is contained in:
Rob Rix 2019-07-29 12:03:12 -04:00
parent c82623db36
commit 104bdacaae
No known key found for this signature in database
GPG Key ID: F188A01508EA1CF7
4 changed files with 7 additions and 7 deletions

View File

@ -96,7 +96,7 @@ concreteAnalysis :: ( Carrier sig m
, Member (State Heap) sig
, MonadFail m
)
=> Analysis Precise Concrete m
=> Analysis (Term (Core.Ann :+: Core.Core)) Precise Concrete m
concreteAnalysis = Analysis{..}
where alloc _ = fresh
bind name addr m = local (Map.insert name addr) m

View File

@ -33,7 +33,7 @@ eval :: ( Carrier sig m
, MonadFail m
, Semigroup value
)
=> Analysis address value m
=> Analysis (Term (Ann :+: Core)) address value m
-> (Term (Ann :+: Core) User -> m value)
-> (Term (Ann :+: Core) User -> m value)
eval Analysis{..} eval = \case
@ -211,14 +211,14 @@ ruby = fromBody $ annWith callStack (rec (named' __semantic_global) (do' stateme
__semantic_truthy = "__semantic_truthy"
data Analysis address value m = Analysis
data Analysis term address value m = Analysis
{ alloc :: User -> m address
, bind :: forall a . User -> address -> m a -> m a
, lookupEnv :: User -> m (Maybe address)
, deref :: address -> m (Maybe value)
, assign :: address -> value -> m ()
, abstract :: (Term (Ann :+: Core) User -> m value) -> User -> Term (Ann :+: Core) User -> m value
, apply :: (Term (Ann :+: Core) User -> m value) -> value -> value -> m value
, abstract :: (term User -> m value) -> User -> term User -> m value
, apply :: (term User -> m value) -> value -> value -> m value
, unit :: m value
, bool :: Bool -> m value
, asBool :: value -> m Bool

View File

@ -78,7 +78,7 @@ importGraphAnalysis :: ( Alternative m
, Member (State (Heap User Value)) sig
, MonadFail m
)
=> Analysis User Value m
=> Analysis (Term (Core.Ann :+: Core.Core)) User Value m
importGraphAnalysis = Analysis{..}
where alloc = pure
bind _ _ m = m

View File

@ -128,7 +128,7 @@ typecheckingAnalysis
, Member (State (Set.Set Constraint)) sig
, Member (State (Heap User (Term Monotype Meta))) sig
)
=> Analysis User (Term Monotype Meta) m
=> Analysis term User (Term Monotype Meta) m
typecheckingAnalysis = Analysis{..}
where alloc = pure
bind _ _ m = m