cryptol-2.5.0: Cryptol: The Language of Cryptography

Copyright(c) 2013-2016 Galois Inc.
LicenseBSD3
Maintainercryptol@galois.com
Stabilityprovisional
Portabilityportable
Safe HaskellSafe
LanguageHaskell98

Cryptol.Eval

Description

 

Synopsis

Documentation

moduleEnv Source #

Arguments

:: EvalPrims b w 
=> Module

Module containing declarations to evaluate

-> GenEvalEnv b w

Environment to extend

-> Eval (GenEvalEnv b w) 

Extend the given evaluation environment with all the declarations contained in the given module.

runEval :: Eval a -> IO a Source #

Execute the given evaluation action.

data Eval a Source #

The monad for Cryptol evaluation.

Instances

Monad Eval Source # 

Methods

(>>=) :: Eval a -> (a -> Eval b) -> Eval b #

(>>) :: Eval a -> Eval b -> Eval b #

return :: a -> Eval a #

fail :: String -> Eval a #

Functor Eval Source # 

Methods

fmap :: (a -> b) -> Eval a -> Eval b #

(<$) :: a -> Eval b -> Eval a #

MonadFix Eval Source # 

Methods

mfix :: (a -> Eval a) -> Eval a #

Applicative Eval Source # 

Methods

pure :: a -> Eval a #

(<*>) :: Eval (a -> b) -> Eval a -> Eval b #

(*>) :: Eval a -> Eval b -> Eval b #

(<*) :: Eval a -> Eval b -> Eval a #

MonadIO Eval Source # 

Methods

liftIO :: IO a -> Eval a #

NFData a => NFData (Eval a) Source # 

Methods

rnf :: Eval a -> () #

emptyEnv :: GenEvalEnv b w Source #

Evaluation environment with no bindings

evalExpr Source #

Arguments

:: EvalPrims b w 
=> GenEvalEnv b w

Evaluation environment

-> Expr

Expression to evaluate

-> Eval (GenValue b w) 

Evaluate a Cryptol expression to a value. This evaluator is parameterized by the EvalPrims class, which defines the behavior of bits and words, in addition to providing implementations for all the primitives.

evalDecls Source #

Arguments

:: EvalPrims b w 
=> [DeclGroup]

Declaration groups to evaluate

-> GenEvalEnv b w

Environment to extend

-> Eval (GenEvalEnv b w) 

Extend the given evaluation environment with the result of evaluating the given collection of declaration groups.

data EvalError Source #

Data type describing errors that can occur during evaluation.

Constructors

InvalidIndex Integer

Out-of-bounds index

TypeCannotBeDemoted Type

Non-numeric type passed to demote function

DivideByZero

Division or modulus by 0

WordTooWide Integer

Bitvector too large

UserError String

Call to the Cryptol error primitive

LoopError String

Detectable nontermination

forceValue :: GenValue b w -> Eval () Source #

Force the evaluation of a value