diff --git a/src/Control/Abstract/Value.hs b/src/Control/Abstract/Value.hs index 643abebeb..aa78efdc2 100644 --- a/src/Control/Abstract/Value.hs +++ b/src/Control/Abstract/Value.hs @@ -126,7 +126,7 @@ class (Monad m, Show value) => MonadValue location value m | m value -> location -- | Evaluate an abstraction (a binder like a lambda or method definition). abstract :: (FreeVariables term, MonadControl term m) => [Name] -> Subterm term (m value) -> m value -- | Evaluate an application (like a function call). - apply :: value -> [m value] -> m value + call :: value -> [m value] -> m value -- | Primitive looping combinator, approximately equivalent to 'fix'. This should be used in place of direct recursion, as it allows abstraction over recursion. -- diff --git a/src/Data/Abstract/Evaluatable.hs b/src/Data/Abstract/Evaluatable.hs index 843c25952..dc6850090 100644 --- a/src/Data/Abstract/Evaluatable.hs +++ b/src/Data/Abstract/Evaluatable.hs @@ -197,7 +197,7 @@ evaluatePackage p = pushPackage p (localModuleTable (<> packageModules p) (traverse evaluateEntryPoint (ModuleTable.toPairs (packageEntryPoints p)))) where evaluateEntryPoint (m, sym) = do (_, v) <- require m - maybe (pure v) ((`X.apply` []) <=< variable) sym + maybe (pure v) ((`call` []) <=< variable) sym pushPackage :: ( Effectful m , Member (Reader (SomeOrigin term)) effects diff --git a/src/Data/Abstract/Type.hs b/src/Data/Abstract/Type.hs index f432e95fa..ab523d6e0 100644 --- a/src/Data/Abstract/Type.hs +++ b/src/Data/Abstract/Type.hs @@ -118,7 +118,7 @@ instance ( Alternative m (Int, Float) -> pure Int _ -> unify left right $> Bool - apply op params = do + call op params = do tvar <- fresh paramTypes <- sequenceA params _ :-> ret <- op `unify` (Product paramTypes :-> Var tvar) diff --git a/src/Data/Abstract/Value.hs b/src/Data/Abstract/Value.hs index 004e08306..4227c914d 100644 --- a/src/Data/Abstract/Value.hs +++ b/src/Data/Abstract/Value.hs @@ -300,7 +300,7 @@ instance (Monad m, MonadEvaluatable location term (Value location) m) => MonadVa l <- label body injValue . Closure names l . Env.bind (foldr Set.delete (Set.fromList (freeVariables body)) names) <$> getEnv - apply op params = do + call op params = do Closure names label env <- maybe (fail ("expected a closure, got: " <> show op)) pure (prjValue op) bindings <- foldr (\ (name, param) rest -> do v <- param diff --git a/src/Data/Syntax/Expression.hs b/src/Data/Syntax/Expression.hs index e597889a2..79adda0e2 100644 --- a/src/Data/Syntax/Expression.hs +++ b/src/Data/Syntax/Expression.hs @@ -6,7 +6,7 @@ import Data.Abstract.Number (liftIntegralFrac, liftReal, liftedExponent) import Data.Fixed import Diffing.Algorithm import Prelude -import Prologue hiding (apply) +import Prologue -- | Typical prefix function application, like `f(x)` in many languages, or `f x` in Haskell. data Call a = Call { callContext :: ![a], callFunction :: !a, callParams :: ![a], callBlock :: !a } @@ -19,7 +19,7 @@ instance Show1 Call where liftShowsPrec = genericLiftShowsPrec instance Evaluatable Call where eval Call{..} = do op <- subtermValue callFunction - apply op (map subtermValue callParams) + call op (map subtermValue callParams) data Comparison a = LessThan !a !a