Skip to content

Commit a5ed1cb

Browse files
committed
Load and bring into scope the magic Cryptol Array module.
Perhaps this should be configurable; or we should implement the ability to load modules by name to avoid needing this to be baked-in.
1 parent 55ac00f commit a5ed1cb

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

cryptol-saw-core/src/Verifier/SAW/CryptolEnv.hs

+6-3
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ import qualified Cryptol.ModuleSystem.Renamer as MR
8787
import qualified Cryptol.Utils.Ident as C
8888

8989
import Cryptol.Utils.PP hiding ((</>))
90-
import Cryptol.Utils.Ident (Ident, preludeName, preludeReferenceName
90+
import Cryptol.Utils.Ident (Ident, preludeName, arrayName, preludeReferenceName
9191
, packIdent, interactiveName, identText
9292
, packModName, textToModName, modNameChunks
9393
, prelPrim)
@@ -189,10 +189,12 @@ initCryptolEnv sc = do
189189
let modEnv1 = modEnv0 { ME.meSearchPath = cryptolPaths ++
190190
(instDir </> "lib") : ME.meSearchPath modEnv0 }
191191

192-
-- Load Cryptol prelude
192+
-- Load Cryptol prelude and magic Array module
193193
(_, modEnv2) <-
194194
liftModuleM modEnv1 $
195-
MB.loadModuleFrom False (MM.FromModule preludeName)
195+
do _ <- MB.loadModuleFrom False (MM.FromModule preludeName)
196+
_ <- MB.loadModuleFrom False (MM.FromModule arrayName)
197+
return ()
196198

197199
-- Load Cryptol reference implementations
198200
((_,refMod), modEnv) <-
@@ -213,6 +215,7 @@ initCryptolEnv sc = do
213215
return CryptolEnv
214216
{ eImports = [ (OnlyPublic, P.Import preludeName Nothing Nothing)
215217
, (OnlyPublic, P.Import preludeReferenceName (Just preludeReferenceName) Nothing)
218+
, (OnlyPublic, P.Import arrayName Nothing Nothing)
216219
]
217220
, eModuleEnv = modEnv
218221
, eExtraNames = mempty

0 commit comments

Comments
 (0)