-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d9c50d4
commit 2d67f84
Showing
6 changed files
with
59 additions
and
44 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
-- | | ||
|
||
module Pact.Core.Environment.State | ||
( EvalState(..) | ||
, MonadEvalState | ||
, HasEvalState | ||
) where | ||
|
||
-- | Aspects of the evaluation environment that are updated during the evaluation | ||
-- of a single pact transaction. | ||
data EvalState b i | ||
= EvalState | ||
{ _esCaps :: CapState QualifiedName PactValue | ||
, _esStack :: [StackFrame] | ||
, _esEvents :: [PactEvent PactValue] | ||
, _esLoaded :: Loaded b i | ||
, _esDefPactExec :: Maybe DefPactExec | ||
, _esTxId :: Maybe TxId | ||
} deriving Show | ||
|
||
instance Default (EvalState b i) where | ||
def = EvalState def [] [] mempty Nothing Nothing | ||
|
||
makeClassy ''EvalState | ||
|
||
-- | Any monad that can read, put, or modify the eval state. | ||
class Monad m => MonadEvalState b i m | m -> b, m -> i where | ||
getEvalState :: m (EvalState b i) | ||
putEvalState :: EvalState b i -> m () | ||
modifyEvalState :: (EvalState b i -> EvalState b i) -> m () |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters