Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Synopsis
- type TcInstrHandler = forall inp. SingI inp => ExpandedInstr -> HST inp -> TypeCheckInstrNoExcept (TypeCheckedSeq inp)
- type TcOriginatedContracts = Map ContractHash SomeParamType
- data TypeCheckEnv = TypeCheckEnv {
- tcMode :: ~TypeCheckMode
- type BigMapFinder = Natural -> Maybe SomeVBigMap
- data TypeCheckOptions = TypeCheckOptions {}
- type TypeCheck = MultiReaderT TCEnvs (Except TCError)
- type TypeCheckNoExcept = MultiReaderT TCEnvs Identity
- type TypeCheckResult = ReaderT TypeCheckOptions (Except TCError)
- runTypeCheck :: TypeCheckMode -> TypeCheck a -> TypeCheckResult a
- type TypeCheckInstr = MultiReaderT TCInstrEnvs (Except TCError)
- type TypeCheckInstrNoExcept = MultiReaderT TCInstrEnvs Identity
- runTypeCheckIsolated :: TypeCheck (SomeInstr t) -> TypeCheckResult (SomeInstr t)
- typeCheckingWith :: TypeCheckOptions -> TypeCheckResult a -> Either TCError a
- liftNoExcept :: forall m e (a :: Type). MonadMultiReaderT m Identity => m a -> ChangeMultiReaderBase m (Except e) a
- throwingTCError :: (MonadMultiReaderT m Identity, m' ~ ChangeMultiReaderBase m (Except TCError), MonadError TCError m') => m (TypeCheckedSeq inp) -> m' (SomeInstr inp)
- preserving :: TypeCheckInstrNoExcept (TypeCheckedSeq inp) -> ([TypeCheckedOp] -> TypeCheckedInstr) -> (SomeInstr inp -> TypeCheckInstr (SomeInstr inp')) -> TypeCheckInstrNoExcept (TypeCheckedSeq inp')
- preserving' :: TypeCheckInstrNoExcept (TypeCheckedSeq inp) -> ([TypeCheckedOp] -> TypeCheckedInstr) -> (SomeInstr inp -> TypeCheckInstrNoExcept (TypeCheckedSeq inp')) -> TypeCheckInstrNoExcept (TypeCheckedSeq inp')
- guarding :: ExpandedInstr -> TypeCheckInstr a -> (a -> TypeCheckInstrNoExcept (TypeCheckedSeq inp)) -> TypeCheckInstrNoExcept (TypeCheckedSeq inp)
- guarding_ :: ExpandedInstr -> TypeCheckInstr a -> TypeCheckInstrNoExcept (TypeCheckedSeq inp) -> TypeCheckInstrNoExcept (TypeCheckedSeq inp)
- tcEither :: (TCError -> TypeCheckInstrNoExcept a) -> (b -> TypeCheckInstrNoExcept a) -> TypeCheckInstr b -> TypeCheckInstrNoExcept a
- ask' :: MultiReader n r m => m r
- asks' :: forall m r (a :: Type) n. MultiReader n r m => (r -> a) -> m a
- local' :: MultiReader n r m => (r -> r) -> m a -> m a
- tcModeL :: Iso' TypeCheckEnv TypeCheckMode
- data TypeCheckMode
- data SomeParamType = forall t.ParameterScope t => SomeParamType (ParamNotes t)
- mkSomeParamType :: ParameterType -> Either TCError SomeParamType
- data TypeCheckInstrEnv = TypeCheckInstrEnv {}
- tcieErrorPos :: Lens' TypeCheckInstrEnv ErrorSrcPos
- tcieNotInView :: Lens' TypeCheckInstrEnv (Maybe (Dict IsNotInView))
Documentation
type TcInstrHandler = forall inp. SingI inp => ExpandedInstr -> HST inp -> TypeCheckInstrNoExcept (TypeCheckedSeq inp) Source #
type BigMapFinder = Natural -> Maybe SomeVBigMap Source #
data TypeCheckOptions Source #
TypeCheckOptions | |
|
Instances
type TypeCheck = MultiReaderT TCEnvs (Except TCError) Source #
A full type-check monad carrying intermediary context (via TypeCheckEnv
),
general TypeCheckOptions
and throwing TCError
.
type TypeCheckNoExcept = MultiReaderT TCEnvs Identity Source #
A non-throwing alternative for TypeCheck
. Mainly meant to be used for
construction of a partially typed tree (see TypeCheckedSeq
).
type TypeCheckResult = ReaderT TypeCheckOptions (Except TCError) Source #
Monad for performing some typechecking operations with the same options.
Unlike TypeCheck
monad, this does not carry the context of intra-contract
or intra-value typechecking.
runTypeCheck :: TypeCheckMode -> TypeCheck a -> TypeCheckResult a Source #
type TypeCheckInstr = MultiReaderT TCInstrEnvs (Except TCError) Source #
Version of TypeCheck
additionally carrying instruction-specific
TypeCheckInstrEnv
type TypeCheckInstrNoExcept = MultiReaderT TCInstrEnvs Identity Source #
Version of TypeCheckNoExcept
additionally carrying instruction-specific
TypeCheckInstrEnv
runTypeCheckIsolated :: TypeCheck (SomeInstr t) -> TypeCheckResult (SomeInstr t) Source #
Run type checker as if it worked isolated from other world - no access to environment of the current contract is allowed.
Use this function for test purposes only or for some utilities when environment does not matter. In particular, it is assumed that whatever we typecheck does not depend on the parameter type of the contract which is being typechecked (because there is no contract that we are typechecking).
typeCheckingWith :: TypeCheckOptions -> TypeCheckResult a -> Either TCError a Source #
liftNoExcept :: forall m e (a :: Type). MonadMultiReaderT m Identity => m a -> ChangeMultiReaderBase m (Except e) a Source #
throwingTCError :: (MonadMultiReaderT m Identity, m' ~ ChangeMultiReaderBase m (Except TCError), MonadError TCError m') => m (TypeCheckedSeq inp) -> m' (SomeInstr inp) Source #
:: TypeCheckInstrNoExcept (TypeCheckedSeq inp) | Acquiring computation |
-> ([TypeCheckedOp] -> TypeCheckedInstr) | The parent instruction constructor |
-> (SomeInstr inp -> TypeCheckInstr (SomeInstr inp')) | The throwing action |
-> TypeCheckInstrNoExcept (TypeCheckedSeq inp') |
Perform a throwing action on an acquired instruction. Preserve the acquired result by embedding it into a type checking tree with a specified parent instruction.
:: TypeCheckInstrNoExcept (TypeCheckedSeq inp) | Acquiring computation |
-> ([TypeCheckedOp] -> TypeCheckedInstr) | The parent instruction constructor |
-> (SomeInstr inp -> TypeCheckInstrNoExcept (TypeCheckedSeq inp')) | The action |
-> TypeCheckInstrNoExcept (TypeCheckedSeq inp') |
Perform a non-throwing action on an acquired instruction. Preserve the acquired result even if the action does not succeed. Embed the result into a type checking tree with a specified parent instruction.
:: ExpandedInstr | Untyped instruction |
-> TypeCheckInstr a | Acquiring computation |
-> (a -> TypeCheckInstrNoExcept (TypeCheckedSeq inp)) | Follow-up action |
-> TypeCheckInstrNoExcept (TypeCheckedSeq inp) |
Acquire a resource. If successfully, call a follow-up action on it, otherwise embed the error into a type checking tree along with a specified untyped instruction.
guarding_ :: ExpandedInstr -> TypeCheckInstr a -> TypeCheckInstrNoExcept (TypeCheckedSeq inp) -> TypeCheckInstrNoExcept (TypeCheckedSeq inp) Source #
Same as guarding
but doesn't pass an acquired result to a follow-up
action.
:: (TCError -> TypeCheckInstrNoExcept a) | Call this if the action throws |
-> (b -> TypeCheckInstrNoExcept a) | Call this if it doesn't |
-> TypeCheckInstr b | The action to perform |
-> TypeCheckInstrNoExcept a | A non-throwing action |
ask' :: MultiReader n r m => m r Source #
Unconstrained version of ask
. Lifts the appropriate number of times
depending on the type r
.
asks' :: forall m r (a :: Type) n. MultiReader n r m => (r -> a) -> m a Source #
Unconstrained version of asks
. asks' f = fmap f ask'
.
local' :: MultiReader n r m => (r -> r) -> m a -> m a Source #
Unconstrained version of local
. Maps the appropriate number of times
depending on the type r
.
data TypeCheckMode Source #
Typechecking mode that tells the type checker whether it is typechecking contract code in actual contract, lambda, or test.
TypeCheckValue | We're typechecking a value. |
| |
TypeCheckContract SomeParamType | We're typechecking a contract. |
TypeCheckTest | We're typechecking a set of instructions in a "test" environment like a REPL,
where the instruction |
data SomeParamType Source #
forall t.ParameterScope t => SomeParamType (ParamNotes t) |
Instances
Show SomeParamType Source # |
|
Defined in Morley.Michelson.TypeCheck.TypeCheck showsPrec :: Int -> SomeParamType -> ShowS # show :: SomeParamType -> String # showList :: [SomeParamType] -> ShowS # | |
Buildable SomeParamType Source # |
|
Defined in Morley.Michelson.TypeCheck.TypeCheck build :: SomeParamType -> Builder # | |
Eq SomeParamType Source # |
|
Defined in Morley.Michelson.TypeCheck.TypeCheck (==) :: SomeParamType -> SomeParamType -> Bool # (/=) :: SomeParamType -> SomeParamType -> Bool # |
data TypeCheckInstrEnv Source #