Skip to content

Commit

Permalink
uses the correct environment for calls
Browse files Browse the repository at this point in the history
  • Loading branch information
bramvdbogaerde committed Nov 7, 2023
1 parent 9bb48a8 commit 30516f4
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
8 changes: 6 additions & 2 deletions maf2-analysis/app/Run/Analyzer.hs
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,17 @@ module Run.Analyzer(Options, options, main) where

import Options.Applicative
import Analysis.Scheme.Simple
import Syntax.Scheme
import Data.DMap
import Data.Maybe
import qualified Data.DMap as DMap
import Text.Printf
import Data.HashMap.Strict (HashMap)
import qualified Data.HashMap.Strict as Map
import Data.List (intercalate)
import Analysis.Monad
import Data.Map (Map)
import qualified Data.Map as Map2
import Data.Functor.Identity
import Data.Function ((&))

newtype Options = Options String deriving Show

Expand Down
10 changes: 6 additions & 4 deletions maf2-analysis/src/Analysis/Scheme.hs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ module Analysis.Scheme where

import Prelude hiding (exp, lookup)

import Debug.Trace

import Analysis.Scheme.Primitives
import qualified Analysis.Scheme.Semantics as Semantics
import Analysis.Scheme.Monad (SchemeM)
Expand All @@ -28,6 +26,7 @@ import Data.Dynamic
import Data.Functor.Identity
import Data.TypeLevel.Ghost
import Data.Functor ((<&>))
import Analysis.Monad (EnvM(..))

-----------------------------------------
-- Shorthands
Expand Down Expand Up @@ -182,13 +181,16 @@ instance {-# OVERLAPPING #-} (
instance {-# OVERLAPPING #-} (CtxM m ctx,
Monad m,
StoreM (CallT var v ctx dep m) var,
EnvM m var (Env var v ctx dep),
SchemeAnalysisConstraints var v ctx dep
) => CallM (CallT var v ctx dep m) (Env var v ctx dep) v where
call (Lam _ bdy _, env) = do
call (Lam _ bdy _, _) = do
-- get the extended environment
env' <- CallT $ lift getEnv
-- get the current context
ctx <- CallT $ lift getCtx
-- create a new component from this context
let comp = (bdy, env, ctx, Ghost)
let comp = (bdy, env', ctx, Ghost)
-- spawn the new component
_ <- CallT $ spawn comp
-- lookup the return value of the component
Expand Down

0 comments on commit 30516f4

Please sign in to comment.