mirror of
https://github.com/github/semantic.git
synced 2025-01-04 13:34:31 +03:00
add documentation
This commit is contained in:
parent
fbdef618ec
commit
190665ec14
@ -43,10 +43,15 @@ newtype Evaluator location value effects a = Evaluator { runEvaluator :: Eff eff
|
|||||||
|
|
||||||
deriving instance Member NonDet effects => Alternative (Evaluator location value effects)
|
deriving instance Member NonDet effects => Alternative (Evaluator location value effects)
|
||||||
|
|
||||||
|
-- | 'ValueRef' is the type subterms evaluate to and can represent either values directly ('Rval'), or references to values (lvals - such as local variables or object members)
|
||||||
data ValueRef value where
|
data ValueRef value where
|
||||||
|
-- Represents a value:
|
||||||
Rval :: value -> ValueRef value
|
Rval :: value -> ValueRef value
|
||||||
|
-- Represents a local variable. No environment is attached - it's assumed that LvalLocal will be evaluated in the same scope it was constructed:
|
||||||
LvalLocal :: Name -> ValueRef value
|
LvalLocal :: Name -> ValueRef value
|
||||||
|
-- Represents an object member:
|
||||||
LvalMember :: value -> Name -> ValueRef value
|
LvalMember :: value -> Name -> ValueRef value
|
||||||
|
|
||||||
deriving (Eq, Ord, Show)
|
deriving (Eq, Ord, Show)
|
||||||
|
|
||||||
-- Effects
|
-- Effects
|
||||||
|
@ -138,6 +138,7 @@ deriving instance Show (Unspecialized a b)
|
|||||||
instance Show1 (Unspecialized a) where
|
instance Show1 (Unspecialized a) where
|
||||||
liftShowsPrec _ _ = showsPrec
|
liftShowsPrec _ _ = showsPrec
|
||||||
|
|
||||||
|
-- | Evaluates a 'Value' returning the referenced value
|
||||||
value :: ( Addressable location effects
|
value :: ( Addressable location effects
|
||||||
, AbstractValue location value effects
|
, AbstractValue location value effects
|
||||||
, Members '[ Reader (Environment location value)
|
, Members '[ Reader (Environment location value)
|
||||||
@ -154,6 +155,7 @@ value (LvalLocal var) = variable var
|
|||||||
value (LvalMember obj prop) = evaluateInScopedEnv (pure obj) (variable prop)
|
value (LvalMember obj prop) = evaluateInScopedEnv (pure obj) (variable prop)
|
||||||
value (Rval val) = pure val
|
value (Rval val) = pure val
|
||||||
|
|
||||||
|
-- | Evaluates a 'Subterm' to its rval
|
||||||
subtermValue :: ( Addressable location effects
|
subtermValue :: ( Addressable location effects
|
||||||
, AbstractValue location value effects
|
, AbstractValue location value effects
|
||||||
, Members '[ Reader (Environment location value)
|
, Members '[ Reader (Environment location value)
|
||||||
|
Loading…
Reference in New Issue
Block a user