Skip to content

Commit

Permalink
Include REPL let bindings in the reference interpreter.
Browse files Browse the repository at this point in the history
Fixes #1133
  • Loading branch information
robdockins committed Apr 6, 2021
1 parent 523a2dc commit 235fe78
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/Cryptol/Eval/Reference.lhs
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ and type variables that are in scope at any point.
> instance Semigroup Env where
> l <> r = Env
> { envVars = envVars l <> envVars r
> , envTypes = envTypes l <> envTypes r
> , envTypes = envTypes l <> envTypes r
> }
>
> instance Monoid Env where
Expand Down Expand Up @@ -523,7 +523,7 @@ newtypes is thus basically just an identity function
that consumes and ignores its type arguments.

> evalNewtypeDecl :: Env -> Newtype -> Env
> evalNewtypeDecl env nt = bindVar (ntName nt, pure val) env
> evalNewtypeDecl env nt = bindVar (ntName nt, pure val) env
> where
> val = foldr tabs con (ntParams nt)
> con = VFun (\x -> x)
Expand Down Expand Up @@ -1732,7 +1732,7 @@ running the reference evaluator on an expression.
> evaluate expr minp = return (Right (val, modEnv), [])
> where
> modEnv = M.minpModuleEnv minp
> extDgs = concatMap mDecls (M.loadedModules modEnv)
> extDgs = concatMap mDecls (M.loadedModules modEnv) ++ M.deDecls (M.meDynEnv modEnv)
> nts = Map.elems (M.loadedNewtypes modEnv)
> env = foldl evalDeclGroup (foldl evalNewtypeDecl mempty nts) extDgs
> val = evalExpr env expr
3 changes: 3 additions & 0 deletions tests/issues/issue1133.icry
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
let x = zero:[8]
x@0
:eval x@0
3 changes: 3 additions & 0 deletions tests/issues/issue1133.icry.stdout
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Loading module Cryptol
False
False

0 comments on commit 235fe78

Please sign in to comment.