diff --git a/pact-core/Pact/Core/IR/Desugar.hs b/pact-core/Pact/Core/IR/Desugar.hs index d7ae236e2..3bbf36f99 100644 --- a/pact-core/Pact/Core/IR/Desugar.hs +++ b/pact-core/Pact/Core/IR/Desugar.hs @@ -27,7 +27,6 @@ module Pact.Core.IR.Desugar , DesugarBuiltin(..) ) where -import Debug.Trace import Control.Monad ( when, forM, (>=>)) import Control.Monad.Reader import Control.Monad.State.Strict @@ -652,7 +651,7 @@ resolveModuleName resolveModuleName mn i = use (rsLoaded . loModules . at mn) >>= \case Just md -> pure md - Nothing -> trace "@@@@@@" $ + Nothing -> view rePactDb >>= liftIO . (`readModule` mn) >>= \case Nothing -> throwDesugarError (NoSuchModule mn) i Just md -> case md of @@ -776,7 +775,7 @@ lookupModuleMember modName name i = do loadInterface iface deps dconstDeps dcDeps pure (Name name nk, dk) Nothing -> throwDesugarError (NoSuchModuleMember modName name) i - Nothing -> trace "!!!!!!!" $ throwDesugarError (NoSuchModule modName) i + Nothing -> throwDesugarError (NoSuchModule modName) i where toDepMap mhash def = (defName def, (NTopLevel modName mhash, defKind def)) @@ -1089,7 +1088,7 @@ resolveBare (BareName bn) i = views reBinds (M.lookup bn) >>= \case (nk, dk) -> pure (Name bn nk, dk) Nothing -> uses (rsLoaded . loToplevel) (M.lookup bn) >>= \case Just (fqn, dk) -> pure (Name bn (NTopLevel (_fqModule fqn) (_fqHash fqn)), Just dk) - Nothing -> trace (show bn) $ do + Nothing -> do let mn = ModuleName bn Nothing resolveModuleName mn i >>= \case ModuleData md _ -> do diff --git a/pact-core/Pact/Core/IR/Term.hs b/pact-core/Pact/Core/IR/Term.hs index 949844006..ffc579fef 100644 --- a/pact-core/Pact/Core/IR/Term.hs +++ b/pact-core/Pact/Core/IR/Term.hs @@ -38,46 +38,6 @@ import Pact.Core.Imports import Pact.Core.Capabilities import Pact.Core.Pretty -data LamInfo - = TLDefun ModuleName Text - | TLDefCap ModuleName Text - | TLDefPact ModuleName Text - | AnonLamInfo - deriving Show - --- | Core IR -data Term name ty builtin info - = Var name info - -- ^ single variables e.g x - | Lam LamInfo (NonEmpty (Arg ty)) (Term name ty builtin info) info - -- ^ $f = \x.e - -- Lambdas are named for the sake of the callstack. - | Let (Arg ty) (Term name ty builtin info) (Term name ty builtin info) info - -- ^ let x = e1 in e2 - | App (Term name ty builtin info) (NonEmpty (Term name ty builtin info)) info - -- ^ (e1 e2) - | Sequence (Term name ty builtin info) (Term name ty builtin info) info - -- ^ error term , error "blah" - | Conditional (BuiltinForm (Term name ty builtin info)) info - -- ^ Conditional terms - | Builtin builtin info - -- ^ Built-in ops, e.g (+) - | Constant Literal info - -- ^ Literals - | ListLit [Term name ty builtin info] info - -- ^ List Literals - | Try (Term name ty builtin info) (Term name ty builtin info) info - -- ^ try (catch expr) (try-expr) - | CapabilityForm (CapForm name (Term name ty builtin info)) info - -- ^ Capability Natives - | ObjectLit [(Field, Term name ty builtin info)] info - -- ^ an object literal - | DynInvoke (Term name ty builtin info) Text info - -- ^ dynamic module reference invocation m::f - | Error Text info - -- ^ Error term - deriving (Show, Functor) - data Defun name ty builtin info = Defun { _dfunName :: Text @@ -278,44 +238,45 @@ type EvalDef b i = Def Name Type b i type EvalModule b i = Module Name Type b i type EvalInterface b i = Interface Name Type b i --- data LamInfo --- = TLDefun ModuleName Text --- | TLDefCap ModuleName Text --- | AnonLamInfo --- deriving Show - --- -- | Core IR --- data Term name ty builtin info --- = Var name info --- -- ^ single variables e.g x --- | Lam LamInfo (NonEmpty (Arg ty)) (Term name ty builtin info) info --- -- ^ $f = \x.e --- -- Lambdas are named for the sake of the callstack. --- | Let (Arg ty) (Term name ty builtin info) (Term name ty builtin info) info --- -- ^ let x = e1 in e2 --- | App (Term name ty builtin info) (NonEmpty (Term name ty builtin info)) info --- -- ^ (e1 e2) --- | Sequence (Term name ty builtin info) (Term name ty builtin info) info --- -- ^ error term , error "blah" --- | Conditional (BuiltinForm (Term name ty builtin info)) info --- -- ^ Conditional terms --- | Builtin builtin info --- -- ^ Built-in ops, e.g (+) --- | Constant Literal info --- -- ^ Literals --- | ListLit [Term name ty builtin info] info --- -- ^ List Literals --- | Try (Term name ty builtin info) (Term name ty builtin info) info --- -- ^ try (catch expr) (try-expr) --- | CapabilityForm (CapForm name (Term name ty builtin info)) info --- -- ^ Capability Natives --- | ObjectLit [(Field, Term name ty builtin info)] info --- -- ^ an object literal --- | DynInvoke (Term name ty builtin info) Text info --- -- ^ dynamic module reference invocation m::f --- | Error Text info --- -- ^ Error term --- deriving (Show, Functor) +data LamInfo + = TLDefun ModuleName Text + | TLDefCap ModuleName Text + | TLDefPact ModuleName Text + | AnonLamInfo + deriving Show + +-- | Core IR +data Term name ty builtin info + = Var name info + -- ^ single variables e.g x + | Lam LamInfo (NonEmpty (Arg ty)) (Term name ty builtin info) info + -- ^ $f = \x.e + -- Lambdas are named for the sake of the callstack. + | Let (Arg ty) (Term name ty builtin info) (Term name ty builtin info) info + -- ^ let x = e1 in e2 + | App (Term name ty builtin info) (NonEmpty (Term name ty builtin info)) info + -- ^ (e1 e2) + | Sequence (Term name ty builtin info) (Term name ty builtin info) info + -- ^ error term , error "blah" + | Conditional (BuiltinForm (Term name ty builtin info)) info + -- ^ Conditional terms + | Builtin builtin info + -- ^ Built-in ops, e.g (+) + | Constant Literal info + -- ^ Literals + | ListLit [Term name ty builtin info] info + -- ^ List Literals + | Try (Term name ty builtin info) (Term name ty builtin info) info + -- ^ try (catch expr) (try-expr) + | CapabilityForm (CapForm name (Term name ty builtin info)) info + -- ^ Capability Natives + | ObjectLit [(Field, Term name ty builtin info)] info + -- ^ an object literal + | DynInvoke (Term name ty builtin info) Text info + -- ^ dynamic module reference invocation m::f + | Error Text info + -- ^ Error term + deriving (Show, Functor) instance (Pretty name, Pretty builtin, Pretty ty) => Pretty (Term name ty builtin info) where pretty = \case