packages feed

indigo 0.5.0 → 0.6.0

raw patch · 75 files changed

+5195/−4503 lines, 75 filesdep +data-defaultdep +filepathdep +reqdep −summonernew-uploaderPVP ok

version bump matches the API change (PVP)

Dependencies added: data-default, filepath, req, time, tree-view, universum

Dependencies removed: summoner

API changes (from Hackage documentation)

- Indigo: BigMap :: Map k v -> BigMap k v
- Indigo: EpAddress :: Address -> EpName -> EpAddress
- Indigo: HashUnsafe :: ByteString -> Hash (alg :: HashAlgorithmKind) a
- Indigo: UParamUnsafe :: (MText, ByteString) -> UParam (entries :: [EntrypointKind])
- Indigo: [Deconstructed] :: IndigoState inp (FieldTypes a ++ inp) -> ExprDecomposition inp a
- Indigo: [ExprFields] :: Rec Expr (FieldTypes a) -> ExprDecomposition inp a
- Indigo: [OnStack] :: IndigoState inp (a : inp) -> ObjManipulationRes inp a
- Indigo: [StillObject] :: ObjectExpr a -> ObjManipulationRes inp a
- Indigo: [epaType] :: DEntrypointArg -> Type
- Indigo: [sopSetField] :: StoreFieldOps store (fname :: Symbol) ftype -> forall (s :: [Type]). () => Label fname -> (ftype : (store : s)) :-> (store : s)
- Indigo: [unBigMap] :: BigMap k v -> Map k v
- Indigo: arg :: forall (name :: Symbol) a. Name name -> (name :! a) -> a
- Indigo: argDef :: forall (name :: Symbol) a. Name name -> a -> (name :? a) -> a
- Indigo: argF :: forall (name :: Symbol) f a. Name name -> NamedF f a name -> f a
- Indigo: binaryOp :: KnownValue res => Expr n -> Expr m -> ((n : (m : inp)) :-> (res : inp)) -> IndigoState inp (res : inp)
- Indigo: binaryOpFlat :: Expr n -> Expr m -> ((n : (m : inp)) :-> inp) -> IndigoState inp inp
- Indigo: buildLorentzDoc :: forall (inp :: [Type]) (out :: [Type]). (inp :-> out) -> ContractDoc
- Indigo: buildLorentzDocWithGitRev :: forall (inp :: [Type]) (out :: [Type]). DGitRevision -> (inp :-> out) -> ContractDoc
- Indigo: cCodeL :: Lens (Contract cp1 st1) (Contract cp2 st2) (ContractCode cp1 st1) (ContractCode cp2 st2)
- Indigo: cCompilationOptionsL :: Lens' (Contract cp st) CompilationOptions
- Indigo: cDisableInitialCastL :: Lens' (Contract cp st) Bool
- Indigo: callingDefTAddress :: NiceParameterFull cp => TAddress cp -> ContractRef (GetDefaultEntrypointArg cp)
- Indigo: callingTAddress :: forall cp (mname :: Maybe Symbol). NiceParameterFull cp => TAddress cp -> EntrypointRef mname -> ContractRef (GetEntrypointArgCustom cp mname)
- Indigo: class (EDivOp ToT n ToT m, NiceComparable n, NiceComparable m, ToT EDivOpResHs n m ~ EDivOpRes ToT n ToT m, ToT EModOpResHs n m ~ EModOpRes ToT n ToT m) => EDivOpHs n m where {
- Indigo: compileExpr :: forall a inp. Expr a -> IndigoState inp (a : inp)
- Indigo: concreteTypeDocHaskellRepUnsafe :: (Typeable a, GenericIsoValue a, GTypeHasDoc (Rep a)) => TypeDocHaskellRep b
- Indigo: concreteTypeDocMichelsonRepUnsafe :: forall k a (b :: k). (Typeable a, SingI (ToT a)) => TypeDocMichelsonRep b
- Indigo: constructDEpArg :: (TypeHasDoc arg, HasAnnotation arg, KnownValue arg) => DEntrypointArg
- Indigo: customErrorDocHaskellRepGeneral :: forall (tag :: Symbol). (SingI (ToT (ErrorArg tag)), IsError (CustomError tag), TypeHasDoc (ErrorArg tag), CustomErrorHasDoc tag) => Text -> Proxy tag -> Markdown
- Indigo: data Address
- Indigo: data ExprDecomposition inp a
- Indigo: data KeyHash
- Indigo: data ObjManipulationRes inp a
- Indigo: data View a r
- Indigo: decomposeExpr :: ComplexObjectC a => DecomposedObjects -> Expr a -> ExprDecomposition inp a
- Indigo: deepDecomposeCompose :: forall a inp. IsObject a => SIS' (a : inp) (Object a)
- Indigo: errorDoc :: QuasiQuoter
- Indigo: gcdInt' :: Int -> Int -> Int
- Indigo: gcdWord' :: Word -> Word -> Word
- Indigo: iWithVarAnnotations :: forall (inp :: [Type]) (out :: [Type]). HasCallStack => [Text] -> (inp :-> out) -> inp :-> out
- Indigo: lSignEd22519 :: BytesLike a => SecretKey -> a -> TSignature a
- Indigo: namedToExpr :: NamedFieldObj x name -> Expr (GetFieldType x name)
- Indigo: newtype BigMap k v
- Indigo: niceConstantEvi :: NiceConstant a :- ConstantScope (ToT a)
- Indigo: nicePackedValueEvi :: NicePackedValue a :- PackedValScope (ToT a)
- Indigo: niceParameterEvi :: NiceParameter a :- ParameterScope (ToT a)
- Indigo: nicePrintedValueEvi :: NicePrintedValue a :- PrintedValScope (ToT a)
- Indigo: niceStorageEvi :: NiceStorage a :- StorageScope (ToT a)
- Indigo: niceUnpackedValueEvi :: NiceUnpackedValue a :- UnpackedValScope (ToT a)
- Indigo: nullaryOp :: KnownValue res => (inp :-> (res : inp)) -> IndigoState inp (res : inp)
- Indigo: nullaryOpFlat :: (inp :-> inp) -> IndigoState inp inp
- Indigo: rdrop :: Sing n -> Rec any s -> Rec any (Drop n s)
- Indigo: renderLorentzDoc :: forall (inp :: [Type]) (out :: [Type]). (inp :-> out) -> LText
- Indigo: renderLorentzDocWithGitRev :: forall (inp :: [Type]) (out :: [Type]). DGitRevision -> (inp :-> out) -> LText
- Indigo: rtake :: Sing n -> Rec any s -> Rec any (Take n s)
- Indigo: runObjectManipulation :: DecomposedObjects -> ObjectManipulation x -> ObjManipulationRes inp x
- Indigo: ternaryOp :: KnownValue res => Expr n -> Expr m -> Expr l -> ((n : (m : (l : inp))) :-> (res : inp)) -> IndigoState inp (res : inp)
- Indigo: ternaryOpFlat :: Expr n -> Expr m -> Expr l -> ((n : (m : (l : inp))) :-> inp) -> IndigoState inp inp
- Indigo: type ContractCode cp st = '[(cp, st)] :-> ContractOut st
- Indigo: type NicePrintedValue a = (KnownValue a, ProperPrintedValBetterErrors ToT a)
- Indigo: type RequireNoArgError (tag :: Symbol) (msg :: ErrorMessage) = (TypeErrorUnless ErrorArg tag == () msg, msg ~ 'Text "Expected no-arg error, but given error requires argument of type " :<>: 'ShowType ErrorArg tag)
- Indigo: type Unwrappable s = GUnwrappable Rep s;
- Indigo: type WellTypedIsoValue a = (WellTyped ToT a, IsoValue a)
- Indigo: unaryOp :: KnownValue res => Expr n -> ((n : inp) :-> (res : inp)) -> IndigoState inp (res : inp)
- Indigo: unaryOpFlat :: Expr n -> ((n : inp) :-> inp) -> IndigoState inp inp
- Indigo: unwrapUnsafe_ :: forall dt (name :: Symbol) (st :: [Type]). InstrUnwrapC dt name => Label name -> (dt : st) :-> (CtorOnlyField name dt : st)
- Indigo: varActionGet :: forall a stk. KnownValue a => RefId -> StackVars stk -> stk :-> (a : stk)
- Indigo: varActionOperation :: HasSideEffects => StackVars stk -> (Operation : stk) :-> stk
- Indigo: varActionSet :: forall a stk. KnownValue a => RefId -> StackVars stk -> (a : stk) :-> stk
- Indigo: varActionUpdate :: forall a b stk. (KnownValue a, KnownValue b) => RefId -> StackVars stk -> ('[b, a] :-> '[a]) -> (b : stk) :-> stk
- Indigo.Backend.Case: instance (name GHC.Types.~ GHC.TypeLits.AppendSymbol "c" ctor, Lorentz.Constraints.Scopes.KnownValue x) => Lorentz.ADT.CaseArrow name (Indigo.Backend.Case.IndigoClause x ret) (Indigo.Backend.Case.IndigoCaseClauseL ret ('Michelson.Typed.Haskell.Instr.Sum.CaseClauseParam ctor ('Michelson.Typed.Haskell.Instr.Sum.OneField x)))
- Indigo.Backend.Prelude: gcdInt' :: Int -> Int -> Int
- Indigo.Backend.Prelude: gcdWord' :: Word -> Word -> Word
- Indigo.Compilation.Sequential: instance GHC.Base.Monoid Indigo.Compilation.Sequential.SequentialHooks
- Indigo.Compilation.Sequential: instance GHC.Base.Semigroup Indigo.Compilation.Sequential.SequentialHooks
- Indigo.Frontend.Statement: [CalledFrom] :: CallStack -> freer a -> StatementF freer a
- Indigo.Frontend.Statement: [Case] :: CaseCommonF (IndigoMCaseClauseL freer) dt ret clauses => Expr dt -> clauses -> StatementF freer (RetVars ret)
- Indigo.Frontend.Statement: [ContractCalling] :: (HasEntrypointArg cp epRef epArg, ToTAddress cp addr, ToT addr ~ ToT Address, KnownValue epArg) => Proxy cp -> epRef -> Expr addr -> StatementF freer (Var (Maybe (ContractRef epArg)))
- Indigo.Frontend.Statement: [ContractGeneral] :: freer () -> StatementF freer ()
- Indigo.Frontend.Statement: [ContractName] :: Text -> freer () -> StatementF freer ()
- Indigo.Frontend.Statement: [CreateContract] :: (IsObject st, NiceStorage st, NiceParameterFull param, HasSideEffects) => Contract param st -> Expr (Maybe KeyHash) -> Expr Mutez -> Expr st -> StatementF freer (Var Address)
- Indigo.Frontend.Statement: [DocGroup] :: DocItem di => (SubDoc -> di) -> freer () -> StatementF freer ()
- Indigo.Frontend.Statement: [EffLambda] :: (ExecuteLambdaEff1C st arg res, CreateLambda1CGeneric '[st, Ops] arg res, Typeable res) => Proxy st -> LambdaKind st arg res '[st, Ops]
- Indigo.Frontend.Statement: [EntryCaseSimple] :: (CaseCommonF (IndigoMCaseClauseL freer) cp ret clauses, DocumentEntrypoints PlainEntrypointsKind cp, NiceParameterFull cp, RequireFlatParamEps cp) => Expr cp -> clauses -> StatementF freer (RetVars ret)
- Indigo.Frontend.Statement: [EntryCase] :: (CaseCommonF (IndigoMCaseClauseL freer) dt ret clauses, DocumentEntrypoints entrypointKind dt) => Proxy entrypointKind -> Expr dt -> clauses -> StatementF freer (RetVars ret)
- Indigo.Frontend.Statement: [FailOver] :: ReturnableValue ret => Proxy ret -> (forall inp. Expr a -> SomeIndigoState inp) -> Expr a -> StatementF freer (RetVars ret)
- Indigo.Frontend.Statement: [Fail] :: ReturnableValue ret => Proxy ret -> (forall inp. SomeIndigoState inp) -> StatementF freer (RetVars ret)
- Indigo.Frontend.Statement: [FinalizeParamCallingDoc] :: (NiceParameterFull cp, RequireSumType cp, HasCallStack) => (Var cp -> freer ()) -> Expr cp -> StatementF freer ()
- Indigo.Frontend.Statement: [ForEach] :: (IterOpHs a, KnownValue (IterOpElHs a)) => Expr a -> (Var (IterOpElHs a) -> freer ()) -> StatementF freer ()
- Indigo.Frontend.Statement: [IfCons] :: (IfConstraint a b, KnownValue x) => Expr (List x) -> (Var x -> Var (List x) -> freer a) -> freer b -> StatementF freer (RetVars a)
- Indigo.Frontend.Statement: [IfRight] :: (IfConstraint a b, KnownValue x, KnownValue y) => Expr (Either y x) -> (Var x -> freer a) -> (Var y -> freer b) -> StatementF freer (RetVars a)
- Indigo.Frontend.Statement: [IfSome] :: (IfConstraint a b, KnownValue x) => Expr (Maybe x) -> (Var x -> freer a) -> freer b -> StatementF freer (RetVars a)
- Indigo.Frontend.Statement: [If] :: IfConstraint a b => Expr Bool -> freer a -> freer b -> StatementF freer (RetVars a)
- Indigo.Frontend.Statement: [LambdaCall1] :: LambdaKind st arg res extra -> String -> (Var arg -> freer res) -> Expr arg -> StatementF freer (RetVars res)
- Indigo.Frontend.Statement: [LiftIndigoState] :: (forall inp. SomeIndigoState inp) -> StatementF freer ()
- Indigo.Frontend.Statement: [NewVar] :: KnownValue x => Expr x -> StatementF freer (Var x)
- Indigo.Frontend.Statement: [OneFieldIndigoMCaseClauseL] :: (name ~ AppendSymbol "c" ctor, KnownValue x, ScopeCodeGen retBr, ret ~ RetExprs retBr, RetOutStack ret ~ RetOutStack retBr) => Label name -> (Var x -> freer retBr) -> IndigoMCaseClauseL freer ret ('CaseClauseParam ctor ('OneField x))
- Indigo.Frontend.Statement: [PureLambda] :: (ExecuteLambdaPure1C arg res, CreateLambda1CGeneric '[] arg res, Typeable res) => LambdaKind st arg res '[]
- Indigo.Frontend.Statement: [Scope] :: ScopeCodeGen a => freer a -> StatementF freer (RetVars a)
- Indigo.Frontend.Statement: [SelfCalling] :: (NiceParameterFull p, KnownValue (GetEntrypointArgCustom p mname)) => Proxy p -> EntrypointRef mname -> StatementF freer (Var (ContractRef (GetEntrypointArgCustom p mname)))
- Indigo.Frontend.Statement: [SetDelegate] :: HasSideEffects => Expr (Maybe KeyHash) -> StatementF freer ()
- Indigo.Frontend.Statement: [SetField] :: (IsObject dt, IsObject ftype, HasField dt fname ftype) => Var dt -> Label fname -> Expr ftype -> StatementF cont ()
- Indigo.Frontend.Statement: [SetVar] :: KnownValue x => Var x -> Expr x -> StatementF freer ()
- Indigo.Frontend.Statement: [StorageLambda] :: (ExecuteLambda1C st arg res, CreateLambda1CGeneric '[st] arg res, Typeable res) => Proxy st -> LambdaKind st arg res '[st]
- Indigo.Frontend.Statement: [TransferTokens] :: (NiceParameter p, HasSideEffects) => Expr p -> Expr Mutez -> Expr (ContractRef p) -> StatementF freer ()
- Indigo.Frontend.Statement: [VarModification] :: (IsObject x, KnownValue y) => ([y, x] :-> '[x]) -> Var x -> Expr y -> StatementF freer ()
- Indigo.Frontend.Statement: [WhileLeft] :: (KnownValue x, KnownValue y) => Expr (Either y x) -> (Var y -> freer ()) -> StatementF freer (Var x)
- Indigo.Frontend.Statement: [While] :: Expr Bool -> freer () -> StatementF freer ()
- Indigo.Frontend.Statement: data IndigoMCaseClauseL freer ret (param :: CaseClauseParam)
- Indigo.Frontend.Statement: data LambdaKind st arg res extra
- Indigo.Frontend.Statement: data StatementF (freer :: Type -> Type) a
- Indigo.Frontend.Statement: type IfConstraint a b = (ScopeCodeGen a, ScopeCodeGen b, CompareBranchesResults (RetExprs a) (RetExprs b), RetVars a ~ RetVars b, RetOutStack a ~ RetOutStack b)
- Indigo.Frontend.Statement: withLambdaKind :: LambdaKind st arg res extra -> ((ScopeCodeGen res, KnownValue arg, Typeable res, CreateLambda1CGeneric extra arg res) => r) -> r
- Indigo.Internal.Expr.Compilation: [OnStack] :: IndigoState inp (a : inp) -> ObjManipulationRes inp a
- Indigo.Internal.Expr.Compilation: [StillObject] :: ObjectExpr a -> ObjManipulationRes inp a
- Indigo.Internal.Expr.Compilation: binaryOp :: KnownValue res => Expr n -> Expr m -> ((n : (m : inp)) :-> (res : inp)) -> IndigoState inp (res : inp)
- Indigo.Internal.Expr.Compilation: binaryOpFlat :: Expr n -> Expr m -> ((n : (m : inp)) :-> inp) -> IndigoState inp inp
- Indigo.Internal.Expr.Compilation: compileExpr :: forall a inp. Expr a -> IndigoState inp (a : inp)
- Indigo.Internal.Expr.Compilation: data ObjManipulationRes inp a
- Indigo.Internal.Expr.Compilation: namedToExpr :: NamedFieldObj x name -> Expr (GetFieldType x name)
- Indigo.Internal.Expr.Compilation: nullaryOp :: KnownValue res => (inp :-> (res : inp)) -> IndigoState inp (res : inp)
- Indigo.Internal.Expr.Compilation: nullaryOpFlat :: (inp :-> inp) -> IndigoState inp inp
- Indigo.Internal.Expr.Compilation: runObjectManipulation :: DecomposedObjects -> ObjectManipulation x -> ObjManipulationRes inp x
- Indigo.Internal.Expr.Compilation: ternaryOp :: KnownValue res => Expr n -> Expr m -> Expr l -> ((n : (m : (l : inp))) :-> (res : inp)) -> IndigoState inp (res : inp)
- Indigo.Internal.Expr.Compilation: ternaryOpFlat :: Expr n -> Expr m -> Expr l -> ((n : (m : (l : inp))) :-> inp) -> IndigoState inp inp
- Indigo.Internal.Expr.Compilation: unaryOp :: KnownValue res => Expr n -> ((n : inp) :-> (res : inp)) -> IndigoState inp (res : inp)
- Indigo.Internal.Expr.Compilation: unaryOpFlat :: Expr n -> ((n : inp) :-> inp) -> IndigoState inp inp
- Indigo.Internal.Expr.Decompose: [Deconstructed] :: IndigoState inp (FieldTypes a ++ inp) -> ExprDecomposition inp a
- Indigo.Internal.Expr.Decompose: [ExprFields] :: Rec Expr (FieldTypes a) -> ExprDecomposition inp a
- Indigo.Internal.Expr.Decompose: class IsObject' (TypeDecision a) a => IsObject a
- Indigo.Internal.Expr.Decompose: data ExprDecomposition inp a
- Indigo.Internal.Expr.Decompose: decomposeExpr :: ComplexObjectC a => DecomposedObjects -> Expr a -> ExprDecomposition inp a
- Indigo.Internal.Expr.Decompose: deepDecomposeCompose :: forall a inp. IsObject a => SIS' (a : inp) (Object a)
- Indigo.Internal.Expr.Symbolic: (!!) :: (HasField dt name ftype, exDt :~> dt, exFld :~> ftype) => exDt -> (Label name, exFld) -> Expr dt
- Indigo.Internal.Expr.Symbolic: (!:) :: IsUpdExpr exKey exVal exMap map => exMap -> (exKey, exVal) -> Expr map
- Indigo.Internal.Expr.Symbolic: (!@) :: (StoreHasSubmap store name key value, exKey :~> key, exVal :~> Maybe value, exStore :~> store) => exStore -> (Label name, exKey, exVal) -> Expr store
- Indigo.Internal.Expr.Symbolic: (!~) :: (ex :~> t, KnownValue (name :! t)) => ex -> Label name -> Expr (name :! t)
- Indigo.Internal.Expr.Symbolic: (#!) :: (HasField dt name ftype, exDt :~> dt) => exDt -> Label name -> Expr ftype
- Indigo.Internal.Expr.Symbolic: (#:) :: IsGetExpr exKey exMap map => exMap -> exKey -> Expr (Maybe (GetOpValHs map))
- Indigo.Internal.Expr.Symbolic: (#@) :: (StoreHasSubmap store name key value, KnownValue value, exKey :~> key, exStore :~> store) => exStore -> (Label name, exKey) -> Expr (Maybe value)
- Indigo.Internal.Expr.Symbolic: (#~) :: (ex :~> (name :! t), KnownValue t) => ex -> Label name -> Expr t
- Indigo.Internal.Expr.Symbolic: (%) :: IsModExpr exN exM n m => exN -> exM -> Expr (EModOpResHs n m)
- Indigo.Internal.Expr.Symbolic: (&&) :: IsArithExpr exN exM And n m => exN -> exM -> Expr (ArithResHs And n m)
- Indigo.Internal.Expr.Symbolic: (*) :: IsArithExpr exN exM Mul n m => exN -> exM -> Expr (ArithResHs Mul n m)
- Indigo.Internal.Expr.Symbolic: (+) :: IsArithExpr exN exM Add n m => exN -> exM -> Expr (ArithResHs Add n m)
- Indigo.Internal.Expr.Symbolic: (++@) :: (StoreHasSubmap store name key value, IsError err, Buildable err, exKey :~> key, exVal :~> value, exStore :~> store) => exStore -> (Label name, err, exKey, exVal) -> Expr store
- Indigo.Internal.Expr.Symbolic: (+:) :: (ExprInsertable c exParam, exStructure :~> c) => exStructure -> exParam -> Expr c
- Indigo.Internal.Expr.Symbolic: (+@) :: (StoreHasSubmap store name key value, exKey :~> key, exVal :~> value, exStore :~> store) => exStore -> (Label name, exKey, exVal) -> Expr store
- Indigo.Internal.Expr.Symbolic: (-) :: IsArithExpr exN exM Sub n m => exN -> exM -> Expr (ArithResHs Sub n m)
- Indigo.Internal.Expr.Symbolic: (-:) :: (ExprRemovable c, exStruct :~> c, exKey :~> UpdOpKeyHs c) => exStruct -> exKey -> Expr c
- Indigo.Internal.Expr.Symbolic: (-@) :: (StoreHasSubmap store name key value, KnownValue value, exKey :~> key, exStore :~> store) => exStore -> (Label name, exKey) -> Expr store
- Indigo.Internal.Expr.Symbolic: (.:) :: (ex1 :~> a, ex2 :~> List a) => ex1 -> ex2 -> Expr (List a)
- Indigo.Internal.Expr.Symbolic: (/) :: IsDivExpr exN exM n m => exN -> exM -> Expr (EDivOpResHs n m)
- Indigo.Internal.Expr.Symbolic: (/=) :: (NiceComparable n, c :~> n, c1 :~> n) => c -> c1 -> Expr Bool
- Indigo.Internal.Expr.Symbolic: (<) :: (NiceComparable n, c :~> n, c1 :~> n) => c -> c1 -> Expr Bool
- Indigo.Internal.Expr.Symbolic: (<<<) :: IsArithExpr exN exM Lsl n m => exN -> exM -> Expr (ArithResHs Lsl n m)
- Indigo.Internal.Expr.Symbolic: (<=) :: (NiceComparable n, c :~> n, c1 :~> n) => c -> c1 -> Expr Bool
- Indigo.Internal.Expr.Symbolic: (<>) :: IsConcatExpr exN1 exN2 n => exN1 -> exN2 -> Expr n
- Indigo.Internal.Expr.Symbolic: (==) :: (NiceComparable n, c :~> n, c1 :~> n) => c -> c1 -> Expr Bool
- Indigo.Internal.Expr.Symbolic: (>) :: (NiceComparable n, c :~> n, c1 :~> n) => c -> c1 -> Expr Bool
- Indigo.Internal.Expr.Symbolic: (>=) :: (NiceComparable n, c :~> n, c1 :~> n) => c -> c1 -> Expr Bool
- Indigo.Internal.Expr.Symbolic: (>>>) :: IsArithExpr exN exM Lsr n m => exN -> exM -> Expr (ArithResHs Lsr n m)
- Indigo.Internal.Expr.Symbolic: (?:) :: IsMemExpr exKey exN n => exN -> exKey -> Expr Bool
- Indigo.Internal.Expr.Symbolic: (?@) :: (StoreHasSubmap store name key value, KnownValue value, exKey :~> key, exStore :~> store) => exStore -> (Label name, exKey) -> Expr Bool
- Indigo.Internal.Expr.Symbolic: (^) :: IsArithExpr exN exM Xor n m => exN -> exM -> Expr (ArithResHs Xor n m)
- Indigo.Internal.Expr.Symbolic: (||) :: IsArithExpr exN exM Or n m => exN -> exM -> Expr (ArithResHs Or n m)
- Indigo.Internal.Expr.Symbolic: abs :: IsUnaryArithExpr exN Abs n => exN -> Expr (UnaryArithResHs Abs n)
- Indigo.Internal.Expr.Symbolic: add :: IsArithExpr exN exM Add n m => exN -> exM -> Expr (ArithResHs Add n m)
- Indigo.Internal.Expr.Symbolic: amount :: Expr Mutez
- Indigo.Internal.Expr.Symbolic: and :: IsArithExpr exN exM And n m => exN -> exM -> Expr (ArithResHs And n m)
- Indigo.Internal.Expr.Symbolic: balance :: Expr Mutez
- Indigo.Internal.Expr.Symbolic: blake2b :: (hashExpr :~> bs, BytesLike bs) => hashExpr -> Expr (Hash Blake2b bs)
- Indigo.Internal.Expr.Symbolic: car :: (op :~> (n, m), KnownValue n) => op -> Expr n
- Indigo.Internal.Expr.Symbolic: cast :: ex :~> a => ex -> Expr a
- Indigo.Internal.Expr.Symbolic: cdr :: (op :~> (n, m), KnownValue m) => op -> Expr m
- Indigo.Internal.Expr.Symbolic: chainId :: Expr ChainId
- Indigo.Internal.Expr.Symbolic: checkSignature :: (pkExpr :~> PublicKey, sigExpr :~> TSignature bs, hashExpr :~> bs, BytesLike bs) => pkExpr -> sigExpr -> hashExpr -> Expr Bool
- Indigo.Internal.Expr.Symbolic: coerce :: forall b a ex. (Castable_ a b, KnownValue b, ex :~> a) => ex -> Expr b
- Indigo.Internal.Expr.Symbolic: concat :: IsConcatExpr exN1 exN2 n => exN1 -> exN2 -> Expr n
- Indigo.Internal.Expr.Symbolic: concatAll :: IsConcatListExpr exN n => exN -> Expr n
- Indigo.Internal.Expr.Symbolic: cons :: (ex1 :~> a, ex2 :~> List a) => ex1 -> ex2 -> Expr (List a)
- Indigo.Internal.Expr.Symbolic: constExpr :: forall a. NiceConstant a => a -> Expr a
- Indigo.Internal.Expr.Symbolic: construct :: (InstrConstructC dt, KnownValue dt, RMap (ConstructorFieldTypes dt), RecordToList (ConstructorFieldTypes dt), fields ~ Rec Expr (ConstructorFieldTypes dt), RecFromTuple fields) => IsoRecTuple fields -> Expr dt
- Indigo.Internal.Expr.Symbolic: constructRec :: (InstrConstructC dt, RMap (ConstructorFieldTypes dt), RecordToList (ConstructorFieldTypes dt), KnownValue dt) => Rec Expr (ConstructorFieldTypes dt) -> Expr dt
- Indigo.Internal.Expr.Symbolic: contract :: (NiceParameterFull p, NoExplicitDefaultEntrypoint p, ToTAddress p addr, ToT addr ~ ToT Address, exAddr :~> addr) => exAddr -> Expr (Maybe (ContractRef p))
- Indigo.Internal.Expr.Symbolic: contractAddress :: exc :~> ContractRef p => exc -> Expr Address
- Indigo.Internal.Expr.Symbolic: contractCallingString :: (NiceParameter arg, exAddr :~> Address) => MText -> exAddr -> Expr (Maybe (ContractRef arg))
- Indigo.Internal.Expr.Symbolic: contractCallingUnsafe :: (NiceParameter arg, exAddr :~> Address) => EpName -> exAddr -> Expr (Maybe (ContractRef arg))
- Indigo.Internal.Expr.Symbolic: convertEpAddressToContract :: (NiceParameter p, epExpr :~> EpAddress) => epExpr -> Expr (Maybe (ContractRef p))
- Indigo.Internal.Expr.Symbolic: div :: IsDivExpr exN exM n m => exN -> exM -> Expr (EDivOpResHs n m)
- Indigo.Internal.Expr.Symbolic: empty :: (ExprMagma c, NiceComparable (UpdOpKeyHs c), KnownValue c) => Expr c
- Indigo.Internal.Expr.Symbolic: emptyBigMap :: (KnownValue value, NiceComparable key, KnownValue (BigMap key value)) => Expr (BigMap key value)
- Indigo.Internal.Expr.Symbolic: emptyMap :: (KnownValue value, NiceComparable key, KnownValue (Map key value)) => Expr (Map key value)
- Indigo.Internal.Expr.Symbolic: emptySet :: (NiceComparable key, KnownValue (Set key)) => Expr (Set key)
- Indigo.Internal.Expr.Symbolic: eq :: (NiceComparable n, c :~> n, c1 :~> n) => c -> c1 -> Expr Bool
- Indigo.Internal.Expr.Symbolic: forcedCoerce :: forall b a ex. (MichelsonCoercible a b, KnownValue b, ex :~> a) => ex -> Expr b
- Indigo.Internal.Expr.Symbolic: fst :: (op :~> (n, m), KnownValue n) => op -> Expr n
- Indigo.Internal.Expr.Symbolic: ge :: (NiceComparable n, c :~> n, c1 :~> n) => c -> c1 -> Expr Bool
- Indigo.Internal.Expr.Symbolic: get :: IsGetExpr exKey exMap map => exKey -> exMap -> Expr (Maybe (GetOpValHs map))
- Indigo.Internal.Expr.Symbolic: gt :: (NiceComparable n, c :~> n, c1 :~> n) => c -> c1 -> Expr Bool
- Indigo.Internal.Expr.Symbolic: hashKey :: keyExpr :~> PublicKey => keyExpr -> Expr KeyHash
- Indigo.Internal.Expr.Symbolic: implicitAccount :: exkh :~> KeyHash => exkh -> Expr (ContractRef ())
- Indigo.Internal.Expr.Symbolic: infix 4 >=
- Indigo.Internal.Expr.Symbolic: infixl 6 -
- Indigo.Internal.Expr.Symbolic: infixl 7 %
- Indigo.Internal.Expr.Symbolic: infixl 8 #~
- Indigo.Internal.Expr.Symbolic: infixr 2 ^
- Indigo.Internal.Expr.Symbolic: infixr 3 &&
- Indigo.Internal.Expr.Symbolic: infixr 5 .:
- Indigo.Internal.Expr.Symbolic: infixr 6 <>
- Indigo.Internal.Expr.Symbolic: infixr 8 ++@
- Indigo.Internal.Expr.Symbolic: insert :: (ExprInsertable c insParam, ex :~> c) => insParam -> ex -> Expr c
- Indigo.Internal.Expr.Symbolic: instance (Lorentz.Constraints.Scopes.NiceComparable a, exKey Indigo.Internal.Expr.Types.:~> a) => Indigo.Internal.Expr.Symbolic.ExprInsertable (Data.Set.Internal.Set a) exKey
- Indigo.Internal.Expr.Symbolic: instance (Lorentz.Constraints.Scopes.NiceComparable k, Lorentz.Constraints.Scopes.KnownValue v) => Indigo.Internal.Expr.Symbolic.ExprRemovable (Data.Map.Internal.Map k v)
- Indigo.Internal.Expr.Symbolic: instance (Lorentz.Constraints.Scopes.NiceComparable k, Lorentz.Constraints.Scopes.KnownValue v) => Indigo.Internal.Expr.Symbolic.ExprRemovable (Michelson.Typed.Haskell.Value.BigMap k v)
- Indigo.Internal.Expr.Symbolic: instance (Lorentz.Constraints.Scopes.NiceComparable k, exKey Indigo.Internal.Expr.Types.:~> k, exValue Indigo.Internal.Expr.Types.:~> v) => Indigo.Internal.Expr.Symbolic.ExprInsertable (Data.Map.Internal.Map k v) (exKey, exValue)
- Indigo.Internal.Expr.Symbolic: instance (Lorentz.Constraints.Scopes.NiceComparable k, exKey Indigo.Internal.Expr.Types.:~> k, exValue Indigo.Internal.Expr.Types.:~> v) => Indigo.Internal.Expr.Symbolic.ExprInsertable (Michelson.Typed.Haskell.Value.BigMap k v) (exKey, exValue)
- Indigo.Internal.Expr.Symbolic: instance Indigo.Internal.Expr.Symbolic.ExprMagma (Data.Set.Internal.Set k)
- Indigo.Internal.Expr.Symbolic: instance Lorentz.Constraints.Scopes.KnownValue v => Indigo.Internal.Expr.Symbolic.ExprMagma (Data.Map.Internal.Map k v)
- Indigo.Internal.Expr.Symbolic: instance Lorentz.Constraints.Scopes.KnownValue v => Indigo.Internal.Expr.Symbolic.ExprMagma (Michelson.Typed.Haskell.Value.BigMap k v)
- Indigo.Internal.Expr.Symbolic: instance Lorentz.Constraints.Scopes.NiceComparable a => Indigo.Internal.Expr.Symbolic.ExprRemovable (Data.Set.Internal.Set a)
- Indigo.Internal.Expr.Symbolic: isNat :: ex :~> Integer => ex -> Expr (Maybe Natural)
- Indigo.Internal.Expr.Symbolic: le :: (NiceComparable n, c :~> n, c1 :~> n) => c -> c1 -> Expr Bool
- Indigo.Internal.Expr.Symbolic: left :: (ex :~> y, KnownValue x, KnownValue (Either y x)) => ex -> Expr (Either y x)
- Indigo.Internal.Expr.Symbolic: lsl :: IsArithExpr exN exM Lsl n m => exN -> exM -> Expr (ArithResHs Lsl n m)
- Indigo.Internal.Expr.Symbolic: lsr :: IsArithExpr exN exM Lsr n m => exN -> exM -> Expr (ArithResHs Lsr n m)
- Indigo.Internal.Expr.Symbolic: lt :: (NiceComparable n, c :~> n, c1 :~> n) => c -> c1 -> Expr Bool
- Indigo.Internal.Expr.Symbolic: makeView :: (KnownValue (View a r), exa :~> a, exCRef :~> ContractRef r) => exa -> exCRef -> Expr (View a r)
- Indigo.Internal.Expr.Symbolic: makeVoid :: (KnownValue (Void_ a b), exa :~> a, exCRef :~> Lambda b b) => exa -> exCRef -> Expr (Void_ a b)
- Indigo.Internal.Expr.Symbolic: mem :: IsMemExpr exKey exN n => exKey -> exN -> Expr Bool
- Indigo.Internal.Expr.Symbolic: mod :: IsModExpr exN exM n m => exN -> exM -> Expr (EModOpResHs n m)
- Indigo.Internal.Expr.Symbolic: mul :: IsArithExpr exN exM Mul n m => exN -> exM -> Expr (ArithResHs Mul n m)
- Indigo.Internal.Expr.Symbolic: name :: (ex :~> t, KnownValue (name :! t)) => Label name -> ex -> Expr (name :! t)
- Indigo.Internal.Expr.Symbolic: neg :: IsUnaryArithExpr exN Neg n => exN -> Expr (UnaryArithResHs Neg n)
- Indigo.Internal.Expr.Symbolic: neq :: (NiceComparable n, c :~> n, c1 :~> n) => c -> c1 -> Expr Bool
- Indigo.Internal.Expr.Symbolic: nil :: KnownValue a => Expr (List a)
- Indigo.Internal.Expr.Symbolic: nonZero :: (ex :~> n, NonZero n, KnownValue (Maybe n)) => ex -> Expr (Maybe n)
- Indigo.Internal.Expr.Symbolic: none :: KnownValue t => Expr (Maybe t)
- Indigo.Internal.Expr.Symbolic: not :: IsUnaryArithExpr exN Not n => exN -> Expr (UnaryArithResHs Not n)
- Indigo.Internal.Expr.Symbolic: now :: Expr Timestamp
- Indigo.Internal.Expr.Symbolic: or :: IsArithExpr exN exM Or n m => exN -> exM -> Expr (ArithResHs Or n m)
- Indigo.Internal.Expr.Symbolic: pack :: (ex :~> a, NicePackedValue a) => ex -> Expr (Packed a)
- Indigo.Internal.Expr.Symbolic: packRaw :: (ex :~> a, NicePackedValue a) => ex -> Expr ByteString
- Indigo.Internal.Expr.Symbolic: pair :: (ex1 :~> n, ex2 :~> m, KnownValue (n, m)) => ex1 -> ex2 -> Expr (n, m)
- Indigo.Internal.Expr.Symbolic: remove :: (ExprRemovable c, exStruct :~> c, exKey :~> UpdOpKeyHs c) => exKey -> exStruct -> Expr c
- Indigo.Internal.Expr.Symbolic: right :: (ex :~> x, KnownValue y, KnownValue (Either y x)) => ex -> Expr (Either y x)
- Indigo.Internal.Expr.Symbolic: runFutureContract :: (NiceParameter p, conExpr :~> FutureContract p) => conExpr -> Expr (Maybe (ContractRef p))
- Indigo.Internal.Expr.Symbolic: self :: (NiceParameterFull p, NoExplicitDefaultEntrypoint p) => Expr (ContractRef p)
- Indigo.Internal.Expr.Symbolic: sender :: Expr Address
- Indigo.Internal.Expr.Symbolic: sha256 :: (hashExpr :~> bs, BytesLike bs) => hashExpr -> Expr (Hash Sha256 bs)
- Indigo.Internal.Expr.Symbolic: sha512 :: (hashExpr :~> bs, BytesLike bs) => hashExpr -> Expr (Hash Sha512 bs)
- Indigo.Internal.Expr.Symbolic: size :: IsSizeExpr exN n => exN -> Expr Natural
- Indigo.Internal.Expr.Symbolic: slice :: (an :~> Natural, bn :~> Natural, IsSliceExpr ex c) => (an, bn) -> ex -> Expr (Maybe c)
- Indigo.Internal.Expr.Symbolic: snd :: (op :~> (n, m), KnownValue m) => op -> Expr m
- Indigo.Internal.Expr.Symbolic: some :: (ex :~> t, KnownValue (Maybe t)) => ex -> Expr (Maybe t)
- Indigo.Internal.Expr.Symbolic: stDelete :: (StoreHasSubmap store name key value, KnownValue value, exKey :~> key, exStore :~> store) => exStore -> (Label name, exKey) -> Expr store
- Indigo.Internal.Expr.Symbolic: stGet :: (StoreHasSubmap store name key value, KnownValue value, exKey :~> key, exStore :~> store) => exStore -> (Label name, exKey) -> Expr (Maybe value)
- Indigo.Internal.Expr.Symbolic: stInsert :: (StoreHasSubmap store name key value, exKey :~> key, exVal :~> value, exStore :~> store) => exStore -> (Label name, exKey, exVal) -> Expr store
- Indigo.Internal.Expr.Symbolic: stInsertNew :: (StoreHasSubmap store name key value, IsError err, Buildable err, exKey :~> key, exVal :~> value, exStore :~> store) => exStore -> (Label name, err, exKey, exVal) -> Expr store
- Indigo.Internal.Expr.Symbolic: stMem :: (StoreHasSubmap store name key value, KnownValue value, exKey :~> key, exStore :~> store) => exStore -> (Label name, exKey) -> Expr Bool
- Indigo.Internal.Expr.Symbolic: stUpdate :: (StoreHasSubmap store name key value, exKey :~> key, exVal :~> Maybe value, exStore :~> store) => exStore -> (Label name, exKey, exVal) -> Expr store
- Indigo.Internal.Expr.Symbolic: sub :: IsArithExpr exN exM Sub n m => exN -> exM -> Expr (ArithResHs Sub n m)
- Indigo.Internal.Expr.Symbolic: toInt :: ex :~> Natural => ex -> Expr Integer
- Indigo.Internal.Expr.Symbolic: unName :: (ex :~> (name :! t), KnownValue t) => Label name -> ex -> Expr t
- Indigo.Internal.Expr.Symbolic: unpack :: (NiceUnpackedValue a, exb :~> Packed a) => exb -> Expr (Maybe a)
- Indigo.Internal.Expr.Symbolic: unpackRaw :: (NiceUnpackedValue a, exb :~> ByteString) => exb -> Expr (Maybe a)
- Indigo.Internal.Expr.Symbolic: unwrap :: (InstrUnwrapC dt name, exDt :~> dt, KnownValue (CtorOnlyField name dt)) => Label name -> exDt -> Expr (CtorOnlyField name dt)
- Indigo.Internal.Expr.Symbolic: update :: IsUpdExpr exKey exVal exMap map => (exKey, exVal) -> exMap -> Expr map
- Indigo.Internal.Expr.Symbolic: varExpr :: KnownValue a => Var a -> Expr a
- Indigo.Internal.Expr.Symbolic: wrap :: (InstrWrapOneC dt name, exField :~> CtorOnlyField name dt, KnownValue dt) => Label name -> exField -> Expr dt
- Indigo.Internal.Expr.Symbolic: xor :: IsArithExpr exN exM Xor n m => exN -> exM -> Expr (ArithResHs Xor n m)
- Indigo.Internal.Expr.TH: deriveExprBuildable :: Name -> Q [Dec]
- Indigo.Internal.Expr.Types: [Abs] :: (UnaryArithOpHs Abs n, KnownValue (UnaryArithResHs Abs n)) => Expr n -> Expr (UnaryArithResHs Abs n)
- Indigo.Internal.Expr.Types: [Add] :: (ArithOpHs Add n m, KnownValue (ArithResHs Add n m)) => Expr n -> Expr m -> Expr (ArithResHs Add n m)
- Indigo.Internal.Expr.Types: [Amount] :: Expr Mutez
- Indigo.Internal.Expr.Types: [And] :: (ArithOpHs And n m, KnownValue (ArithResHs And n m)) => Expr n -> Expr m -> Expr (ArithResHs And n m)
- Indigo.Internal.Expr.Types: [Balance] :: Expr Mutez
- Indigo.Internal.Expr.Types: [Blake2b] :: BytesLike bs => Expr bs -> Expr (Hash Blake2b bs)
- Indigo.Internal.Expr.Types: [C] :: NiceConstant a => a -> Expr a
- Indigo.Internal.Expr.Types: [Cast] :: KnownValue a => Expr a -> Expr a
- Indigo.Internal.Expr.Types: [ChainId] :: Expr ChainId
- Indigo.Internal.Expr.Types: [CheckSignature] :: BytesLike bs => Expr PublicKey -> Expr (TSignature bs) -> Expr bs -> Expr Bool
- Indigo.Internal.Expr.Types: [Coerce] :: (Castable_ a b, KnownValue b) => Expr a -> Expr b
- Indigo.Internal.Expr.Types: [Concat'] :: (ConcatOpHs c, KnownValue c) => Expr (List c) -> Expr c
- Indigo.Internal.Expr.Types: [Concat] :: (ConcatOpHs c, KnownValue c) => Expr c -> Expr c -> Expr c
- Indigo.Internal.Expr.Types: [Cons] :: KnownValue (List a) => Expr a -> Expr (List a) -> Expr (List a)
- Indigo.Internal.Expr.Types: [ConstructWithoutNamed] :: ComplexObjectC dt => Proxy dt -> Rec Expr (FieldTypes dt) -> Expr dt
- Indigo.Internal.Expr.Types: [Construct] :: (InstrConstructC dt, RMap (ConstructorFieldTypes dt), RecordToList (ConstructorFieldTypes dt), KnownValue dt) => Proxy dt -> Rec Expr (ConstructorFieldTypes dt) -> Expr dt
- Indigo.Internal.Expr.Types: [ContractAddress] :: Expr (ContractRef p) -> Expr Address
- Indigo.Internal.Expr.Types: [ContractCallingUnsafe] :: NiceParameter arg => EpName -> Expr Address -> Expr (Maybe (ContractRef arg))
- Indigo.Internal.Expr.Types: [Contract] :: (NiceParameterFull p, NoExplicitDefaultEntrypoint p, ToTAddress p addr, ToT addr ~ ToT Address) => Expr addr -> Expr (Maybe (ContractRef p))
- Indigo.Internal.Expr.Types: [ConvertEpAddressToContract] :: NiceParameter p => Expr EpAddress -> Expr (Maybe (ContractRef p))
- Indigo.Internal.Expr.Types: [Div] :: (EDivOpHs n m, KnownValue (EDivOpResHs n m)) => Expr n -> Expr m -> Expr (EDivOpResHs n m)
- Indigo.Internal.Expr.Types: [EmptyBigMap] :: (KnownValue value, NiceComparable key, KnownValue (BigMap key value)) => Expr (BigMap key value)
- Indigo.Internal.Expr.Types: [EmptyMap] :: (KnownValue value, NiceComparable key, KnownValue (Map key value)) => Expr (Map key value)
- Indigo.Internal.Expr.Types: [EmptySet] :: (NiceComparable key, KnownValue (Set key)) => Expr (Set key)
- Indigo.Internal.Expr.Types: [Eq'] :: NiceComparable n => Expr n -> Expr n -> Expr Bool
- Indigo.Internal.Expr.Types: [Exec] :: KnownValue b => Expr a -> Expr (Lambda a b) -> Expr b
- Indigo.Internal.Expr.Types: [ForcedCoerce] :: (MichelsonCoercible a b, KnownValue b) => Expr a -> Expr b
- Indigo.Internal.Expr.Types: [Fst] :: KnownValue n => Expr (n, m) -> Expr n
- Indigo.Internal.Expr.Types: [Ge] :: NiceComparable n => Expr n -> Expr n -> Expr Bool
- Indigo.Internal.Expr.Types: [Get] :: (GetOpHs c, KnownValue (Maybe (GetOpValHs c)), KnownValue (GetOpValHs c)) => Expr (GetOpKeyHs c) -> Expr c -> Expr (Maybe (GetOpValHs c))
- Indigo.Internal.Expr.Types: [Gt] :: NiceComparable n => Expr n -> Expr n -> Expr Bool
- Indigo.Internal.Expr.Types: [HashKey] :: Expr PublicKey -> Expr KeyHash
- Indigo.Internal.Expr.Types: [ImplicitAccount] :: Expr KeyHash -> Expr (ContractRef ())
- Indigo.Internal.Expr.Types: [Int'] :: Expr Natural -> Expr Integer
- Indigo.Internal.Expr.Types: [IsNat] :: Expr Integer -> Expr (Maybe Natural)
- Indigo.Internal.Expr.Types: [Le] :: NiceComparable n => Expr n -> Expr n -> Expr Bool
- Indigo.Internal.Expr.Types: [Left'] :: (KnownValue x, KnownValue (Either y x)) => Expr y -> Expr (Either y x)
- Indigo.Internal.Expr.Types: [Lsl] :: (ArithOpHs Lsl n m, KnownValue (ArithResHs Lsl n m)) => Expr n -> Expr m -> Expr (ArithResHs Lsl n m)
- Indigo.Internal.Expr.Types: [Lsr] :: (ArithOpHs Lsr n m, KnownValue (ArithResHs Lsr n m)) => Expr n -> Expr m -> Expr (ArithResHs Lsr n m)
- Indigo.Internal.Expr.Types: [Lt] :: NiceComparable n => Expr n -> Expr n -> Expr Bool
- Indigo.Internal.Expr.Types: [MakeView] :: KnownValue (View a r) => Expr a -> Expr (ContractRef r) -> Expr (View a r)
- Indigo.Internal.Expr.Types: [MakeVoid] :: KnownValue (Void_ a b) => Expr a -> Expr (Lambda b b) -> Expr (Void_ a b)
- Indigo.Internal.Expr.Types: [Mem] :: MemOpHs c => Expr (MemOpKeyHs c) -> Expr c -> Expr Bool
- Indigo.Internal.Expr.Types: [Mod] :: (EDivOpHs n m, KnownValue (EModOpResHs n m)) => Expr n -> Expr m -> Expr (EModOpResHs n m)
- Indigo.Internal.Expr.Types: [Mul] :: (ArithOpHs Mul n m, KnownValue (ArithResHs Mul n m)) => Expr n -> Expr m -> Expr (ArithResHs Mul n m)
- Indigo.Internal.Expr.Types: [Name] :: KnownValue (name :! t) => Label name -> Expr t -> Expr (name :! t)
- Indigo.Internal.Expr.Types: [NamedFieldExpr] :: {unNamedFieldExpr :: Expr (GetFieldType a name)} -> NamedFieldExpr a name
- Indigo.Internal.Expr.Types: [Neg] :: (UnaryArithOpHs Neg n, KnownValue (UnaryArithResHs Neg n)) => Expr n -> Expr (UnaryArithResHs Neg n)
- Indigo.Internal.Expr.Types: [Neq] :: NiceComparable n => Expr n -> Expr n -> Expr Bool
- Indigo.Internal.Expr.Types: [Nil] :: KnownValue a => Expr (List a)
- Indigo.Internal.Expr.Types: [NonZero] :: (NonZero n, KnownValue (Maybe n)) => Expr n -> Expr (Maybe n)
- Indigo.Internal.Expr.Types: [None] :: KnownValue t => Expr (Maybe t)
- Indigo.Internal.Expr.Types: [Not] :: (UnaryArithOpHs Not n, KnownValue (UnaryArithResHs Not n)) => Expr n -> Expr (UnaryArithResHs Not n)
- Indigo.Internal.Expr.Types: [Now] :: Expr Timestamp
- Indigo.Internal.Expr.Types: [ObjMan] :: ObjectManipulation a -> Expr a
- Indigo.Internal.Expr.Types: [Object] :: Expr a -> ObjectManipulation a
- Indigo.Internal.Expr.Types: [Or] :: (ArithOpHs Or n m, KnownValue (ArithResHs Or n m)) => Expr n -> Expr m -> Expr (ArithResHs Or n m)
- Indigo.Internal.Expr.Types: [PackRaw] :: NicePackedValue a => Expr a -> Expr ByteString
- Indigo.Internal.Expr.Types: [Pack] :: NicePackedValue a => Expr a -> Expr (Packed a)
- Indigo.Internal.Expr.Types: [Pair] :: KnownValue (n, m) => Expr n -> Expr m -> Expr (n, m)
- Indigo.Internal.Expr.Types: [Right'] :: (KnownValue y, KnownValue (Either y x)) => Expr x -> Expr (Either y x)
- Indigo.Internal.Expr.Types: [RunFutureContract] :: NiceParameter p => Expr (FutureContract p) -> Expr (Maybe (ContractRef p))
- Indigo.Internal.Expr.Types: [Self] :: (NiceParameterFull p, NoExplicitDefaultEntrypoint p) => Expr (ContractRef p)
- Indigo.Internal.Expr.Types: [Sender] :: Expr Address
- Indigo.Internal.Expr.Types: [SetField] :: HasField dt fname ftype => ObjectManipulation dt -> Label fname -> Expr ftype -> ObjectManipulation dt
- Indigo.Internal.Expr.Types: [Sha256] :: BytesLike bs => Expr bs -> Expr (Hash Sha256 bs)
- Indigo.Internal.Expr.Types: [Sha512] :: BytesLike bs => Expr bs -> Expr (Hash Sha512 bs)
- Indigo.Internal.Expr.Types: [Size] :: SizeOpHs c => Expr c -> Expr Natural
- Indigo.Internal.Expr.Types: [Slice] :: (SliceOpHs c, KnownValue c) => Expr Natural -> Expr Natural -> Expr c -> Expr (Maybe c)
- Indigo.Internal.Expr.Types: [Snd] :: KnownValue m => Expr (n, m) -> Expr m
- Indigo.Internal.Expr.Types: [Some] :: KnownValue (Maybe t) => Expr t -> Expr (Maybe t)
- Indigo.Internal.Expr.Types: [StDelete] :: (StoreHasSubmap store name key val, KnownValue store, KnownValue val) => Label name -> Expr key -> Expr store -> Expr store
- Indigo.Internal.Expr.Types: [StGet] :: (StoreHasSubmap store name key value, KnownValue value) => Label name -> Expr key -> Expr store -> Expr (Maybe value)
- Indigo.Internal.Expr.Types: [StInsertNew] :: (StoreHasSubmap store name key value, KnownValue store, IsError err, Buildable err) => Label name -> err -> Expr key -> Expr value -> Expr store -> Expr store
- Indigo.Internal.Expr.Types: [StInsert] :: (StoreHasSubmap store name key value, KnownValue store) => Label name -> Expr key -> Expr value -> Expr store -> Expr store
- Indigo.Internal.Expr.Types: [StMem] :: (StoreHasSubmap store name key val, KnownValue val) => Label name -> Expr key -> Expr store -> Expr Bool
- Indigo.Internal.Expr.Types: [StUpdate] :: (StoreHasSubmap store name key val, KnownValue store) => Label name -> Expr key -> Expr (Maybe val) -> Expr store -> Expr store
- Indigo.Internal.Expr.Types: [Sub] :: (ArithOpHs Sub n m, KnownValue (ArithResHs Sub n m)) => Expr n -> Expr m -> Expr (ArithResHs Sub n m)
- Indigo.Internal.Expr.Types: [ToField] :: HasField dt fname ftype => ObjectManipulation dt -> Label fname -> ObjectManipulation ftype
- Indigo.Internal.Expr.Types: [UnName] :: KnownValue t => Label name -> Expr (name :! t) -> Expr t
- Indigo.Internal.Expr.Types: [UnpackRaw] :: NiceUnpackedValue a => Expr ByteString -> Expr (Maybe a)
- Indigo.Internal.Expr.Types: [Unpack] :: NiceUnpackedValue a => Expr (Packed a) -> Expr (Maybe a)
- Indigo.Internal.Expr.Types: [Unwrap] :: (InstrUnwrapC dt name, KnownValue (CtorOnlyField name dt)) => Label name -> Expr dt -> Expr (CtorOnlyField name dt)
- Indigo.Internal.Expr.Types: [Update] :: (UpdOpHs c, KnownValue c) => Expr c -> Expr (UpdOpKeyHs c) -> Expr (UpdOpParamsHs c) -> Expr c
- Indigo.Internal.Expr.Types: [V] :: KnownValue a => Var a -> Expr a
- Indigo.Internal.Expr.Types: [Wrap] :: (InstrWrapOneC dt name, KnownValue dt) => Label name -> Expr (CtorOnlyField name dt) -> Expr dt
- Indigo.Internal.Expr.Types: [Xor] :: (ArithOpHs Xor n m, KnownValue (ArithResHs Xor n m)) => Expr n -> Expr m -> Expr (ArithResHs Xor n m)
- Indigo.Internal.Expr.Types: class ToExpr' (Decide x) x => ToExpr x
- Indigo.Internal.Expr.Types: data Expr a
- Indigo.Internal.Expr.Types: data NamedFieldExpr a name
- Indigo.Internal.Expr.Types: data ObjectManipulation a
- Indigo.Internal.Expr.Types: instance Formatting.Buildable.Buildable (Indigo.Internal.Expr.Types.Expr a)
- Indigo.Internal.Expr.Types: instance Formatting.Buildable.Buildable (Indigo.Internal.Expr.Types.ObjectManipulation a)
- Indigo.Internal.Expr.Types: instance Indigo.Internal.Expr.Types.ToExpr' 'Indigo.Internal.Expr.Types.ExprD (Indigo.Internal.Expr.Types.Expr a)
- Indigo.Internal.Expr.Types: instance Indigo.Internal.Expr.Types.ToExpr' 'Indigo.Internal.Expr.Types.ObjManD (Indigo.Internal.Expr.Types.ObjectManipulation a)
- Indigo.Internal.Expr.Types: instance Indigo.Internal.Expr.Types.ToExpr' (Indigo.Internal.Expr.Types.Decide x) x => Indigo.Internal.Expr.Types.ToExpr x
- Indigo.Internal.Expr.Types: instance Lorentz.Constraints.Scopes.KnownValue a => Indigo.Internal.Expr.Types.ToExpr' 'Indigo.Internal.Expr.Types.VarD (Indigo.Internal.Var.Var a)
- Indigo.Internal.Expr.Types: instance Lorentz.Constraints.Scopes.NiceConstant a => Indigo.Internal.Expr.Types.ToExpr' 'Indigo.Internal.Expr.Types.ValD a
- Indigo.Internal.Expr.Types: toExpr :: forall a. ToExpr a => a -> Expr (ExprType a)
- Indigo.Internal.Expr.Types: type (:~>) op n = IsExpr op n
- Indigo.Internal.Expr.Types: type ExprType a = ExprType' (Decide a) a
- Indigo.Internal.Expr.Types: type IsArithExpr exN exM a n m = (exN :~> n, exM :~> m, ArithOpHs a n m, KnownValue (ArithResHs a n m))
- Indigo.Internal.Expr.Types: type IsConcatExpr exN1 exN2 n = (exN1 :~> n, exN2 :~> n, ConcatOpHs n)
- Indigo.Internal.Expr.Types: type IsConcatListExpr exN n = (exN :~> List n, ConcatOpHs n, KnownValue n)
- Indigo.Internal.Expr.Types: type IsDivExpr exN exM n m = (exN :~> n, exM :~> m, EDivOpHs n m, KnownValue (EDivOpResHs n m))
- Indigo.Internal.Expr.Types: type IsExpr op n = (ToExpr op, ExprType op ~ n, KnownValue n)
- Indigo.Internal.Expr.Types: type IsGetExpr exKey exMap map = (exKey :~> GetOpKeyHs map, exMap :~> map, GetOpHs map, KnownValue (GetOpValHs map))
- Indigo.Internal.Expr.Types: type IsMemExpr exKey exN n = (exKey :~> MemOpKeyHs n, exN :~> n, MemOpHs n)
- Indigo.Internal.Expr.Types: type IsModExpr exN exM n m = (exN :~> n, exM :~> m, EDivOpHs n m, KnownValue (EModOpResHs n m))
- Indigo.Internal.Expr.Types: type IsSizeExpr exN n = (exN :~> n, SizeOpHs n)
- Indigo.Internal.Expr.Types: type IsSliceExpr exN n = (exN :~> n, SliceOpHs n)
- Indigo.Internal.Expr.Types: type IsUnaryArithExpr exN a n = (exN :~> n, UnaryArithOpHs a n, KnownValue (UnaryArithResHs a n))
- Indigo.Internal.Expr.Types: type IsUpdExpr exKey exVal exMap map = (exKey :~> UpdOpKeyHs map, exVal :~> UpdOpParamsHs map, exMap :~> map, UpdOpHs map)
- Indigo.Internal.Expr.Types: type ObjectExpr a = IndigoObjectF (NamedFieldExpr a) a
- Indigo.Internal.Field: [DeeperField] :: (AccessFieldC dt fname, InstrSetFieldC dt fname, HasField (GetFieldType dt fname) targetFName targetFType) => Label fname -> StoreFieldOps dt targetFName targetFType -> FieldLens dt targetFName targetFType
- Indigo.Internal.Field: [TargetField] :: (InstrGetFieldC dt fname, InstrSetFieldC dt fname, GetFieldType dt fname ~ targetFType, AccessFieldC dt fname) => Label fname -> StoreFieldOps dt targetFName targetFType -> FieldLens dt targetFName targetFType
- Indigo.Internal.Field: assignField :: forall a name f proxy. AccessFieldC a name => proxy name -> f name -> Rec f (ConstructorFieldNames a) -> Rec f (ConstructorFieldNames a)
- Indigo.Internal.Field: class (KnownValue ftype, KnownValue dt) => HasField dt fname ftype | dt fname -> ftype
- Indigo.Internal.Field: data FieldLens dt fname ftype
- Indigo.Internal.Field: fetchField :: forall a name f proxy. AccessFieldC a name => proxy name -> Rec f (ConstructorFieldNames a) -> f name
- Indigo.Internal.Field: fieldLens :: HasField dt fname ftype => FieldLens dt fname ftype
- Indigo.Internal.Field: fieldLensADT :: forall dt targetFName targetFType fname. (InstrGetFieldC dt fname, InstrSetFieldC dt fname, GetFieldType dt fname ~ targetFType, AccessFieldC dt fname) => Label fname -> FieldLens dt targetFName targetFType
- Indigo.Internal.Field: fieldLensDeeper :: forall dt targetName targetType fname. (AccessFieldC dt fname, HasFieldOfType dt fname (GetFieldType dt fname), HasField (GetFieldType dt fname) targetName targetType) => Label fname -> FieldLens dt targetName targetType
- Indigo.Internal.Field: flSFO :: FieldLens dt fname ftype -> StoreFieldOps dt fname ftype
- Indigo.Internal.Field: instance (Michelson.Typed.Haskell.Instr.Product.InstrSetFieldC dt fname, Michelson.Typed.Haskell.Instr.Product.InstrGetFieldC dt fname, Michelson.Typed.Haskell.Instr.Product.GetFieldType dt fname GHC.Types.~ ftype, Indigo.Internal.Field.AccessFieldC dt fname, GHC.TypeLits.KnownSymbol fname, Lorentz.Constraints.Scopes.KnownValue ftype, Lorentz.Constraints.Scopes.KnownValue dt) => Indigo.Internal.Field.HasField dt fname ftype
- Indigo.Internal.Field: type AccessFieldC a name = RElem name (ConstructorFieldNames a) (RIndex name (ConstructorFieldNames a))
- Indigo.Internal.Lookup: instance Data.Type.Equality.TestEquality Indigo.Internal.Lookup.TVal
- Indigo.Internal.Lookup: rdrop :: Sing n -> Rec any s -> Rec any (Drop n s)
- Indigo.Internal.Lookup: rtake :: Sing n -> Rec any s -> Rec any (Take n s)
- Indigo.Internal.Lookup: varActionGet :: forall a stk. KnownValue a => RefId -> StackVars stk -> stk :-> (a : stk)
- Indigo.Internal.Lookup: varActionOperation :: HasSideEffects => StackVars stk -> (Operation : stk) :-> stk
- Indigo.Internal.Lookup: varActionSet :: forall a stk. KnownValue a => RefId -> StackVars stk -> (a : stk) :-> stk
- Indigo.Internal.Lookup: varActionUpdate :: forall a b stk. (KnownValue a, KnownValue b) => RefId -> StackVars stk -> ('[b, a] :-> '[a]) -> (b : stk) :-> stk
- Indigo.Internal.Object: [Cell] :: KnownValue a => RefId -> IndigoObjectF f a
- Indigo.Internal.Object: [Decomposed] :: ComplexObjectC a => Rec f (ConstructorFieldNames a) -> IndigoObjectF f a
- Indigo.Internal.Object: [NamedFieldObj] :: IsObject (GetFieldType a name) => {unFieldObj :: Object (GetFieldType a name)} -> NamedFieldObj a name
- Indigo.Internal.Object: [SomeObject] :: IsObject a => Object a -> SomeObject
- Indigo.Internal.Object: [TypedFieldObj] :: IsObject a => Object a -> TypedFieldObj a
- Indigo.Internal.Object: castFieldConstructors :: forall a st. CastFieldConstructors (FieldTypes a) (ConstructorFieldTypes a) => Rec (FieldConstructor st) (FieldTypes a) -> Rec (FieldConstructor st) (ConstructorFieldTypes a)
- Indigo.Internal.Object: class IsObject' (TypeDecision a) a => IsObject a
- Indigo.Internal.Object: complexObjectDict :: forall a. IsObject a => Maybe (Dict (ComplexObjectC a))
- Indigo.Internal.Object: data IndigoObjectF f a
- Indigo.Internal.Object: data NamedFieldObj a name
- Indigo.Internal.Object: data SomeObject
- Indigo.Internal.Object: data TypedFieldObj a
- Indigo.Internal.Object: instance Indigo.Internal.Object.ComplexObjectC a => Indigo.Internal.Object.IsObject' 'Indigo.Internal.Object.ProductTypeD a
- Indigo.Internal.Object: instance Indigo.Internal.Object.IsObject' (Indigo.Internal.Object.TypeDecision a) a => Indigo.Internal.Object.IsObject a
- Indigo.Internal.Object: instance Lorentz.Constraints.Scopes.KnownValue a => Indigo.Internal.Object.IsObject' 'Indigo.Internal.Object.PrimitiveD a
- Indigo.Internal.Object: instance Lorentz.Constraints.Scopes.KnownValue a => Indigo.Internal.Object.IsObject' 'Indigo.Internal.Object.SumTypeD a
- Indigo.Internal.Object: namedToTypedFieldObj :: forall a name. NamedFieldObj a name -> TypedFieldObj (GetFieldType a name)
- Indigo.Internal.Object: namedToTypedRec :: forall a f g. (forall name. f name -> g (GetFieldType a name)) -> Rec f (ConstructorFieldNames a) -> Rec g (FieldTypes a)
- Indigo.Internal.Object: type ComplexObjectC a = (ToDeconstructC a, ToConstructC a, AllConstrained IsObject (FieldTypes a), RecordToList (FieldTypes a))
- Indigo.Internal.Object: type FieldTypes a = MapGFT a (ConstructorFieldNames a)
- Indigo.Internal.Object: type Object a = IndigoObjectF (NamedFieldObj a) a
- Indigo.Internal.Object: typedToNamedFieldObj :: forall a name. TypedFieldObj (GetFieldType a name) -> NamedFieldObj a name
- Indigo.Internal.Object: typedToNamedRec :: forall a f g. KnownList (ConstructorFieldNames a) => (forall name. f (GetFieldType a name) -> g name) -> Rec f (FieldTypes a) -> Rec g (ConstructorFieldNames a)
- Indigo.Internal.SIS: SomeIndigoState :: (MetaData inp -> SomeGenCode inp) -> SomeIndigoState inp
- Indigo.Internal.SIS: [SomeGenCode] :: GenCode inp out -> SomeGenCode inp
- Indigo.Internal.SIS: [unSIS] :: SomeIndigoState inp -> MetaData inp -> SomeGenCode inp
- Indigo.Internal.SIS: data SomeGenCode inp
- Indigo.Internal.SIS: newtype SomeIndigoState inp
- Indigo.Internal.SIS: overSIS :: (forall out. GenCode inp out -> SomeGenCode inp) -> SomeIndigoState inp -> SomeIndigoState inp
- Indigo.Internal.SIS: runSIS :: SomeIndigoState inp -> MetaData inp -> (forall out. GenCode inp out -> r) -> r
- Indigo.Internal.SIS: thenSIS :: SomeIndigoState inp -> (forall out. SomeIndigoState out) -> SomeIndigoState inp
- Indigo.Internal.SIS: toSIS :: IndigoState inp out -> SomeIndigoState inp
- Indigo.Internal.State: (##) :: (a :-> b) -> (b :-> c) -> a :-> c
- Indigo.Internal.State: (<$>) :: Functor f => (a -> b) -> f a -> f b
- Indigo.Internal.State: (>>) :: IndigoState inp out -> IndigoState out out1 -> IndigoState inp out1
- Indigo.Internal.State: GenCode :: ~StackVars out -> (inp :-> out) -> (out :-> inp) -> GenCode inp out
- Indigo.Internal.State: GenCodeHooks :: (forall inp out. Text -> (inp :-> out) -> inp :-> out) -> (forall inp out. Text -> (inp :-> out) -> inp :-> out) -> (forall inp out. Text -> (inp :-> out) -> inp :-> out) -> GenCodeHooks
- Indigo.Internal.State: IndigoState :: (MetaData inp -> GenCode inp out) -> IndigoState inp out
- Indigo.Internal.State: MetaData :: StackVars inp -> DecomposedObjects -> GenCodeHooks -> MetaData inp
- Indigo.Internal.State: [gcClear] :: GenCode inp out -> out :-> inp
- Indigo.Internal.State: [gcCode] :: GenCode inp out -> inp :-> out
- Indigo.Internal.State: [gcStack] :: GenCode inp out -> ~StackVars out
- Indigo.Internal.State: [gchAuxiliaryHook] :: GenCodeHooks -> forall inp out. Text -> (inp :-> out) -> inp :-> out
- Indigo.Internal.State: [gchExprHook] :: GenCodeHooks -> forall inp out. Text -> (inp :-> out) -> inp :-> out
- Indigo.Internal.State: [gchStmtHook] :: GenCodeHooks -> forall inp out. Text -> (inp :-> out) -> inp :-> out
- Indigo.Internal.State: [mdHooks] :: MetaData inp -> GenCodeHooks
- Indigo.Internal.State: [mdObjects] :: MetaData inp -> DecomposedObjects
- Indigo.Internal.State: [mdStack] :: MetaData inp -> StackVars inp
- Indigo.Internal.State: [runIndigoState] :: IndigoState inp out -> MetaData inp -> GenCode inp out
- Indigo.Internal.State: alterStkMd :: MetaData inp -> (StackVars inp -> StackVars inp1) -> MetaData inp1
- Indigo.Internal.State: assignTopVar :: KnownValue x => Var x -> IndigoState (x : inp) (x : inp)
- Indigo.Internal.State: auxiliaryHook :: forall inp out any. MetaData any -> Text -> (inp :-> out) -> inp :-> out
- Indigo.Internal.State: auxiliaryHookState :: Text -> IndigoState inp out -> IndigoState inp out
- Indigo.Internal.State: cleanGenCode :: GenCode inp out -> inp :-> inp
- Indigo.Internal.State: data GenCode inp out
- Indigo.Internal.State: data GenCodeHooks
- Indigo.Internal.State: data MetaData inp
- Indigo.Internal.State: emptyGenCodeHooks :: GenCodeHooks
- Indigo.Internal.State: exprHook :: forall inp out any. MetaData any -> Text -> (inp :-> out) -> inp :-> out
- Indigo.Internal.State: exprHookState :: Text -> IndigoState inp out -> IndigoState inp out
- Indigo.Internal.State: infixl 4 <$>
- Indigo.Internal.State: instance GHC.Base.Monoid Indigo.Internal.State.GenCodeHooks
- Indigo.Internal.State: instance GHC.Base.Semigroup Indigo.Internal.State.GenCodeHooks
- Indigo.Internal.State: iput :: GenCode inp out -> IndigoState inp out
- Indigo.Internal.State: newtype IndigoState inp out
- Indigo.Internal.State: nopState :: IndigoState inp inp
- Indigo.Internal.State: popNoRefMd :: MetaData (a : inp) -> MetaData inp
- Indigo.Internal.State: pushNoRefMd :: KnownValue a => MetaData inp -> MetaData (a : inp)
- Indigo.Internal.State: pushRefMd :: KnownValue a => Var a -> MetaData inp -> MetaData (a : inp)
- Indigo.Internal.State: replStkMd :: MetaData inp -> StackVars inp1 -> MetaData inp1
- Indigo.Internal.State: stmtHook :: forall inp out any. MetaData any -> Text -> (inp :-> out) -> inp :-> out
- Indigo.Internal.State: stmtHookState :: Text -> IndigoState inp out -> IndigoState inp out
- Indigo.Internal.State: type DecomposedObjects = Map RefId SomeObject
- Indigo.Internal.State: usingIndigoState :: MetaData inp -> IndigoState inp out -> GenCode inp out
- Indigo.Internal.State: withObject :: forall a r. KnownValue a => DecomposedObjects -> Var a -> (Object a -> r) -> r
- Indigo.Internal.State: withObjectState :: forall a inp out. KnownValue a => Var a -> (Object a -> IndigoState inp out) -> IndigoState inp out
- Indigo.Internal.State: withStackVars :: (StackVars inp -> IndigoState inp out) -> IndigoState inp out
- Indigo.Internal.Var: Var :: RefId -> Var a
- Indigo.Internal.Var: [FailureStack] :: StackVars stk
- Indigo.Internal.Var: [NoRef] :: KnownValue a => StkEl a
- Indigo.Internal.Var: [Ref] :: KnownValue a => RefId -> StkEl a
- Indigo.Internal.Var: [StkElements] :: Rec StkEl stk -> StackVars stk
- Indigo.Internal.Var: assignVarAt :: (KnownValue a, a ~ At n inp, RequireLongerThan inp n) => Var a -> StackVars inp -> Sing n -> StackVars inp
- Indigo.Internal.Var: data RefId
- Indigo.Internal.Var: data StackVars (stk :: [Type])
- Indigo.Internal.Var: data StkEl a
- Indigo.Internal.Var: data Var a
- Indigo.Internal.Var: emptyStack :: StackVars '[]
- Indigo.Internal.Var: instance (Lorentz.Constraints.Scopes.KnownValue x, Data.Default.Class.Default (Indigo.Internal.Var.StackVars xs)) => Data.Default.Class.Default (Indigo.Internal.Var.StackVars (x : xs))
- Indigo.Internal.Var: instance Data.Default.Class.Default (Indigo.Internal.Var.StackVars '[])
- Indigo.Internal.Var: instance Data.Type.Equality.TestEquality Indigo.Internal.Var.StkEl
- Indigo.Internal.Var: instance Formatting.Buildable.Buildable Indigo.Internal.Var.RefId
- Indigo.Internal.Var: instance GHC.Classes.Eq Indigo.Internal.Var.RefId
- Indigo.Internal.Var: instance GHC.Classes.Ord Indigo.Internal.Var.RefId
- Indigo.Internal.Var: instance GHC.Enum.Bounded Indigo.Internal.Var.RefId
- Indigo.Internal.Var: instance GHC.Generics.Generic Indigo.Internal.Var.RefId
- Indigo.Internal.Var: instance GHC.Num.Num Indigo.Internal.Var.RefId
- Indigo.Internal.Var: instance GHC.Real.Real Indigo.Internal.Var.RefId
- Indigo.Internal.Var: instance GHC.Show.Show Indigo.Internal.Var.RefId
- Indigo.Internal.Var: instance forall k (a :: k). Formatting.Buildable.Buildable (Indigo.Internal.Var.Var a)
- Indigo.Internal.Var: instance forall k (a :: k). GHC.Generics.Generic (Indigo.Internal.Var.Var a)
- Indigo.Internal.Var: instance forall k (a :: k). GHC.Show.Show (Indigo.Internal.Var.Var a)
- Indigo.Internal.Var: operationsVar :: HasSideEffects => Var Ops
- Indigo.Internal.Var: popNoRef :: StackVars (a : inp) -> StackVars inp
- Indigo.Internal.Var: pushNoRef :: KnownValue a => StackVars inp -> StackVars (a : inp)
- Indigo.Internal.Var: pushRef :: KnownValue a => Var a -> StackVars inp -> StackVars (a : inp)
- Indigo.Internal.Var: storageVar :: HasStorage st => Var st
- Indigo.Internal.Var: type HasSideEffects = Given (Var Ops)
- Indigo.Internal.Var: type HasStorage st = (Given (Var st), KnownValue st)
- Indigo.Internal.Var: type Ops = [Operation]
- Indigo.Internal.Var: type StackVars' stk = Rec StkEl stk
- Indigo.Lorentz: BigMap :: Map k v -> BigMap k v
- Indigo.Lorentz: EpAddress :: Address -> EpName -> EpAddress
- Indigo.Lorentz: HashUnsafe :: ByteString -> Hash (alg :: HashAlgorithmKind) a
- Indigo.Lorentz: UParamUnsafe :: (MText, ByteString) -> UParam (entries :: [EntrypointKind])
- Indigo.Lorentz: [epaType] :: DEntrypointArg -> Type
- Indigo.Lorentz: [sopSetField] :: StoreFieldOps store (fname :: Symbol) ftype -> forall (s :: [Type]). () => Label fname -> (ftype : (store : s)) :-> (store : s)
- Indigo.Lorentz: [unBigMap] :: BigMap k v -> Map k v
- Indigo.Lorentz: arg :: forall (name :: Symbol) a. Name name -> (name :! a) -> a
- Indigo.Lorentz: argDef :: forall (name :: Symbol) a. Name name -> a -> (name :? a) -> a
- Indigo.Lorentz: argF :: forall (name :: Symbol) f a. Name name -> NamedF f a name -> f a
- Indigo.Lorentz: buildLorentzDoc :: forall (inp :: [Type]) (out :: [Type]). (inp :-> out) -> ContractDoc
- Indigo.Lorentz: buildLorentzDocWithGitRev :: forall (inp :: [Type]) (out :: [Type]). DGitRevision -> (inp :-> out) -> ContractDoc
- Indigo.Lorentz: cCodeL :: Lens (Contract cp1 st1) (Contract cp2 st2) (ContractCode cp1 st1) (ContractCode cp2 st2)
- Indigo.Lorentz: cCompilationOptionsL :: Lens' (Contract cp st) CompilationOptions
- Indigo.Lorentz: cDisableInitialCastL :: Lens' (Contract cp st) Bool
- Indigo.Lorentz: callingDefTAddress :: NiceParameterFull cp => TAddress cp -> ContractRef (GetDefaultEntrypointArg cp)
- Indigo.Lorentz: callingTAddress :: forall cp (mname :: Maybe Symbol). NiceParameterFull cp => TAddress cp -> EntrypointRef mname -> ContractRef (GetEntrypointArgCustom cp mname)
- Indigo.Lorentz: class (EDivOp ToT n ToT m, NiceComparable n, NiceComparable m, ToT EDivOpResHs n m ~ EDivOpRes ToT n ToT m, ToT EModOpResHs n m ~ EModOpRes ToT n ToT m) => EDivOpHs n m where {
- Indigo.Lorentz: concreteTypeDocHaskellRepUnsafe :: (Typeable a, GenericIsoValue a, GTypeHasDoc (Rep a)) => TypeDocHaskellRep b
- Indigo.Lorentz: concreteTypeDocMichelsonRepUnsafe :: forall k a (b :: k). (Typeable a, SingI (ToT a)) => TypeDocMichelsonRep b
- Indigo.Lorentz: constructDEpArg :: (TypeHasDoc arg, HasAnnotation arg, KnownValue arg) => DEntrypointArg
- Indigo.Lorentz: customErrorDocHaskellRepGeneral :: forall (tag :: Symbol). (SingI (ToT (ErrorArg tag)), IsError (CustomError tag), TypeHasDoc (ErrorArg tag), CustomErrorHasDoc tag) => Text -> Proxy tag -> Markdown
- Indigo.Lorentz: data Address
- Indigo.Lorentz: data KeyHash
- Indigo.Lorentz: data View a r
- Indigo.Lorentz: errorDoc :: QuasiQuoter
- Indigo.Lorentz: iWithVarAnnotations :: forall (inp :: [Type]) (out :: [Type]). HasCallStack => [Text] -> (inp :-> out) -> inp :-> out
- Indigo.Lorentz: lSignEd22519 :: BytesLike a => SecretKey -> a -> TSignature a
- Indigo.Lorentz: newtype BigMap k v
- Indigo.Lorentz: niceConstantEvi :: NiceConstant a :- ConstantScope (ToT a)
- Indigo.Lorentz: nicePackedValueEvi :: NicePackedValue a :- PackedValScope (ToT a)
- Indigo.Lorentz: niceParameterEvi :: NiceParameter a :- ParameterScope (ToT a)
- Indigo.Lorentz: nicePrintedValueEvi :: NicePrintedValue a :- PrintedValScope (ToT a)
- Indigo.Lorentz: niceStorageEvi :: NiceStorage a :- StorageScope (ToT a)
- Indigo.Lorentz: niceUnpackedValueEvi :: NiceUnpackedValue a :- UnpackedValScope (ToT a)
- Indigo.Lorentz: renderLorentzDoc :: forall (inp :: [Type]) (out :: [Type]). (inp :-> out) -> LText
- Indigo.Lorentz: renderLorentzDocWithGitRev :: forall (inp :: [Type]) (out :: [Type]). DGitRevision -> (inp :-> out) -> LText
- Indigo.Lorentz: type ContractCode cp st = '[(cp, st)] :-> ContractOut st
- Indigo.Lorentz: type NicePrintedValue a = (KnownValue a, ProperPrintedValBetterErrors ToT a)
- Indigo.Lorentz: type RequireNoArgError (tag :: Symbol) (msg :: ErrorMessage) = (TypeErrorUnless ErrorArg tag == () msg, msg ~ 'Text "Expected no-arg error, but given error requires argument of type " :<>: 'ShowType ErrorArg tag)
- Indigo.Lorentz: type Unwrappable s = GUnwrappable Rep s;
- Indigo.Lorentz: type WellTypedIsoValue a = (WellTyped ToT a, IsoValue a)
- Indigo.Lorentz: unwrapUnsafe_ :: forall dt (name :: Symbol) (st :: [Type]). InstrUnwrapC dt name => Label name -> (dt : st) :-> (CtorOnlyField name dt : st)
- Indigo.Prelude: even :: Integral a => a -> Bool
- Indigo.Prelude: gcdInt' :: Int -> Int -> Int
- Indigo.Prelude: gcdWord' :: Word -> Word -> Word
- Indigo.Prelude: odd :: Integral a => a -> Bool
- Indigo.Rebinded: class IsLabel (x :: Symbol) a
- Indigo.Rebinded: fromInteger :: Integer -> NumType n t -> t
- Indigo.Rebinded: fromLabel :: IsLabel x a => a
- Indigo.Rebinded: ifThenElse :: (IfConstraint a b, IsExpr exa Bool) => exa -> IndigoM a -> IndigoM b -> IndigoM (RetVars a)
- Indigo.Rebinded: int :: NumType 'Int Integer
- Indigo.Rebinded: mutez :: NumType 'Mtz Mutez
- Indigo.Rebinded: nat :: NumType 'Nat Natural
+ Indigo: (:-|) :: FieldRef l -> FieldRef r -> (:-|) (l :: k1) (r :: k2) (p :: FieldRefTag)
+ Indigo: -- Used in constraint for Lorentz instruction wrapping into a Haskell
+ Indigo: -- newtype and vice versa.
+ Indigo: -- this, <a>entrypointKindPos</a> and <a>entrypointKindSectionName</a>
+ Indigo: -- will be ignored.
+ Indigo: ApplicativeBoolean :: f bool -> ApplicativeBoolean (f :: k -> Type) (bool :: k)
+ Indigo: BigMapId :: Natural -> BigMapId (k2 :: k) (v :: k1)
+ Indigo: ChestContentT :: a -> OpenChestT a
+ Indigo: ChestOpenFailedT :: Bool -> OpenChestT a
+ Indigo: ChestT :: Chest -> ChestT a
+ Indigo: ContractCode :: ('[(cp, st)] :-> ContractOut st) -> ContractCode cp st
+ Indigo: ContractData :: ContractCode cp st -> Rec (ContractView st) (RevealViews vd) -> CompilationOptions -> ContractData cp st vd
+ Indigo: DView :: ViewName -> SubDoc -> DView
+ Indigo: DViewArg :: Proxy a -> DViewArg
+ Indigo: DViewDesc :: Proxy vd -> DViewDesc
+ Indigo: DViewRet :: Proxy a -> DViewRet
+ Indigo: EpAddress' :: Address -> EpName -> EpAddress
+ Indigo: Impossible :: Impossible (reason :: Symbol)
+ Indigo: IsDupable :: DupableDecision a
+ Indigo: IsNotDupable :: DupableDecision a
+ Indigo: ReadTicket :: Address -> a -> Natural -> ReadTicket a
+ Indigo: RecLambda :: ((i ++ '[WrappedLambda i o]) :-> o) -> WrappedLambda (i :: [Type]) (o :: [Type])
+ Indigo: SelfRef :: SelfRef (p :: FieldRefTag)
+ Indigo: SomeEntrypointArg :: Proxy a -> SomeEntrypointArg
+ Indigo: Ticket :: Address -> arg -> Natural -> Ticket arg
+ Indigo: UnsafeHash :: ByteString -> Hash (alg :: HashAlgorithmKind) a
+ Indigo: UnsafeUParam :: (MText, ByteString) -> UParam (entries :: [EntrypointKind])
+ Indigo: WrappedLambda :: (i :-> o) -> WrappedLambda (i :: [Type]) (o :: [Type])
+ Indigo: [ContractView] :: forall (name :: Symbol) arg ret st. (KnownSymbol name, NiceViewable arg, NiceViewable ret, HasAnnotation arg, HasAnnotation ret) => ViewCode arg st ret -> ContractView st ('ViewTyInfo name arg ret)
+ Indigo: [Keccak] :: BytesLike bs => Expr bs -> Expr (Hash Keccak bs)
+ Indigo: [Level] :: Expr Natural
+ Indigo: [SelfAddress] :: Expr Address
+ Indigo: [Sha3] :: BytesLike bs => Expr bs -> Expr (Hash Sha3 bs)
+ Indigo: [TotalVotingPower] :: Expr Natural
+ Indigo: [VotingPower] :: Expr KeyHash -> Expr Natural
+ Indigo: [cdCode] :: ContractData cp st vd -> ContractCode cp st
+ Indigo: [cdCompilationOptions] :: ContractData cp st vd -> CompilationOptions
+ Indigo: [cdViews] :: ContractData cp st vd -> Rec (ContractView st) (RevealViews vd)
+ Indigo: [dvName] :: DView -> ViewName
+ Indigo: [dvSub] :: DView -> SubDoc
+ Indigo: [getDown] :: Down a -> a
+ Indigo: [rtAmount] :: ReadTicket a -> Natural
+ Indigo: [rtData] :: ReadTicket a -> a
+ Indigo: [rtTicketer] :: ReadTicket a -> Address
+ Indigo: [sopGetAndUpdate] :: StoreSubmapOps store (mname :: k) key value -> forall (s :: [Type]). () => FieldRef mname -> (key : (Maybe value : (store : s))) :-> (Maybe value : (store : s))
+ Indigo: [sopGetFieldOpen] :: StoreFieldOps store (fname :: k) ftype -> forall res (s :: [Type]). HasDupableGetters store => ('[ftype] :-> '[res, ftype]) -> ('[ftype] :-> '[res]) -> FieldRef fname -> (store : s) :-> (res : (store : s))
+ Indigo: [sopSetFieldOpen] :: StoreFieldOps store (fname :: k) ftype -> forall new (s :: [Type]). () => ('[new, ftype] :-> '[ftype]) -> FieldRef fname -> (new : (store : s)) :-> (store : s)
+ Indigo: [tAmount] :: Ticket arg -> Natural
+ Indigo: [tData] :: Ticket arg -> arg
+ Indigo: [tTicketer] :: Ticket arg -> Address
+ Indigo: [unBigMapId] :: BigMapId (k2 :: k) (v :: k1) -> Natural
+ Indigo: [unChestT] :: ChestT a -> Chest
+ Indigo: [unContractCode] :: ContractCode cp st -> '[(cp, st)] :-> ContractOut st
+ Indigo: all1 :: Boolean b => (a -> b) -> NonEmpty a -> b
+ Indigo: and1 :: Boolean a => NonEmpty a -> a
+ Indigo: annQ :: QuasiQuoter
+ Indigo: any1 :: Boolean b => (a -> b) -> NonEmpty a -> b
+ Indigo: assertCustomNoArg :: forall tag ex. (MustHaveErrorArg tag MText, CustomErrorHasDoc tag, IsExpr ex Bool, HasCallStack) => Label tag -> ex -> IndigoM ()
+ Indigo: cDocumentedCode :: Contract cp st vd -> ContractCode cp st
+ Indigo: cMichelsonContract :: Contract cp st vd -> Contract (ToT cp) (ToT st)
+ Indigo: callingAddress :: forall cp vd addr (mname :: Maybe Symbol). (ToTAddress cp vd addr, NiceParameterFull cp) => addr -> EntrypointRef mname -> ContractRef (GetEntrypointArgCustom cp mname)
+ Indigo: callingDefAddress :: (ToTAddress cp vd addr, NiceParameterFull cp) => addr -> ContractRef (GetDefaultEntrypointArg cp)
+ Indigo: cdCodeL :: forall cp st vd cp1. NiceParameterFull cp1 => Lens (ContractData cp st vd) (ContractData cp1 st vd) (ContractCode cp st) (ContractCode cp1 st)
+ Indigo: cdCompilationOptionsL :: Lens' (ContractData cp st vd) CompilationOptions
+ Indigo: class Boolean a
+ Indigo: class Boolean a => BooleanMonoid a
+ Indigo: class (SingI t, WellTyped t, HasNoOp t, HasNoBigMap t, HasNoContract t, HasNoTicket t, HasNoSaplingState t) => ConstantScope (t :: T)
+ Indigo: class DefArithOp (aop :: k)
+ Indigo: class DefUnaryArithOp (aop :: k) where {
+ Indigo: class dipInp ~ a : Tail dipInp => DipT a (inp :: [Type]) (dipInp :: [Type]) (dipOut :: [Type]) (out :: [Type]) | inp a -> dipInp, dipOut inp a -> out, inp out a -> dipOut
+ Indigo: class st ~ Head st : Tail st => DupT a (st :: [Type])
+ Indigo: class FieldRefHasFinalName (fr :: k) where {
+ Indigo: class FromList l where {
+ Indigo: class HasDupableGetters (a :: k)
+ Indigo: class IsCustomErrorArgRep a
+ Indigo: class IsNotInView
+ Indigo: class KnownFieldRef (ty :: k) where {
+ Indigo: class ToBytesArithOpHs n
+ Indigo: class ToIntegerArithOpHs n
+ Indigo: class TypeHasFieldNamingStrategy (a :: k)
+ Indigo: class ToT s ~ ToT Unwrappabled s => Unwrappable s where {
+ Indigo: class (Typeable vd, RenderViewsImpl RevealViews vd) => ViewsDescriptorHasDoc vd
+ Indigo: customErrorHaskellRep :: forall (tag :: Symbol). (IsCustomErrorArgRep a, KnownSymbol tag, CustomErrorHasDoc tag) => Proxy tag -> Markdown
+ Indigo: customErrorRepDocDeps :: IsCustomErrorArgRep a => [SomeDocDefinitionItem]
+ Indigo: customGeneric' :: Maybe Type -> Name -> Type -> [Con] -> GenericStrategy -> Q [Dec]
+ Indigo: data BigMap k v
+ Indigo: data Bls12381Fr
+ Indigo: data Bls12381G1
+ Indigo: data Bls12381G2
+ Indigo: data Chest
+ Indigo: data ChestKey
+ Indigo: data ContractData cp st vd
+ Indigo: data ContractView st (v :: ViewTyInfo)
+ Indigo: data DView
+ Indigo: data DViewArg
+ Indigo: data DViewDesc
+ Indigo: data DViewRet
+ Indigo: data DupableDecision a
+ Indigo: data FieldAlias (alias :: k) (p :: FieldRefTag)
+ Indigo: data FieldName (n :: Symbol) (p :: FieldRefTag)
+ Indigo: data FieldRefTag
+ Indigo: data FlattenedEntrypointsKindHiding (hiddenEntrypoints :: [Symbol])
+ Indigo: data Impossible (reason :: Symbol)
+ Indigo: data Keccak (a :: HashAlgoTag)
+ Indigo: data Never
+ Indigo: data NoErrorArg
+ Indigo: data OpenChest
+ Indigo: data OpenChestT a
+ Indigo: data ReadTicket a
+ Indigo: data SelfRef (p :: FieldRefTag)
+ Indigo: data Sha3 (a :: HashAlgoTag)
+ Indigo: data SomeEntrypointArg
+ Indigo: data Ticket arg
+ Indigo: data UnitErrorArg
+ Indigo: data View_ a r
+ Indigo: data WrappedLambda (i :: [Type]) (o :: [Type])
+ Indigo: decideOnDupable :: KnownValue a => DupableDecision a
+ Indigo: defEvalOpHs :: forall (n :: T) (m :: T) (r :: T) (s :: [T]). (DefArithOp aop, ArithOp aop n m, r ~ ArithRes aop n m) => Instr (n : (m : s)) (r : s)
+ Indigo: defUnaryArithOpHs :: forall (n :: T) (r :: T) (s :: [T]). (DefUnaryArithOp aop, UnaryArithOp aop n, r ~ UnaryArithRes aop n, DefUnaryArithOpExtraConstraints aop n) => Instr (n : s) (r : s)
+ Indigo: defaultContractData :: (NiceParameterFull cp, NiceStorageFull st) => (IsNotInView => '[(cp, st)] :-> ContractOut st) -> ContractData cp st ()
+ Indigo: deriveFullType :: Name -> Maybe Kind -> [TyVarBndr flag] -> TypeQ
+ Indigo: emit :: (HasSideEffects, NicePackedValue a, HasAnnotation a, HasCallStack) => FieldAnn -> Expr a -> IndigoM ()
+ Indigo: entryCaseFlattened :: forall cp (out :: [Type]) (inp :: [Type]) clauses. (CaseTC cp out inp clauses, DocumentEntrypoints FlattenedEntrypointsKind cp) => IsoRecTuple clauses -> (cp : inp) :-> out
+ Indigo: entryCaseFlattenedHiding :: forall (heps :: [Symbol]) cp (out :: [Type]) (inp :: [Type]) clauses. (CaseTC cp out inp clauses, DocumentEntrypoints (FlattenedEntrypointsKindHiding heps) cp, HasEntrypoints (ParameterEntrypointsDerivation cp) cp heps) => IsoRecTuple clauses -> (cp : inp) :-> out
+ Indigo: entryCaseFlattenedHiding_ :: forall (heps :: [Symbol]) cp (out :: [Type]) (inp :: [Type]). (InstrCaseC cp, RMap (CaseClauses cp), DocumentEntrypoints (FlattenedEntrypointsKindHiding heps) cp, HasEntrypoints (ParameterEntrypointsDerivation cp) cp heps) => Rec (CaseClauseL inp out) (CaseClauses cp) -> (cp : inp) :-> out
+ Indigo: entryCaseFlattened_ :: forall cp (out :: [Type]) (inp :: [Type]). (InstrCaseC cp, RMap (CaseClauses cp), DocumentEntrypoints FlattenedEntrypointsKind cp) => Rec (CaseClauseL inp out) (CaseClauses cp) -> (cp : inp) :-> out
+ Indigo: entrypointKindOverrideSpecified :: EntrypointKindHasDoc ep => Dict ((EntrypointKindOverride ep == ep) ~ 'False)
+ Indigo: errorDocArg :: QuasiQuoter
+ Indigo: evalArithOpHs :: forall (s :: [Type]). ArithOpHs aop n m r => (n : (m : s)) :-> (r : s)
+ Indigo: evalToBytesOpHs :: forall bs (s :: [Type]). (ToBytesArithOpHs n, BytesLike bs) => (n : s) :-> (bs : s)
+ Indigo: evalToIntOpHs :: forall (s :: [Type]). ToIntegerArithOpHs n => (n : s) :-> (Integer : s)
+ Indigo: evalUnaryArithOpHs :: forall (s :: [Type]). UnaryArithOpHs aop n => (n : s) :-> (UnaryArithResHs aop n : s)
+ Indigo: failCustomNoArg :: forall ret tag. (ReturnableValue ret, MustHaveErrorArg tag MText, CustomErrorHasDoc tag, HasCallStack) => Label tag -> IndigoM (RetVars ret)
+ Indigo: false :: BooleanMonoid a => a
+ Indigo: fieldNameFromLabel :: forall (n :: Symbol). Label n -> FieldSymRef n
+ Indigo: fieldNameToLabel :: forall (n :: Symbol). FieldSymRef n -> Label n
+ Indigo: fieldRefFinalName :: FieldRefHasFinalName fr => FieldRef fr -> Label (FieldRefFinalName fr)
+ Indigo: for :: (Traversable t, Applicative f) => t a -> (a -> f b) -> f (t b)
+ Indigo: fromDepthsStrategy' :: (Int -> [Natural]) -> (Int -> [Natural]) -> GenericStrategy
+ Indigo: fromIntegralMaybe :: (Integral a, Integral b, Bits a, Bits b) => a -> Maybe b
+ Indigo: fromIntegralNoOverflow :: (Integral a, Integral b) => a -> Either ArithException b
+ Indigo: fromIntegralOverflowing :: (Integral a, Num b) => a -> b
+ Indigo: fromIntegralToRealFrac :: (Integral a, RealFrac b, CheckIntSubType a Integer) => a -> b
+ Indigo: fromList :: FromList l => [ListElement l] -> l
+ Indigo: getFieldOpen :: forall dt (name :: Symbol) res (st :: [Type]). (InstrGetFieldC dt name, HasDupableGetters dt) => ('[GetFieldType dt name] :-> '[res, GetFieldType dt name]) -> ('[GetFieldType dt name] :-> '[res]) -> Label name -> (dt : st) :-> (res : (dt : st))
+ Indigo: hoistEither :: forall (m :: Type -> Type) e a. Applicative m => Either e a -> ExceptT e m a
+ Indigo: hoistMaybe :: forall (m :: Type -> Type) a. Applicative m => Maybe a -> MaybeT m a
+ Indigo: keccak :: (hashExpr :~> bs, BytesLike bs) => hashExpr -> Expr (Hash Keccak bs)
+ Indigo: lSign :: (MonadRandom m, BytesLike a) => SecretKey -> a -> m (TSignature a)
+ Indigo: level :: Expr Natural
+ Indigo: makeRightBalDepths :: Int -> [Natural]
+ Indigo: mangleGenericStrategyConstructors :: (Text -> Text) -> GenericStrategy -> GenericStrategy
+ Indigo: mangleGenericStrategyFields :: (Text -> Text) -> GenericStrategy -> GenericStrategy
+ Indigo: mkBigMap :: ToBigMap m => m -> BigMap (ToBigMapKey m) (ToBigMapValue m)
+ Indigo: mkContract :: (NiceParameterFull cp, NiceStorageFull st) => ContractCode cp st -> Contract cp st ()
+ Indigo: mkContractCode :: (IsNotInView => '[(cp, st)] :-> ContractOut st) -> ContractCode cp st
+ Indigo: mkContractWith :: (NiceParameterFull cp, NiceStorageFull st) => CompilationOptions -> ContractCode cp st -> Contract cp st ()
+ Indigo: mkFieldRef :: forall (p :: FieldRefTag). KnownFieldRef ty => FieldRefObject ty p
+ Indigo: mkLambda :: forall (i :: [Type]) (o :: [Type]). (IsNotInView => i :-> o) -> WrappedLambda i o
+ Indigo: mkLambdaRec :: forall (i :: [Type]) (o :: [Type]). (IsNotInView => (i ++ '[WrappedLambda i o]) :-> o) -> WrappedLambda i o
+ Indigo: mkView :: forall (name :: Symbol) arg ret st. (KnownSymbol name, NiceViewable arg, NiceViewable ret, HasAnnotation arg, HasAnnotation ret, TypeHasDoc arg, TypeHasDoc ret) => ViewCode arg st ret -> ContractView st ('ViewTyInfo name arg ret)
+ Indigo: naturalFromInt :: Int -> Natural
+ Indigo: newtype ApplicativeBoolean (f :: k -> Type) (bool :: k)
+ Indigo: newtype BigMapId (k2 :: k) (v :: k1)
+ Indigo: newtype ChestT a
+ Indigo: newtype ContractCode cp st
+ Indigo: noViews :: forall {k1} {k2} contract (cp :: k1) (st :: k2). contract cp st () -> contract cp st ()
+ Indigo: openChestT :: forall a (s :: [Type]). BytesLike a => (ChestKey : (ChestT a : (Natural : s))) :-> (OpenChestT a : s)
+ Indigo: or1 :: Boolean a => NonEmpty a -> a
+ Indigo: pattern EpAddress :: forall (kind :: AddressKind). () => KindedAddress kind -> EpName -> EpAddress
+ Indigo: reifyDataType :: Name -> Q (Name, Cxt, Maybe Kind, [TyVarBndr ()], [Con])
+ Indigo: renderViewsDescriptorDoc :: ViewsDescriptorHasDoc vd => Proxy vd -> Builder
+ Indigo: safeFoldl1 :: Container t => (Element t -> Element t -> Element t) -> t -> Maybe (Element t)
+ Indigo: safeFoldr1 :: Container t => (Element t -> Element t -> Element t) -> t -> Maybe (Element t)
+ Indigo: safeMaximum :: Container t => t -> Maybe (Element t)
+ Indigo: safeMinimum :: Container t => t -> Maybe (Element t)
+ Indigo: selfAddress :: Expr Address
+ Indigo: setFieldOpen :: forall dt (name :: Symbol) new (st :: [Type]). InstrSetFieldC dt name => ('[new, GetFieldType dt name] :-> '[GetFieldType dt name]) -> Label name -> (new : (dt : st)) :-> (dt : st)
+ Indigo: setViews :: forall vd cp st. (RecFromTuple (Rec (ContractView st) (RevealViews vd)), NiceViewsDescriptor vd) => IsoRecTuple (Rec (ContractView st) (RevealViews vd)) -> ContractData cp st () -> ContractData cp st vd
+ Indigo: setViewsRec :: forall vd cp st. NiceViewsDescriptor vd => Rec (ContractView st) (RevealViews vd) -> ContractData cp st () -> ContractData cp st vd
+ Indigo: sha3 :: (hashExpr :~> bs, BytesLike bs) => hashExpr -> Expr (Hash Sha3 bs)
+ Indigo: simpleFailUsing :: forall e (s :: [Type]) (t :: [Type]). IsError e => e -> s :-> t
+ Indigo: someNE :: Alternative f => f a -> f (NonEmpty a)
+ Indigo: sopGetField :: forall {k} ftype store (fname :: k) (s :: [Type]). (Dupable ftype, HasDupableGetters store) => StoreFieldOps store fname ftype -> FieldRef fname -> (store : s) :-> (ftype : (store : s))
+ Indigo: sopSetField :: forall {k} store (fname :: k) ftype (s :: [Type]). StoreFieldOps store fname ftype -> FieldRef fname -> (ftype : (store : s)) :-> (store : s)
+ Indigo: stAlias :: forall {k} (alias :: k). FieldRef (FieldAlias alias)
+ Indigo: stGetAndUpdate :: forall {k} store (mname :: k) key value (s :: [Type]). StoreHasSubmap store mname key value => FieldRef mname -> (key : (Maybe value : (store : s))) :-> (Maybe value : (store : s))
+ Indigo: stGetFieldNamed :: forall {k} store (fname :: k) ftype (s :: [Type]). (StoreHasField store fname ftype, FieldRefHasFinalName fname, Dupable ftype, HasDupableGetters store) => FieldRef fname -> (store : s) :-> ((FieldRefFinalName fname :! ftype) : (store : s))
+ Indigo: stNested :: StNestedImpl f SelfRef => f
+ Indigo: stNickname :: forall (name :: Symbol). Label name -> FieldRef (FieldAlias name)
+ Indigo: stToFieldNamed :: forall {k} store (fname :: k) ftype (s :: [Type]). (StoreHasField store fname ftype, FieldRefHasFinalName fname) => FieldRef fname -> (store : s) :-> ((FieldRefFinalName fname :! ftype) : s)
+ Indigo: this :: forall (p :: FieldRefTag). SelfRef p
+ Indigo: toMichelsonContract :: Contract cp st vd -> Contract (ToT cp) (ToT st)
+ Indigo: totalVotingPower :: Expr Natural
+ Indigo: true :: BooleanMonoid a => a
+ Indigo: type Address = Constrained NullConstraint :: AddressKind -> Constraint KindedAddress
+ Indigo: type CheckIntSubType a b = (CheckIntSubTypeErrors a b IsIntSubType a b, IsIntSubType a b ~ 'True)
+ Indigo: type CustomErrorRep (tag :: Symbol) = CustomErrorArgRep ErrorArg tag
+ Indigo: type DefUnaryArithOpExtraConstraints aop :: k n :: T = ();
+ Indigo: type Dupable a = (ProperDupableBetterErrors ToT a, KnownValue a)
+ Indigo: type EntrypointKindOverride ep = ep;
+ Indigo: type FieldAnn = Annotation FieldTag
+ Indigo: type FieldNickname (alias :: Symbol) = FieldAlias alias
+ Indigo: type FieldRef (name :: k) = FieldRefObject name 'FieldRefTag
+ Indigo: type FieldRefKind = FieldRefTag -> Type
+ Indigo: type FieldSymRef (name :: Symbol) = FieldRef name
+ Indigo: type FlattenedEntrypointsKind = FlattenedEntrypointsKindHiding '[] :: [Symbol]
+ Indigo: type Fn a b = '[a] :-> '[b]
+ Indigo: type FromListC l = ();
+ Indigo: type KeyHash = Hash 'HashKindPublicKey
+ Indigo: type ListElement l = Item l;
+ Indigo: type MustHaveErrorArg (errorTag :: Symbol) expectedArgRep = FailUnlessEqual CustomErrorRep errorTag expectedArgRep 'Text "Error argument type is " :<>: 'ShowType expectedArgRep :<>: 'Text " but given error requires argument of type " :<>: 'ShowType CustomErrorRep errorTag
+ Indigo: type NiceNoBigMap n = (KnownValue n, HasNoBigMap ToT n)
+ Indigo: type NiceStorageFull a = (NiceStorage a, HasAnnotation a)
+ Indigo: type NiceUntypedValue a = (ProperUntypedValBetterErrors ToT a, KnownValue a)
+ Indigo: type NiceViewable a = (ProperViewableBetterErrors ToT a, KnownValue a)
+ Indigo: type NiceViews (vs :: [ViewTyInfo]) = RequireAllUnique "view" ViewsNames vs
+ Indigo: type NiceViewsDescriptor vd = NiceViews RevealViews vd
+ Indigo: type Type = Type
+ Indigo: type Unwrappabled s = GUnwrappabled s Rep s;
+ Indigo: type ViewCode arg st ret = '[(arg, st)] :-> '[ret]
+ Indigo: type WellTypedToT a = (IsoValue a, WellTyped ToT a)
+ Indigo: type Word62 = OddWord Word64 One One One One One Zero ()
+ Indigo: type Word63 = OddWord Word64 One One One One One One ()
+ Indigo: typeDocBuiltMichelsonRep :: TypeHasDoc a => Proxy a -> Builder
+ Indigo: typeFieldNamingStrategy :: TypeHasFieldNamingStrategy a => Text -> Text
+ Indigo: tz :: QuasiQuoter
+ Indigo: unsafe :: (HasCallStack, Buildable a) => Either a b -> b
+ Indigo: unsafeCoerceWrap :: forall a (s :: [Type]). Unwrappable a => (Unwrappabled a : s) :-> (a : s)
+ Indigo: unsafeConcreteTypeDocHaskellRep :: (Typeable a, GenericIsoValue a, GTypeHasDoc (Rep a)) => TypeDocHaskellRep b
+ Indigo: unsafeConcreteTypeDocMichelsonRep :: forall {k} a (b :: k). (Typeable a, KnownIsoT a) => TypeDocMichelsonRep b
+ Indigo: unsafeM :: (MonadFail m, Buildable a) => Either a b -> m b
+ Indigo: unsafeUnwrap_ :: forall dt (name :: Symbol) (st :: [Type]). InstrUnwrapC dt name => Label name -> (dt : st) :-> (CtorOnlyField name dt : st)
+ Indigo: updateMVar' :: MonadIO m => MVar s -> StateT s IO a -> m a
+ Indigo: updateTVar' :: TVar s -> StateT s STM a -> STM a
+ Indigo: verifyErrorTag :: IsCustomErrorArgRep a => MText -> a -> Either Text a
+ Indigo: viewsDescriptorName :: ViewsDescriptorHasDoc vd => Proxy vd -> Text
+ Indigo: votingPower :: keyExpr :~> KeyHash => keyExpr -> Expr Natural
+ Indigo: withInstrDeconstructC :: forall a st r. InstrDeconstructCGeneral a => (InstrDeconstructCClass a st => r) -> r
+ Indigo.Backend: emit :: (HasSideEffects, NicePackedValue a, HasAnnotation a) => FieldAnn -> Expr a -> IndigoState inp inp
+ Indigo.Backend.Case: instance (name GHC.Types.~ GHC.TypeLits.AppendSymbol "c" ctor, Lorentz.Constraints.Scopes.KnownValue x) => Lorentz.ADT.CaseArrow name (Indigo.Backend.Case.IndigoClause x ret) (Indigo.Backend.Case.IndigoCaseClauseL ret ('Morley.Michelson.Typed.Haskell.Instr.Sum.CaseClauseParam ctor ('Morley.Michelson.Typed.Haskell.Instr.Sum.OneField x)))
+ Indigo.Backend.Error: failCustomNoArg :: forall tag s t. (MustHaveErrorArg tag MText, CustomErrorHasDoc tag) => Label tag -> IndigoState s t
+ Indigo.Backend.Error: never :: Expr Never -> IndigoState s t
+ Indigo.Backend.Expr.Compilation: [OnStack] :: IndigoState inp (a : inp) -> ObjManipulationRes inp a
+ Indigo.Backend.Expr.Compilation: [StillObject] :: ObjectExpr a -> ObjManipulationRes inp a
+ Indigo.Backend.Expr.Compilation: binaryOp :: KnownValue res => Expr n -> Expr m -> ((n : (m : inp)) :-> (res : inp)) -> IndigoState inp (res : inp)
+ Indigo.Backend.Expr.Compilation: binaryOpFlat :: Expr n -> Expr m -> ((n : (m : inp)) :-> inp) -> IndigoState inp inp
+ Indigo.Backend.Expr.Compilation: compileExpr :: forall a inp. Expr a -> IndigoState inp (a : inp)
+ Indigo.Backend.Expr.Compilation: data ObjManipulationRes inp a
+ Indigo.Backend.Expr.Compilation: namedToExpr :: NamedFieldObj x name -> Expr (GetFieldType x name)
+ Indigo.Backend.Expr.Compilation: nullaryOp :: KnownValue res => (inp :-> (res : inp)) -> IndigoState inp (res : inp)
+ Indigo.Backend.Expr.Compilation: nullaryOpFlat :: (inp :-> inp) -> IndigoState inp inp
+ Indigo.Backend.Expr.Compilation: runObjectManipulation :: DecomposedObjects -> ObjectManipulation x -> ObjManipulationRes inp x
+ Indigo.Backend.Expr.Compilation: ternaryOp :: KnownValue res => Expr n -> Expr m -> Expr l -> ((n : (m : (l : inp))) :-> (res : inp)) -> IndigoState inp (res : inp)
+ Indigo.Backend.Expr.Compilation: ternaryOpFlat :: Expr n -> Expr m -> Expr l -> ((n : (m : (l : inp))) :-> inp) -> IndigoState inp inp
+ Indigo.Backend.Expr.Compilation: unaryOp :: KnownValue res => Expr n -> ((n : inp) :-> (res : inp)) -> IndigoState inp (res : inp)
+ Indigo.Backend.Expr.Compilation: unaryOpFlat :: Expr n -> ((n : inp) :-> inp) -> IndigoState inp inp
+ Indigo.Backend.Expr.Decompose: [Deconstructed] :: IndigoState inp (FieldTypes a ++ inp) -> ExprDecomposition inp a
+ Indigo.Backend.Expr.Decompose: [ExprFields] :: Rec Expr (FieldTypes a) -> ExprDecomposition inp a
+ Indigo.Backend.Expr.Decompose: class IsObject' (TypeDecision a) a => IsObject a
+ Indigo.Backend.Expr.Decompose: data ExprDecomposition inp a
+ Indigo.Backend.Expr.Decompose: decomposeExpr :: ComplexObjectC a => DecomposedObjects -> Expr a -> ExprDecomposition inp a
+ Indigo.Backend.Expr.Decompose: deepDecomposeCompose :: forall a inp. IsObject a => SIS' (a : inp) (Object a)
+ Indigo.Backend.Lookup: instance Data.Type.Equality.TestEquality Indigo.Backend.Lookup.TVal
+ Indigo.Backend.Lookup: rdrop :: Sing n -> Rec any s -> Rec any (Drop n s)
+ Indigo.Backend.Lookup: rtake :: Sing n -> Rec any s -> Rec any (Take n s)
+ Indigo.Backend.Lookup: varActionGet :: forall a stk. KnownValue a => RefId -> StackVars stk -> stk :-> (a : stk)
+ Indigo.Backend.Lookup: varActionOperation :: HasSideEffects => StackVars stk -> (Operation : stk) :-> stk
+ Indigo.Backend.Lookup: varActionSet :: forall a stk. KnownValue a => RefId -> StackVars stk -> (a : stk) :-> stk
+ Indigo.Backend.Lookup: varActionUpdate :: forall a b stk. (KnownValue a, KnownValue b) => RefId -> StackVars stk -> ('[b, a] :-> '[a]) -> (b : stk) :-> stk
+ Indigo.Backend.Prelude: ApplicativeBoolean :: f bool -> ApplicativeBoolean (f :: k -> Type) (bool :: k)
+ Indigo.Backend.Prelude: [getDown] :: Down a -> a
+ Indigo.Backend.Prelude: all1 :: Boolean b => (a -> b) -> NonEmpty a -> b
+ Indigo.Backend.Prelude: and1 :: Boolean a => NonEmpty a -> a
+ Indigo.Backend.Prelude: any1 :: Boolean b => (a -> b) -> NonEmpty a -> b
+ Indigo.Backend.Prelude: class Boolean a
+ Indigo.Backend.Prelude: class Boolean a => BooleanMonoid a
+ Indigo.Backend.Prelude: class FromList l where {
+ Indigo.Backend.Prelude: false :: BooleanMonoid a => a
+ Indigo.Backend.Prelude: for :: (Traversable t, Applicative f) => t a -> (a -> f b) -> f (t b)
+ Indigo.Backend.Prelude: fromIntegralMaybe :: (Integral a, Integral b, Bits a, Bits b) => a -> Maybe b
+ Indigo.Backend.Prelude: fromIntegralNoOverflow :: (Integral a, Integral b) => a -> Either ArithException b
+ Indigo.Backend.Prelude: fromIntegralOverflowing :: (Integral a, Num b) => a -> b
+ Indigo.Backend.Prelude: fromIntegralToRealFrac :: (Integral a, RealFrac b, CheckIntSubType a Integer) => a -> b
+ Indigo.Backend.Prelude: fromList :: FromList l => [ListElement l] -> l
+ Indigo.Backend.Prelude: hoistEither :: forall (m :: Type -> Type) e a. Applicative m => Either e a -> ExceptT e m a
+ Indigo.Backend.Prelude: hoistMaybe :: forall (m :: Type -> Type) a. Applicative m => Maybe a -> MaybeT m a
+ Indigo.Backend.Prelude: naturalFromInt :: Int -> Natural
+ Indigo.Backend.Prelude: newtype ApplicativeBoolean (f :: k -> Type) (bool :: k)
+ Indigo.Backend.Prelude: or1 :: Boolean a => NonEmpty a -> a
+ Indigo.Backend.Prelude: safeFoldl1 :: Container t => (Element t -> Element t -> Element t) -> t -> Maybe (Element t)
+ Indigo.Backend.Prelude: safeFoldr1 :: Container t => (Element t -> Element t -> Element t) -> t -> Maybe (Element t)
+ Indigo.Backend.Prelude: safeMaximum :: Container t => t -> Maybe (Element t)
+ Indigo.Backend.Prelude: safeMinimum :: Container t => t -> Maybe (Element t)
+ Indigo.Backend.Prelude: someNE :: Alternative f => f a -> f (NonEmpty a)
+ Indigo.Backend.Prelude: true :: BooleanMonoid a => a
+ Indigo.Backend.Prelude: type CheckIntSubType a b = (CheckIntSubTypeErrors a b IsIntSubType a b, IsIntSubType a b ~ 'True)
+ Indigo.Backend.Prelude: type FromListC l = ();
+ Indigo.Backend.Prelude: type ListElement l = Item l;
+ Indigo.Backend.Prelude: type Type = Type
+ Indigo.Backend.Prelude: type Word62 = OddWord Word64 One One One One One Zero ()
+ Indigo.Backend.Prelude: type Word63 = OddWord Word64 One One One One One One ()
+ Indigo.Backend.Prelude: unsafe :: (HasCallStack, Buildable a) => Either a b -> b
+ Indigo.Backend.Prelude: unsafeM :: (MonadFail m, Buildable a) => Either a b -> m b
+ Indigo.Backend.Prelude: updateMVar' :: MonadIO m => MVar s -> StateT s IO a -> m a
+ Indigo.Backend.Prelude: updateTVar' :: TVar s -> StateT s STM a -> STM a
+ Indigo.Common.Expr: [Abs] :: (UnaryArithOpHs Abs n, KnownValue (UnaryArithResHs Abs n)) => Expr n -> Expr (UnaryArithResHs Abs n)
+ Indigo.Common.Expr: [Add] :: (ArithOpHs Add n m r, KnownValue r) => Expr n -> Expr m -> Expr r
+ Indigo.Common.Expr: [Amount] :: Expr Mutez
+ Indigo.Common.Expr: [And] :: (ArithOpHs And n m r, KnownValue r) => Expr n -> Expr m -> Expr r
+ Indigo.Common.Expr: [Balance] :: Expr Mutez
+ Indigo.Common.Expr: [Blake2b] :: BytesLike bs => Expr bs -> Expr (Hash Blake2b bs)
+ Indigo.Common.Expr: [C] :: NiceConstant a => a -> Expr a
+ Indigo.Common.Expr: [Cast] :: KnownValue a => Expr a -> Expr a
+ Indigo.Common.Expr: [ChainId] :: Expr ChainId
+ Indigo.Common.Expr: [CheckSignature] :: BytesLike bs => Expr PublicKey -> Expr (TSignature bs) -> Expr bs -> Expr Bool
+ Indigo.Common.Expr: [Coerce] :: (Castable_ a b, KnownValue b) => Expr a -> Expr b
+ Indigo.Common.Expr: [Concat'] :: (ConcatOpHs c, KnownValue c) => Expr (List c) -> Expr c
+ Indigo.Common.Expr: [Concat] :: (ConcatOpHs c, KnownValue c) => Expr c -> Expr c -> Expr c
+ Indigo.Common.Expr: [Cons] :: KnownValue (List a) => Expr a -> Expr (List a) -> Expr (List a)
+ Indigo.Common.Expr: [ConstructWithoutNamed] :: ComplexObjectC dt => Proxy dt -> Rec Expr (FieldTypes dt) -> Expr dt
+ Indigo.Common.Expr: [Construct] :: (InstrConstructC dt, RMap (ConstructorFieldTypes dt), RecordToList (ConstructorFieldTypes dt), KnownValue dt) => Proxy dt -> Rec Expr (ConstructorFieldTypes dt) -> Expr dt
+ Indigo.Common.Expr: [ContractAddress] :: Expr (ContractRef p) -> Expr Address
+ Indigo.Common.Expr: [ContractCallingUnsafe] :: (NiceParameter arg, IsoValue (ContractRef arg)) => EpName -> Expr Address -> Expr (Maybe (ContractRef arg))
+ Indigo.Common.Expr: [Contract] :: (NiceParameterFull p, NoExplicitDefaultEntrypoint p, IsoValue (ContractRef p), ToTAddress p vd addr, ToT addr ~ ToT Address) => Proxy vd -> Expr addr -> Expr (Maybe (ContractRef p))
+ Indigo.Common.Expr: [ConvertEpAddressToContract] :: (NiceParameter p, IsoValue (ContractRef p)) => Expr EpAddress -> Expr (Maybe (ContractRef p))
+ Indigo.Common.Expr: [Div] :: (KnownValue ratio, ArithOpHs EDiv n m (Maybe (ratio, reminder))) => Expr n -> Expr m -> Proxy reminder -> Expr ratio
+ Indigo.Common.Expr: [EmptyBigMap] :: (KnownValue value, NiceComparable key, KnownValue (BigMap key value)) => Expr (BigMap key value)
+ Indigo.Common.Expr: [EmptyMap] :: (KnownValue value, NiceComparable key, KnownValue (Map key value)) => Expr (Map key value)
+ Indigo.Common.Expr: [EmptySet] :: (NiceComparable key, KnownValue (Set key)) => Expr (Set key)
+ Indigo.Common.Expr: [Eq'] :: NiceComparable n => Expr n -> Expr n -> Expr Bool
+ Indigo.Common.Expr: [Exec] :: KnownValue b => Expr a -> Expr (Lambda a b) -> Expr b
+ Indigo.Common.Expr: [ForcedCoerce] :: (MichelsonCoercible a b, KnownValue b) => Expr a -> Expr b
+ Indigo.Common.Expr: [Fst] :: KnownValue n => Expr (n, m) -> Expr n
+ Indigo.Common.Expr: [Ge] :: NiceComparable n => Expr n -> Expr n -> Expr Bool
+ Indigo.Common.Expr: [Get] :: (GetOpHs c, KnownValue (Maybe (GetOpValHs c)), KnownValue (GetOpValHs c)) => Expr (GetOpKeyHs c) -> Expr c -> Expr (Maybe (GetOpValHs c))
+ Indigo.Common.Expr: [Gt] :: NiceComparable n => Expr n -> Expr n -> Expr Bool
+ Indigo.Common.Expr: [HashKey] :: Expr PublicKey -> Expr KeyHash
+ Indigo.Common.Expr: [ImplicitAccount] :: Expr KeyHash -> Expr (ContractRef ())
+ Indigo.Common.Expr: [Int'] :: Expr Natural -> Expr Integer
+ Indigo.Common.Expr: [IsNat] :: Expr Integer -> Expr (Maybe Natural)
+ Indigo.Common.Expr: [Keccak] :: BytesLike bs => Expr bs -> Expr (Hash Keccak bs)
+ Indigo.Common.Expr: [Le] :: NiceComparable n => Expr n -> Expr n -> Expr Bool
+ Indigo.Common.Expr: [Left'] :: (KnownValue x, KnownValue (Either y x)) => Expr y -> Expr (Either y x)
+ Indigo.Common.Expr: [Level] :: Expr Natural
+ Indigo.Common.Expr: [Lsl] :: (ArithOpHs Lsl n m r, KnownValue r) => Expr n -> Expr m -> Expr r
+ Indigo.Common.Expr: [Lsr] :: (ArithOpHs Lsr n m r, KnownValue r) => Expr n -> Expr m -> Expr r
+ Indigo.Common.Expr: [Lt] :: NiceComparable n => Expr n -> Expr n -> Expr Bool
+ Indigo.Common.Expr: [MakeView] :: KnownValue (View_ a r) => Expr a -> Expr (ContractRef r) -> Expr (View_ a r)
+ Indigo.Common.Expr: [MakeVoid] :: KnownValue (Void_ a b) => Expr a -> Expr (Lambda b b) -> Expr (Void_ a b)
+ Indigo.Common.Expr: [Mem] :: MemOpHs c => Expr (MemOpKeyHs c) -> Expr c -> Expr Bool
+ Indigo.Common.Expr: [Mod] :: (KnownValue reminder, ArithOpHs EDiv n m (Maybe (ratio, reminder))) => Expr n -> Expr m -> Proxy ratio -> Expr reminder
+ Indigo.Common.Expr: [Mul] :: (ArithOpHs Mul n m r, KnownValue r) => Expr n -> Expr m -> Expr r
+ Indigo.Common.Expr: [Name] :: KnownValue (name :! t) => Label name -> Expr t -> Expr (name :! t)
+ Indigo.Common.Expr: [NamedFieldExpr] :: {unNamedFieldExpr :: Expr (GetFieldType a name)} -> NamedFieldExpr a name
+ Indigo.Common.Expr: [Neg] :: (UnaryArithOpHs Neg n, KnownValue (UnaryArithResHs Neg n)) => Expr n -> Expr (UnaryArithResHs Neg n)
+ Indigo.Common.Expr: [Neq] :: NiceComparable n => Expr n -> Expr n -> Expr Bool
+ Indigo.Common.Expr: [Nil] :: KnownValue a => Expr (List a)
+ Indigo.Common.Expr: [NonZero] :: (NonZero n, KnownValue (Maybe n)) => Expr n -> Expr (Maybe n)
+ Indigo.Common.Expr: [None] :: KnownValue t => Expr (Maybe t)
+ Indigo.Common.Expr: [Not] :: (UnaryArithOpHs Not n, KnownValue (UnaryArithResHs Not n)) => Expr n -> Expr (UnaryArithResHs Not n)
+ Indigo.Common.Expr: [Now] :: Expr Timestamp
+ Indigo.Common.Expr: [ObjMan] :: ObjectManipulation a -> Expr a
+ Indigo.Common.Expr: [Object] :: Expr a -> ObjectManipulation a
+ Indigo.Common.Expr: [Or] :: (ArithOpHs Or n m r, KnownValue r) => Expr n -> Expr m -> Expr r
+ Indigo.Common.Expr: [PackRaw] :: NicePackedValue a => Expr a -> Expr ByteString
+ Indigo.Common.Expr: [Pack] :: NicePackedValue a => Expr a -> Expr (Packed a)
+ Indigo.Common.Expr: [Pair] :: KnownValue (n, m) => Expr n -> Expr m -> Expr (n, m)
+ Indigo.Common.Expr: [Right'] :: (KnownValue y, KnownValue (Either y x)) => Expr x -> Expr (Either y x)
+ Indigo.Common.Expr: [RunFutureContract] :: (NiceParameter p, IsoValue (ContractRef p)) => Expr (FutureContract p) -> Expr (Maybe (ContractRef p))
+ Indigo.Common.Expr: [SelfAddress] :: Expr Address
+ Indigo.Common.Expr: [Self] :: (NiceParameterFull p, NoExplicitDefaultEntrypoint p, IsoValue (ContractRef p), IsNotInView) => Expr (ContractRef p)
+ Indigo.Common.Expr: [Sender] :: Expr Address
+ Indigo.Common.Expr: [SetField] :: HasField dt fname ftype => ObjectManipulation dt -> Label fname -> Expr ftype -> ObjectManipulation dt
+ Indigo.Common.Expr: [Sha256] :: BytesLike bs => Expr bs -> Expr (Hash Sha256 bs)
+ Indigo.Common.Expr: [Sha3] :: BytesLike bs => Expr bs -> Expr (Hash Sha3 bs)
+ Indigo.Common.Expr: [Sha512] :: BytesLike bs => Expr bs -> Expr (Hash Sha512 bs)
+ Indigo.Common.Expr: [Size] :: SizeOpHs c => Expr c -> Expr Natural
+ Indigo.Common.Expr: [Slice] :: (SliceOpHs c, KnownValue c) => Expr Natural -> Expr Natural -> Expr c -> Expr (Maybe c)
+ Indigo.Common.Expr: [Snd] :: KnownValue m => Expr (n, m) -> Expr m
+ Indigo.Common.Expr: [Some] :: KnownValue (Maybe t) => Expr t -> Expr (Maybe t)
+ Indigo.Common.Expr: [StDelete] :: (StoreHasSubmap store name key val, KnownValue store, KnownValue val) => Label name -> Expr key -> Expr store -> Expr store
+ Indigo.Common.Expr: [StGet] :: (StoreHasSubmap store name key value, KnownValue value) => Label name -> Expr key -> Expr store -> Expr (Maybe value)
+ Indigo.Common.Expr: [StInsertNew] :: (StoreHasSubmap store name key value, KnownValue store, Dupable key, IsError err, Buildable err) => Label name -> err -> Expr key -> Expr value -> Expr store -> Expr store
+ Indigo.Common.Expr: [StInsert] :: (StoreHasSubmap store name key value, KnownValue store) => Label name -> Expr key -> Expr value -> Expr store -> Expr store
+ Indigo.Common.Expr: [StMem] :: (StoreHasSubmap store name key val, KnownValue val) => Label name -> Expr key -> Expr store -> Expr Bool
+ Indigo.Common.Expr: [StUpdate] :: (StoreHasSubmap store name key val, KnownValue store) => Label name -> Expr key -> Expr (Maybe val) -> Expr store -> Expr store
+ Indigo.Common.Expr: [Sub] :: (ArithOpHs Sub n m r, KnownValue r) => Expr n -> Expr m -> Expr r
+ Indigo.Common.Expr: [ToField] :: HasField dt fname ftype => ObjectManipulation dt -> Label fname -> ObjectManipulation ftype
+ Indigo.Common.Expr: [TotalVotingPower] :: Expr Natural
+ Indigo.Common.Expr: [UnName] :: KnownValue t => Label name -> Expr (name :! t) -> Expr t
+ Indigo.Common.Expr: [UnpackRaw] :: NiceUnpackedValue a => Expr ByteString -> Expr (Maybe a)
+ Indigo.Common.Expr: [Unpack] :: NiceUnpackedValue a => Expr (Packed a) -> Expr (Maybe a)
+ Indigo.Common.Expr: [Unwrap] :: (InstrUnwrapC dt name, KnownValue (CtorOnlyField name dt)) => Label name -> Expr dt -> Expr (CtorOnlyField name dt)
+ Indigo.Common.Expr: [Update] :: (UpdOpHs c, KnownValue c) => Expr c -> Expr (UpdOpKeyHs c) -> Expr (UpdOpParamsHs c) -> Expr c
+ Indigo.Common.Expr: [V] :: KnownValue a => Var a -> Expr a
+ Indigo.Common.Expr: [VotingPower] :: Expr KeyHash -> Expr Natural
+ Indigo.Common.Expr: [Wrap] :: (InstrWrapOneC dt name, KnownValue dt) => Label name -> Expr (CtorOnlyField name dt) -> Expr dt
+ Indigo.Common.Expr: [Xor] :: (ArithOpHs Xor n m r, KnownValue r) => Expr n -> Expr m -> Expr r
+ Indigo.Common.Expr: class ToExpr' (Decide x) x => ToExpr x
+ Indigo.Common.Expr: data Expr a
+ Indigo.Common.Expr: data NamedFieldExpr a name
+ Indigo.Common.Expr: data ObjectManipulation a
+ Indigo.Common.Expr: instance Formatting.Buildable.Buildable (Indigo.Common.Expr.Expr a)
+ Indigo.Common.Expr: instance Formatting.Buildable.Buildable (Indigo.Common.Expr.ObjectManipulation a)
+ Indigo.Common.Expr: instance Indigo.Common.Expr.ToExpr' 'Indigo.Common.Expr.ExprD (Indigo.Common.Expr.Expr a)
+ Indigo.Common.Expr: instance Indigo.Common.Expr.ToExpr' 'Indigo.Common.Expr.ObjManD (Indigo.Common.Expr.ObjectManipulation a)
+ Indigo.Common.Expr: instance Indigo.Common.Expr.ToExpr' (Indigo.Common.Expr.Decide x) x => Indigo.Common.Expr.ToExpr x
+ Indigo.Common.Expr: instance Lorentz.Constraints.Scopes.KnownValue a => Indigo.Common.Expr.ToExpr' 'Indigo.Common.Expr.VarD (Indigo.Common.Var.Var a)
+ Indigo.Common.Expr: instance Lorentz.Constraints.Scopes.NiceConstant a => Indigo.Common.Expr.ToExpr' 'Indigo.Common.Expr.ValD a
+ Indigo.Common.Expr: toExpr :: forall a. ToExpr a => a -> Expr (ExprType a)
+ Indigo.Common.Expr: type (:~>) op n = IsExpr op n
+ Indigo.Common.Expr: type ExprType a = ExprType' (Decide a) a
+ Indigo.Common.Expr: type IsArithExpr exN exM a n m r = (exN :~> n, exM :~> m, ArithOpHs a n m r, KnownValue r)
+ Indigo.Common.Expr: type IsConcatExpr exN1 exN2 n = (exN1 :~> n, exN2 :~> n, ConcatOpHs n)
+ Indigo.Common.Expr: type IsConcatListExpr exN n = (exN :~> List n, ConcatOpHs n, KnownValue n)
+ Indigo.Common.Expr: type IsDivExpr exN exM n m ratio reminder = (exN :~> n, exM :~> m, KnownValue ratio, ArithOpHs EDiv n m (Maybe (ratio, reminder)))
+ Indigo.Common.Expr: type IsExpr op n = (ToExpr op, ExprType op ~ n, KnownValue n)
+ Indigo.Common.Expr: type IsGetExpr exKey exMap map = (exKey :~> GetOpKeyHs map, exMap :~> map, GetOpHs map, KnownValue (GetOpValHs map))
+ Indigo.Common.Expr: type IsMemExpr exKey exN n = (exKey :~> MemOpKeyHs n, exN :~> n, MemOpHs n)
+ Indigo.Common.Expr: type IsModExpr exN exM n m ratio reminder = (exN :~> n, exM :~> m, KnownValue reminder, ArithOpHs EDiv n m (Maybe (ratio, reminder)))
+ Indigo.Common.Expr: type IsSizeExpr exN n = (exN :~> n, SizeOpHs n)
+ Indigo.Common.Expr: type IsSliceExpr exN n = (exN :~> n, SliceOpHs n)
+ Indigo.Common.Expr: type IsUnaryArithExpr exN a n = (exN :~> n, UnaryArithOpHs a n, KnownValue (UnaryArithResHs a n))
+ Indigo.Common.Expr: type IsUpdExpr exKey exVal exMap map = (exKey :~> UpdOpKeyHs map, exVal :~> UpdOpParamsHs map, exMap :~> map, UpdOpHs map)
+ Indigo.Common.Expr: type ObjectExpr a = IndigoObjectF (NamedFieldExpr a) a
+ Indigo.Common.Expr.TH: deriveExprBuildable :: Name -> Q [Dec]
+ Indigo.Common.Field: [DeeperField] :: (AccessFieldC dt fname, InstrSetFieldC dt fname, HasField (GetFieldType dt fname) targetFName targetFType) => Label fname -> StoreFieldOps dt targetFName targetFType -> FieldLens dt targetFName targetFType
+ Indigo.Common.Field: [TargetField] :: (InstrGetFieldC dt fname, InstrSetFieldC dt fname, GetFieldType dt fname ~ targetFType, AccessFieldC dt fname) => Label fname -> StoreFieldOps dt targetFName targetFType -> FieldLens dt targetFName targetFType
+ Indigo.Common.Field: assignField :: forall a name f proxy. AccessFieldC a name => proxy name -> f name -> Rec f (ConstructorFieldNames a) -> Rec f (ConstructorFieldNames a)
+ Indigo.Common.Field: class (KnownValue ftype, KnownValue dt) => HasField dt fname ftype | dt fname -> ftype
+ Indigo.Common.Field: data FieldLens dt fname ftype
+ Indigo.Common.Field: fetchField :: forall a name f proxy. AccessFieldC a name => proxy name -> Rec f (ConstructorFieldNames a) -> f name
+ Indigo.Common.Field: fieldLens :: HasField dt fname ftype => FieldLens dt fname ftype
+ Indigo.Common.Field: fieldLensADT :: forall dt targetFName targetFType fname. (InstrGetFieldC dt fname, InstrSetFieldC dt fname, GetFieldType dt fname ~ targetFType, AccessFieldC dt fname) => Label fname -> FieldLens dt targetFName targetFType
+ Indigo.Common.Field: fieldLensDeeper :: forall dt targetName targetType fname. (AccessFieldC dt fname, HasFieldOfType dt fname (GetFieldType dt fname), HasDupableGetters (GetFieldType dt fname), HasField (GetFieldType dt fname) targetName targetType) => Label fname -> FieldLens dt targetName targetType
+ Indigo.Common.Field: flSFO :: FieldLens dt fname ftype -> StoreFieldOps dt fname ftype
+ Indigo.Common.Field: instance (Morley.Michelson.Typed.Haskell.Instr.Product.InstrSetFieldC dt fname, Morley.Michelson.Typed.Haskell.Instr.Product.InstrGetFieldC dt fname, Morley.Michelson.Typed.Haskell.Instr.Product.GetFieldType dt fname GHC.Types.~ ftype, Indigo.Common.Field.AccessFieldC dt fname, GHC.TypeLits.KnownSymbol fname, Lorentz.Constraints.Scopes.KnownValue ftype, Lorentz.Constraints.Scopes.KnownValue dt) => Indigo.Common.Field.HasField dt fname ftype
+ Indigo.Common.Field: type AccessFieldC a name = RElem name (ConstructorFieldNames a) (RIndex name (ConstructorFieldNames a))
+ Indigo.Common.Object: [Cell] :: KnownValue a => RefId -> IndigoObjectF f a
+ Indigo.Common.Object: [Decomposed] :: ComplexObjectC a => Rec f (ConstructorFieldNames a) -> IndigoObjectF f a
+ Indigo.Common.Object: [NamedFieldObj] :: IsObject (GetFieldType a name) => {unFieldObj :: Object (GetFieldType a name)} -> NamedFieldObj a name
+ Indigo.Common.Object: [SomeObject] :: IsObject a => Object a -> SomeObject
+ Indigo.Common.Object: [TypedFieldObj] :: IsObject a => Object a -> TypedFieldObj a
+ Indigo.Common.Object: castFieldConstructors :: forall a st. CastFieldConstructors (FieldTypes a) (ConstructorFieldTypes a) => Rec (FieldConstructor st) (FieldTypes a) -> Rec (FieldConstructor st) (ConstructorFieldTypes a)
+ Indigo.Common.Object: class IsObject' (TypeDecision a) a => IsObject a
+ Indigo.Common.Object: complexObjectDict :: forall a. IsObject a => Maybe (Dict (ComplexObjectC a))
+ Indigo.Common.Object: data IndigoObjectF f a
+ Indigo.Common.Object: data NamedFieldObj a name
+ Indigo.Common.Object: data SomeObject
+ Indigo.Common.Object: data TypedFieldObj a
+ Indigo.Common.Object: instance (forall (st :: [*]). Indigo.Common.Object.InstrDeconstructCClass a st) => Indigo.Common.Object.InstrDeconstructCGeneral a
+ Indigo.Common.Object: instance Indigo.Common.Object.ComplexObjectC a => Indigo.Common.Object.IsObject' 'Indigo.Common.Object.ProductTypeD a
+ Indigo.Common.Object: instance Indigo.Common.Object.InstrDeconstructCClassConstraint a st => Indigo.Common.Object.InstrDeconstructCClass a st
+ Indigo.Common.Object: instance Indigo.Common.Object.IsObject' (Indigo.Common.Object.TypeDecision a) a => Indigo.Common.Object.IsObject a
+ Indigo.Common.Object: instance Lorentz.Constraints.Scopes.KnownValue a => Indigo.Common.Object.IsObject' 'Indigo.Common.Object.PrimitiveD a
+ Indigo.Common.Object: instance Lorentz.Constraints.Scopes.KnownValue a => Indigo.Common.Object.IsObject' 'Indigo.Common.Object.SumTypeD a
+ Indigo.Common.Object: namedToTypedFieldObj :: forall a name. NamedFieldObj a name -> TypedFieldObj (GetFieldType a name)
+ Indigo.Common.Object: namedToTypedRec :: forall a f g. (forall name. f name -> g (GetFieldType a name)) -> Rec f (ConstructorFieldNames a) -> Rec g (FieldTypes a)
+ Indigo.Common.Object: type ComplexObjectC a = (ToDeconstructC a, ToConstructC a, AllConstrained IsObject (FieldTypes a), RecordToList (FieldTypes a))
+ Indigo.Common.Object: type FieldTypes a = MapGFT a (ConstructorFieldNames a)
+ Indigo.Common.Object: type Object a = IndigoObjectF (NamedFieldObj a) a
+ Indigo.Common.Object: typedToNamedFieldObj :: forall a name. TypedFieldObj (GetFieldType a name) -> NamedFieldObj a name
+ Indigo.Common.Object: typedToNamedRec :: forall a f g. KnownList (ConstructorFieldNames a) => (forall name. f (GetFieldType a name) -> g name) -> Rec f (FieldTypes a) -> Rec g (ConstructorFieldNames a)
+ Indigo.Common.Object: withInstrDeconstructC :: forall a st r. InstrDeconstructCGeneral a => (InstrDeconstructCClass a st => r) -> r
+ Indigo.Common.SIS: SomeIndigoState :: (MetaData inp -> SomeGenCode inp) -> SomeIndigoState inp
+ Indigo.Common.SIS: [SomeGenCode] :: GenCode inp out -> SomeGenCode inp
+ Indigo.Common.SIS: [unSIS] :: SomeIndigoState inp -> MetaData inp -> SomeGenCode inp
+ Indigo.Common.SIS: data SomeGenCode inp
+ Indigo.Common.SIS: newtype SomeIndigoState inp
+ Indigo.Common.SIS: overSIS :: (forall out. GenCode inp out -> SomeGenCode inp) -> SomeIndigoState inp -> SomeIndigoState inp
+ Indigo.Common.SIS: runSIS :: SomeIndigoState inp -> MetaData inp -> (forall out. GenCode inp out -> r) -> r
+ Indigo.Common.SIS: thenSIS :: SomeIndigoState inp -> (forall out. SomeIndigoState out) -> SomeIndigoState inp
+ Indigo.Common.SIS: toSIS :: IndigoState inp out -> SomeIndigoState inp
+ Indigo.Common.State: (##) :: (a :-> b) -> (b :-> c) -> a :-> c
+ Indigo.Common.State: (<$>) :: Functor f => (a -> b) -> f a -> f b
+ Indigo.Common.State: (>>) :: IndigoState inp out -> IndigoState out out1 -> IndigoState inp out1
+ Indigo.Common.State: GenCode :: ~StackVars out -> (inp :-> out) -> (out :-> inp) -> GenCode inp out
+ Indigo.Common.State: GenCodeHooks :: (forall inp out. Text -> (inp :-> out) -> inp :-> out) -> (forall inp out. Text -> (inp :-> out) -> inp :-> out) -> (forall inp out. Text -> (inp :-> out) -> inp :-> out) -> GenCodeHooks
+ Indigo.Common.State: IndigoState :: (MetaData inp -> GenCode inp out) -> IndigoState inp out
+ Indigo.Common.State: MetaData :: StackVars inp -> DecomposedObjects -> GenCodeHooks -> MetaData inp
+ Indigo.Common.State: [gcClear] :: GenCode inp out -> out :-> inp
+ Indigo.Common.State: [gcCode] :: GenCode inp out -> inp :-> out
+ Indigo.Common.State: [gcStack] :: GenCode inp out -> ~StackVars out
+ Indigo.Common.State: [gchAuxiliaryHook] :: GenCodeHooks -> forall inp out. Text -> (inp :-> out) -> inp :-> out
+ Indigo.Common.State: [gchExprHook] :: GenCodeHooks -> forall inp out. Text -> (inp :-> out) -> inp :-> out
+ Indigo.Common.State: [gchStmtHook] :: GenCodeHooks -> forall inp out. Text -> (inp :-> out) -> inp :-> out
+ Indigo.Common.State: [mdHooks] :: MetaData inp -> GenCodeHooks
+ Indigo.Common.State: [mdObjects] :: MetaData inp -> DecomposedObjects
+ Indigo.Common.State: [mdStack] :: MetaData inp -> StackVars inp
+ Indigo.Common.State: [runIndigoState] :: IndigoState inp out -> MetaData inp -> GenCode inp out
+ Indigo.Common.State: alterStkMd :: MetaData inp -> (StackVars inp -> StackVars inp1) -> MetaData inp1
+ Indigo.Common.State: assignTopVar :: KnownValue x => Var x -> IndigoState (x : inp) (x : inp)
+ Indigo.Common.State: auxiliaryHook :: forall inp out any. MetaData any -> Text -> (inp :-> out) -> inp :-> out
+ Indigo.Common.State: auxiliaryHookState :: Text -> IndigoState inp out -> IndigoState inp out
+ Indigo.Common.State: cleanGenCode :: GenCode inp out -> inp :-> inp
+ Indigo.Common.State: data GenCode inp out
+ Indigo.Common.State: data GenCodeHooks
+ Indigo.Common.State: data MetaData inp
+ Indigo.Common.State: emptyGenCodeHooks :: GenCodeHooks
+ Indigo.Common.State: exprHook :: forall inp out any. MetaData any -> Text -> (inp :-> out) -> inp :-> out
+ Indigo.Common.State: exprHookState :: Text -> IndigoState inp out -> IndigoState inp out
+ Indigo.Common.State: infixl 4 <$>
+ Indigo.Common.State: instance GHC.Base.Monoid Indigo.Common.State.GenCodeHooks
+ Indigo.Common.State: instance GHC.Base.Semigroup Indigo.Common.State.GenCodeHooks
+ Indigo.Common.State: iput :: GenCode inp out -> IndigoState inp out
+ Indigo.Common.State: newtype IndigoState inp out
+ Indigo.Common.State: nopState :: IndigoState inp inp
+ Indigo.Common.State: popNoRefMd :: MetaData (a : inp) -> MetaData inp
+ Indigo.Common.State: pushNoRefMd :: KnownValue a => MetaData inp -> MetaData (a : inp)
+ Indigo.Common.State: pushRefMd :: KnownValue a => Var a -> MetaData inp -> MetaData (a : inp)
+ Indigo.Common.State: replStkMd :: MetaData inp -> StackVars inp1 -> MetaData inp1
+ Indigo.Common.State: stmtHook :: forall inp out any. MetaData any -> Text -> (inp :-> out) -> inp :-> out
+ Indigo.Common.State: stmtHookState :: Text -> IndigoState inp out -> IndigoState inp out
+ Indigo.Common.State: type DecomposedObjects = Map RefId SomeObject
+ Indigo.Common.State: usingIndigoState :: MetaData inp -> IndigoState inp out -> GenCode inp out
+ Indigo.Common.State: withObject :: forall a r. KnownValue a => DecomposedObjects -> Var a -> (Object a -> r) -> r
+ Indigo.Common.State: withObjectState :: forall a inp out. KnownValue a => Var a -> (Object a -> IndigoState inp out) -> IndigoState inp out
+ Indigo.Common.State: withStackVars :: (StackVars inp -> IndigoState inp out) -> IndigoState inp out
+ Indigo.Common.Var: Var :: RefId -> Var a
+ Indigo.Common.Var: [FailureStack] :: StackVars stk
+ Indigo.Common.Var: [NoRef] :: (KnownValue a, KnownIsoT a) => StkEl a
+ Indigo.Common.Var: [Ref] :: (KnownValue a, KnownIsoT a) => RefId -> StkEl a
+ Indigo.Common.Var: [StkElements] :: Rec StkEl stk -> StackVars stk
+ Indigo.Common.Var: assignVarAt :: (KnownValue a, a ~ At n inp, RequireLongerThan inp n) => Var a -> StackVars inp -> Sing n -> StackVars inp
+ Indigo.Common.Var: data RefId
+ Indigo.Common.Var: data StackVars (stk :: [Type])
+ Indigo.Common.Var: data StkEl a
+ Indigo.Common.Var: data Var a
+ Indigo.Common.Var: emptyStack :: StackVars '[]
+ Indigo.Common.Var: instance (Lorentz.Constraints.Scopes.KnownValue x, Data.Default.Class.Default (Indigo.Common.Var.StackVars xs)) => Data.Default.Class.Default (Indigo.Common.Var.StackVars (x : xs))
+ Indigo.Common.Var: instance Data.Default.Class.Default (Indigo.Common.Var.StackVars '[])
+ Indigo.Common.Var: instance Data.Type.Equality.TestEquality Indigo.Common.Var.StkEl
+ Indigo.Common.Var: instance Formatting.Buildable.Buildable Indigo.Common.Var.RefId
+ Indigo.Common.Var: instance GHC.Classes.Eq Indigo.Common.Var.RefId
+ Indigo.Common.Var: instance GHC.Classes.Ord Indigo.Common.Var.RefId
+ Indigo.Common.Var: instance GHC.Enum.Bounded Indigo.Common.Var.RefId
+ Indigo.Common.Var: instance GHC.Enum.Enum Indigo.Common.Var.RefId
+ Indigo.Common.Var: instance GHC.Generics.Generic Indigo.Common.Var.RefId
+ Indigo.Common.Var: instance GHC.Num.Num Indigo.Common.Var.RefId
+ Indigo.Common.Var: instance GHC.Real.Integral Indigo.Common.Var.RefId
+ Indigo.Common.Var: instance GHC.Real.Real Indigo.Common.Var.RefId
+ Indigo.Common.Var: instance GHC.Show.Show Indigo.Common.Var.RefId
+ Indigo.Common.Var: instance forall k (a :: k). Formatting.Buildable.Buildable (Indigo.Common.Var.Var a)
+ Indigo.Common.Var: instance forall k (a :: k). GHC.Generics.Generic (Indigo.Common.Var.Var a)
+ Indigo.Common.Var: instance forall k (a :: k). GHC.Show.Show (Indigo.Common.Var.Var a)
+ Indigo.Common.Var: operationsVar :: HasSideEffects => Var Ops
+ Indigo.Common.Var: popNoRef :: StackVars (a : inp) -> StackVars inp
+ Indigo.Common.Var: pushNoRef :: KnownValue a => StackVars inp -> StackVars (a : inp)
+ Indigo.Common.Var: pushRef :: KnownValue a => Var a -> StackVars inp -> StackVars (a : inp)
+ Indigo.Common.Var: storageVar :: HasStorage st => Var st
+ Indigo.Common.Var: type HasSideEffects = Given (Var Ops)
+ Indigo.Common.Var: type HasStorage st = (Given (Var st), KnownValue st)
+ Indigo.Common.Var: type Ops = [Operation]
+ Indigo.Common.Var: type StackVars' stk = Rec StkEl stk
+ Indigo.Compilation.Sequential: [Emit] :: (HasSideEffects, NicePackedValue a, HasAnnotation a) => FieldAnn -> Expr a -> Instruction
+ Indigo.Compilation.Sequential.Types: InstrCollector :: RefId -> Block -> SequentialHooks -> InstrCollector
+ Indigo.Compilation.Sequential.Types: SequentialHooks :: (CallStack -> Block -> State InstrCollector ()) -> SequentialHooks
+ Indigo.Compilation.Sequential.Types: [AssignVar] :: KnownValue x => Var x -> Expr x -> Instruction
+ Indigo.Compilation.Sequential.Types: [CaseBranch] :: (KnownValue x, ScopeCodeGen retBr, ret ~ RetExprs retBr, RetOutStack ret ~ RetOutStack retBr) => Var x -> Block -> retBr -> CaseBranch x ret
+ Indigo.Compilation.Sequential.Types: [Case] :: CaseCommon dt ret clauses => Expr dt -> clauses -> RetVars ret -> Instruction
+ Indigo.Compilation.Sequential.Types: [Comment] :: Text -> Instruction
+ Indigo.Compilation.Sequential.Types: [ContractCalling] :: (HasEntrypointArg cp epRef epArg, ToTAddress cp vd addr, ToT addr ~ ToT Address, KnownValue epArg, IsoValue (ContractRef epArg)) => Proxy (cp, vd) -> epRef -> Expr addr -> Var (Maybe (ContractRef epArg)) -> Instruction
+ Indigo.Compilation.Sequential.Types: [ContractGeneral] :: Block -> Instruction
+ Indigo.Compilation.Sequential.Types: [ContractName] :: Text -> Block -> Instruction
+ Indigo.Compilation.Sequential.Types: [CreateContract] :: (HasSideEffects, NiceStorage s, NiceParameterFull p, NiceViewsDescriptor vd, Typeable vd, IsNotInView) => Contract p s vd -> Expr (Maybe KeyHash) -> Expr Mutez -> Expr s -> Var Address -> Instruction
+ Indigo.Compilation.Sequential.Types: [CreateLambda1] :: CreateLambda1CGeneric extra arg ret => StackVars (arg : extra) -> Var arg -> Block -> ret -> Var (Lambda1Generic extra arg ret) -> Instruction
+ Indigo.Compilation.Sequential.Types: [DocGroup] :: forall di. DocItem di => (SubDoc -> di) -> Block -> Instruction
+ Indigo.Compilation.Sequential.Types: [Emit] :: (HasSideEffects, NicePackedValue a, HasAnnotation a) => FieldAnn -> Expr a -> Instruction
+ Indigo.Compilation.Sequential.Types: [EntryCaseSimple] :: (CaseCommon dt ret clauses, DocumentEntrypoints PlainEntrypointsKind dt, NiceParameterFull dt, RequireFlatParamEps dt) => Expr dt -> clauses -> RetVars ret -> Instruction
+ Indigo.Compilation.Sequential.Types: [EntryCase] :: (CaseCommon dt ret clauses, DocumentEntrypoints entryPointKind dt) => Proxy entryPointKind -> Expr dt -> clauses -> RetVars ret -> Instruction
+ Indigo.Compilation.Sequential.Types: [ExecLambda1] :: LambdaKind st arg ret extra -> Proxy ret -> Expr arg -> Var (Lambda1Generic extra arg ret) -> RetVars ret -> Instruction
+ Indigo.Compilation.Sequential.Types: [FailOver] :: (forall inp. Expr a -> SomeIndigoState inp) -> Expr a -> Instruction
+ Indigo.Compilation.Sequential.Types: [Fail] :: (forall inp. SomeIndigoState inp) -> Instruction
+ Indigo.Compilation.Sequential.Types: [FinalizeParamCallingDoc] :: (NiceParameterFull cp, RequireSumType cp) => Var cp -> Block -> Expr cp -> Instruction
+ Indigo.Compilation.Sequential.Types: [ForEach] :: (IterOpHs a, KnownValue (IterOpElHs a)) => Expr a -> Var (IterOpElHs a) -> Block -> Instruction
+ Indigo.Compilation.Sequential.Types: [IfCons] :: (IfConstraint a b, KnownValue x) => Expr (List x) -> Var x -> Var (List x) -> Block -> a -> Block -> b -> RetVars a -> Instruction
+ Indigo.Compilation.Sequential.Types: [IfRight] :: (IfConstraint a b, KnownValue r, KnownValue l) => Expr (Either l r) -> Var r -> Block -> a -> Var l -> Block -> b -> RetVars a -> Instruction
+ Indigo.Compilation.Sequential.Types: [IfSome] :: (IfConstraint a b, KnownValue x) => Expr (Maybe x) -> Var x -> Block -> a -> Block -> b -> RetVars a -> Instruction
+ Indigo.Compilation.Sequential.Types: [If] :: IfConstraint a b => Expr Bool -> Block -> a -> Block -> b -> RetVars a -> Instruction
+ Indigo.Compilation.Sequential.Types: [LambdaCall1] :: LambdaKind st arg ret extra -> String -> Expr arg -> Var arg -> Block -> ret -> RetVars ret -> Instruction
+ Indigo.Compilation.Sequential.Types: [LiftIndigoState] :: (forall inp. SomeIndigoState inp) -> Instruction
+ Indigo.Compilation.Sequential.Types: [OneFieldIndigoSeqCaseClause] :: AppendSymbol "c" ctor ~ name => Label name -> CaseBranch x ret -> IndigoSeqCaseClause ret ('CaseClauseParam ctor ('OneField x))
+ Indigo.Compilation.Sequential.Types: [Scope] :: ScopeCodeGen ret => Block -> ret -> RetVars ret -> Instruction
+ Indigo.Compilation.Sequential.Types: [SelfCalling] :: (NiceParameterFull p, KnownValue (GetEntrypointArgCustom p mname), IsoValue (ContractRef (GetEntrypointArgCustom p mname)), IsNotInView) => Proxy p -> EntrypointRef mname -> Var (ContractRef (GetEntrypointArgCustom p mname)) -> Instruction
+ Indigo.Compilation.Sequential.Types: [SetDelegate] :: (HasSideEffects, IsNotInView) => Expr (Maybe KeyHash) -> Instruction
+ Indigo.Compilation.Sequential.Types: [SetField] :: (HasField store fname ftype, IsObject store, IsObject ftype) => Var store -> Label fname -> Expr ftype -> Instruction
+ Indigo.Compilation.Sequential.Types: [SetVar] :: KnownValue x => Var x -> Expr x -> Instruction
+ Indigo.Compilation.Sequential.Types: [TransferTokens] :: (NiceParameter p, HasSideEffects, IsNotInView) => Expr p -> Expr Mutez -> Expr (ContractRef p) -> Instruction
+ Indigo.Compilation.Sequential.Types: [VarModification] :: (IsObject x, KnownValue y) => ([y, x] :-> '[x]) -> Var x -> Expr y -> Instruction
+ Indigo.Compilation.Sequential.Types: [WhileLeft] :: (KnownValue l, KnownValue r) => Expr (Either l r) -> Var l -> Block -> Var r -> Instruction
+ Indigo.Compilation.Sequential.Types: [While] :: Expr Bool -> Block -> Instruction
+ Indigo.Compilation.Sequential.Types: [instrList] :: InstrCollector -> Block
+ Indigo.Compilation.Sequential.Types: [nextRef] :: InstrCollector -> RefId
+ Indigo.Compilation.Sequential.Types: [seqHooks] :: InstrCollector -> SequentialHooks
+ Indigo.Compilation.Sequential.Types: [shStmtHook] :: SequentialHooks -> CallStack -> Block -> State InstrCollector ()
+ Indigo.Compilation.Sequential.Types: data CaseBranch x ret
+ Indigo.Compilation.Sequential.Types: data IndigoSeqCaseClause ret (param :: CaseClauseParam)
+ Indigo.Compilation.Sequential.Types: data InstrCollector
+ Indigo.Compilation.Sequential.Types: data Instruction
+ Indigo.Compilation.Sequential.Types: instance GHC.Base.Monoid Indigo.Compilation.Sequential.Types.SequentialHooks
+ Indigo.Compilation.Sequential.Types: instance GHC.Base.Semigroup Indigo.Compilation.Sequential.Types.SequentialHooks
+ Indigo.Compilation.Sequential.Types: newtype SequentialHooks
+ Indigo.Compilation.Sequential.Types: stmtHookL :: Lens' SequentialHooks (CallStack -> Block -> State InstrCollector ())
+ Indigo.Compilation.Sequential.Types: type Block = [Instruction]
+ Indigo.Frontend.Expr: (!!) :: (HasField dt name ftype, exDt :~> dt, exFld :~> ftype) => exDt -> (Label name, exFld) -> Expr dt
+ Indigo.Frontend.Expr: (!:) :: IsUpdExpr exKey exVal exMap map => exMap -> (exKey, exVal) -> Expr map
+ Indigo.Frontend.Expr: (!@) :: (StoreHasSubmap store name key value, exKey :~> key, exVal :~> Maybe value, exStore :~> store) => exStore -> (Label name, exKey, exVal) -> Expr store
+ Indigo.Frontend.Expr: (!~) :: (ex :~> t, KnownValue (name :! t)) => ex -> Label name -> Expr (name :! t)
+ Indigo.Frontend.Expr: (#!) :: (HasField dt name ftype, exDt :~> dt) => exDt -> Label name -> Expr ftype
+ Indigo.Frontend.Expr: (#:) :: IsGetExpr exKey exMap map => exMap -> exKey -> Expr (Maybe (GetOpValHs map))
+ Indigo.Frontend.Expr: (#@) :: (StoreHasSubmap store name key value, KnownValue value, exKey :~> key, exStore :~> store) => exStore -> (Label name, exKey) -> Expr (Maybe value)
+ Indigo.Frontend.Expr: (#~) :: (ex :~> (name :! t), KnownValue t) => ex -> Label name -> Expr t
+ Indigo.Frontend.Expr: (%) :: forall ratio exN exM n m reminder. IsModExpr exN exM n m ratio reminder => exN -> exM -> Expr reminder
+ Indigo.Frontend.Expr: (&&) :: IsArithExpr exN exM And n m r => exN -> exM -> Expr r
+ Indigo.Frontend.Expr: (*) :: IsArithExpr exN exM Mul n m r => exN -> exM -> Expr r
+ Indigo.Frontend.Expr: (+) :: IsArithExpr exN exM Add n m r => exN -> exM -> Expr r
+ Indigo.Frontend.Expr: (++@) :: (StoreHasSubmap store name key value, Dupable key, IsError err, Buildable err, exKey :~> key, exVal :~> value, exStore :~> store) => exStore -> (Label name, err, exKey, exVal) -> Expr store
+ Indigo.Frontend.Expr: (+:) :: (ExprInsertable c exParam, exStructure :~> c) => exStructure -> exParam -> Expr c
+ Indigo.Frontend.Expr: (+@) :: (StoreHasSubmap store name key value, exKey :~> key, exVal :~> value, exStore :~> store) => exStore -> (Label name, exKey, exVal) -> Expr store
+ Indigo.Frontend.Expr: (-) :: IsArithExpr exN exM Sub n m r => exN -> exM -> Expr r
+ Indigo.Frontend.Expr: (-:) :: (ExprRemovable c, exStruct :~> c, exKey :~> UpdOpKeyHs c) => exStruct -> exKey -> Expr c
+ Indigo.Frontend.Expr: (-@) :: (StoreHasSubmap store name key value, KnownValue value, exKey :~> key, exStore :~> store) => exStore -> (Label name, exKey) -> Expr store
+ Indigo.Frontend.Expr: (.:) :: (ex1 :~> a, ex2 :~> List a) => ex1 -> ex2 -> Expr (List a)
+ Indigo.Frontend.Expr: (/) :: forall reminder exN exM n m ratio. IsDivExpr exN exM n m ratio reminder => exN -> exM -> Expr ratio
+ Indigo.Frontend.Expr: (/=) :: (NiceComparable n, c :~> n, c1 :~> n) => c -> c1 -> Expr Bool
+ Indigo.Frontend.Expr: (<) :: (NiceComparable n, c :~> n, c1 :~> n) => c -> c1 -> Expr Bool
+ Indigo.Frontend.Expr: (<<<) :: IsArithExpr exN exM Lsl n m r => exN -> exM -> Expr r
+ Indigo.Frontend.Expr: (<=) :: (NiceComparable n, c :~> n, c1 :~> n) => c -> c1 -> Expr Bool
+ Indigo.Frontend.Expr: (<>) :: IsConcatExpr exN1 exN2 n => exN1 -> exN2 -> Expr n
+ Indigo.Frontend.Expr: (==) :: (NiceComparable n, c :~> n, c1 :~> n) => c -> c1 -> Expr Bool
+ Indigo.Frontend.Expr: (>) :: (NiceComparable n, c :~> n, c1 :~> n) => c -> c1 -> Expr Bool
+ Indigo.Frontend.Expr: (>=) :: (NiceComparable n, c :~> n, c1 :~> n) => c -> c1 -> Expr Bool
+ Indigo.Frontend.Expr: (>>>) :: IsArithExpr exN exM Lsr n m r => exN -> exM -> Expr r
+ Indigo.Frontend.Expr: (?:) :: IsMemExpr exKey exN n => exN -> exKey -> Expr Bool
+ Indigo.Frontend.Expr: (?@) :: (StoreHasSubmap store name key value, KnownValue value, exKey :~> key, exStore :~> store) => exStore -> (Label name, exKey) -> Expr Bool
+ Indigo.Frontend.Expr: (^) :: IsArithExpr exN exM Xor n m r => exN -> exM -> Expr r
+ Indigo.Frontend.Expr: (||) :: IsArithExpr exN exM Or n m r => exN -> exM -> Expr r
+ Indigo.Frontend.Expr: abs :: IsUnaryArithExpr exN Abs n => exN -> Expr (UnaryArithResHs Abs n)
+ Indigo.Frontend.Expr: add :: IsArithExpr exN exM Add n m r => exN -> exM -> Expr r
+ Indigo.Frontend.Expr: amount :: Expr Mutez
+ Indigo.Frontend.Expr: and :: IsArithExpr exN exM And n m r => exN -> exM -> Expr r
+ Indigo.Frontend.Expr: balance :: Expr Mutez
+ Indigo.Frontend.Expr: blake2b :: (hashExpr :~> bs, BytesLike bs) => hashExpr -> Expr (Hash Blake2b bs)
+ Indigo.Frontend.Expr: car :: (op :~> (n, m), KnownValue n) => op -> Expr n
+ Indigo.Frontend.Expr: cast :: ex :~> a => ex -> Expr a
+ Indigo.Frontend.Expr: cdr :: (op :~> (n, m), KnownValue m) => op -> Expr m
+ Indigo.Frontend.Expr: chainId :: Expr ChainId
+ Indigo.Frontend.Expr: checkSignature :: (pkExpr :~> PublicKey, sigExpr :~> TSignature bs, hashExpr :~> bs, BytesLike bs) => pkExpr -> sigExpr -> hashExpr -> Expr Bool
+ Indigo.Frontend.Expr: coerce :: forall b a ex. (Castable_ a b, KnownValue b, ex :~> a) => ex -> Expr b
+ Indigo.Frontend.Expr: concat :: IsConcatExpr exN1 exN2 n => exN1 -> exN2 -> Expr n
+ Indigo.Frontend.Expr: concatAll :: IsConcatListExpr exN n => exN -> Expr n
+ Indigo.Frontend.Expr: cons :: (ex1 :~> a, ex2 :~> List a) => ex1 -> ex2 -> Expr (List a)
+ Indigo.Frontend.Expr: constExpr :: forall a. NiceConstant a => a -> Expr a
+ Indigo.Frontend.Expr: construct :: (InstrConstructC dt, KnownValue dt, RMap (ConstructorFieldTypes dt), RecordToList (ConstructorFieldTypes dt), fields ~ Rec Expr (ConstructorFieldTypes dt), RecFromTuple fields) => IsoRecTuple fields -> Expr dt
+ Indigo.Frontend.Expr: constructRec :: (InstrConstructC dt, RMap (ConstructorFieldTypes dt), RecordToList (ConstructorFieldTypes dt), KnownValue dt) => Rec Expr (ConstructorFieldTypes dt) -> Expr dt
+ Indigo.Frontend.Expr: contract :: forall p vd addr exAddr. (NiceParameterFull p, NoExplicitDefaultEntrypoint p, IsoValue (ContractRef p), ToTAddress p vd addr, ToT addr ~ ToT Address, exAddr :~> addr) => exAddr -> Expr (Maybe (ContractRef p))
+ Indigo.Frontend.Expr: contractAddress :: exc :~> ContractRef p => exc -> Expr Address
+ Indigo.Frontend.Expr: contractCallingString :: (NiceParameter arg, IsoValue (ContractRef arg), exAddr :~> Address) => MText -> exAddr -> Expr (Maybe (ContractRef arg))
+ Indigo.Frontend.Expr: contractCallingUnsafe :: (NiceParameter arg, IsoValue (ContractRef arg), exAddr :~> Address) => EpName -> exAddr -> Expr (Maybe (ContractRef arg))
+ Indigo.Frontend.Expr: convertEpAddressToContract :: (NiceParameter p, IsoValue (ContractRef p), epExpr :~> EpAddress) => epExpr -> Expr (Maybe (ContractRef p))
+ Indigo.Frontend.Expr: div :: forall reminder exN exM n m ratio. IsDivExpr exN exM n m ratio reminder => exN -> exM -> Expr ratio
+ Indigo.Frontend.Expr: empty :: (ExprMagma c, NiceComparable (UpdOpKeyHs c), KnownValue c) => Expr c
+ Indigo.Frontend.Expr: emptyBigMap :: (KnownValue value, NiceComparable key, KnownValue (BigMap key value)) => Expr (BigMap key value)
+ Indigo.Frontend.Expr: emptyMap :: (KnownValue value, NiceComparable key, KnownValue (Map key value)) => Expr (Map key value)
+ Indigo.Frontend.Expr: emptySet :: (NiceComparable key, KnownValue (Set key)) => Expr (Set key)
+ Indigo.Frontend.Expr: eq :: (NiceComparable n, c :~> n, c1 :~> n) => c -> c1 -> Expr Bool
+ Indigo.Frontend.Expr: even :: (ParityExpr n m, ArithOpHs EDiv n m r, exN :~> n) => exN -> Expr Bool
+ Indigo.Frontend.Expr: forcedCoerce :: forall b a ex. (MichelsonCoercible a b, KnownValue b, ex :~> a) => ex -> Expr b
+ Indigo.Frontend.Expr: fst :: (op :~> (n, m), KnownValue n) => op -> Expr n
+ Indigo.Frontend.Expr: ge :: (NiceComparable n, c :~> n, c1 :~> n) => c -> c1 -> Expr Bool
+ Indigo.Frontend.Expr: get :: IsGetExpr exKey exMap map => exKey -> exMap -> Expr (Maybe (GetOpValHs map))
+ Indigo.Frontend.Expr: gt :: (NiceComparable n, c :~> n, c1 :~> n) => c -> c1 -> Expr Bool
+ Indigo.Frontend.Expr: hashKey :: keyExpr :~> PublicKey => keyExpr -> Expr KeyHash
+ Indigo.Frontend.Expr: implicitAccount :: exkh :~> KeyHash => exkh -> Expr (ContractRef ())
+ Indigo.Frontend.Expr: infix 4 >=
+ Indigo.Frontend.Expr: infixl 6 -
+ Indigo.Frontend.Expr: infixl 7 %
+ Indigo.Frontend.Expr: infixl 8 #~
+ Indigo.Frontend.Expr: infixr 2 ^
+ Indigo.Frontend.Expr: infixr 3 &&
+ Indigo.Frontend.Expr: infixr 5 .:
+ Indigo.Frontend.Expr: infixr 6 <>
+ Indigo.Frontend.Expr: infixr 8 ++@
+ Indigo.Frontend.Expr: insert :: (ExprInsertable c insParam, ex :~> c) => insParam -> ex -> Expr c
+ Indigo.Frontend.Expr: instance (Lorentz.Constraints.Scopes.NiceComparable a, exKey Indigo.Common.Expr.:~> a) => Indigo.Frontend.Expr.ExprInsertable (Data.Set.Internal.Set a) exKey
+ Indigo.Frontend.Expr: instance (Lorentz.Constraints.Scopes.NiceComparable k, Lorentz.Constraints.Scopes.KnownValue v) => Indigo.Frontend.Expr.ExprRemovable (Data.Map.Internal.Map k v)
+ Indigo.Frontend.Expr: instance (Lorentz.Constraints.Scopes.NiceComparable k, Lorentz.Constraints.Scopes.KnownValue v) => Indigo.Frontend.Expr.ExprRemovable (Morley.Michelson.Typed.Haskell.Value.BigMap k v)
+ Indigo.Frontend.Expr: instance (Lorentz.Constraints.Scopes.NiceComparable k, exKey Indigo.Common.Expr.:~> k, exValue Indigo.Common.Expr.:~> v) => Indigo.Frontend.Expr.ExprInsertable (Data.Map.Internal.Map k v) (exKey, exValue)
+ Indigo.Frontend.Expr: instance (Lorentz.Constraints.Scopes.NiceComparable k, exKey Indigo.Common.Expr.:~> k, exValue Indigo.Common.Expr.:~> v) => Indigo.Frontend.Expr.ExprInsertable (Morley.Michelson.Typed.Haskell.Value.BigMap k v) (exKey, exValue)
+ Indigo.Frontend.Expr: instance Indigo.Frontend.Expr.ExprMagma (Data.Set.Internal.Set k)
+ Indigo.Frontend.Expr: instance Indigo.Frontend.Expr.ParityExpr GHC.Num.Integer.Integer GHC.Num.Integer.Integer
+ Indigo.Frontend.Expr: instance Indigo.Frontend.Expr.ParityExpr GHC.Num.Natural.Natural GHC.Num.Natural.Natural
+ Indigo.Frontend.Expr: instance Indigo.Frontend.Expr.ParityExpr Morley.Tezos.Core.Mutez Morley.Tezos.Core.Mutez
+ Indigo.Frontend.Expr: instance Lorentz.Constraints.Scopes.KnownValue v => Indigo.Frontend.Expr.ExprMagma (Data.Map.Internal.Map k v)
+ Indigo.Frontend.Expr: instance Lorentz.Constraints.Scopes.KnownValue v => Indigo.Frontend.Expr.ExprMagma (Morley.Michelson.Typed.Haskell.Value.BigMap k v)
+ Indigo.Frontend.Expr: instance Lorentz.Constraints.Scopes.NiceComparable a => Indigo.Frontend.Expr.ExprRemovable (Data.Set.Internal.Set a)
+ Indigo.Frontend.Expr: isNat :: ex :~> Integer => ex -> Expr (Maybe Natural)
+ Indigo.Frontend.Expr: keccak :: (hashExpr :~> bs, BytesLike bs) => hashExpr -> Expr (Hash Keccak bs)
+ Indigo.Frontend.Expr: le :: (NiceComparable n, c :~> n, c1 :~> n) => c -> c1 -> Expr Bool
+ Indigo.Frontend.Expr: left :: (ex :~> y, KnownValue x, KnownValue (Either y x)) => ex -> Expr (Either y x)
+ Indigo.Frontend.Expr: level :: Expr Natural
+ Indigo.Frontend.Expr: lsl :: IsArithExpr exN exM Lsl n m r => exN -> exM -> Expr r
+ Indigo.Frontend.Expr: lsr :: IsArithExpr exN exM Lsr n m r => exN -> exM -> Expr r
+ Indigo.Frontend.Expr: lt :: (NiceComparable n, c :~> n, c1 :~> n) => c -> c1 -> Expr Bool
+ Indigo.Frontend.Expr: makeView :: (KnownValue (View_ a r), exa :~> a, exCRef :~> ContractRef r) => exa -> exCRef -> Expr (View_ a r)
+ Indigo.Frontend.Expr: makeVoid :: (KnownValue (Void_ a b), exa :~> a, exCRef :~> Lambda b b) => exa -> exCRef -> Expr (Void_ a b)
+ Indigo.Frontend.Expr: mem :: IsMemExpr exKey exN n => exKey -> exN -> Expr Bool
+ Indigo.Frontend.Expr: mod :: forall ratio exN exM n m reminder. IsModExpr exN exM n m ratio reminder => exN -> exM -> Expr reminder
+ Indigo.Frontend.Expr: mul :: IsArithExpr exN exM Mul n m r => exN -> exM -> Expr r
+ Indigo.Frontend.Expr: name :: (ex :~> t, KnownValue (name :! t)) => Label name -> ex -> Expr (name :! t)
+ Indigo.Frontend.Expr: neg :: IsUnaryArithExpr exN Neg n => exN -> Expr (UnaryArithResHs Neg n)
+ Indigo.Frontend.Expr: neq :: (NiceComparable n, c :~> n, c1 :~> n) => c -> c1 -> Expr Bool
+ Indigo.Frontend.Expr: nil :: KnownValue a => Expr (List a)
+ Indigo.Frontend.Expr: nonZero :: (ex :~> n, NonZero n, KnownValue (Maybe n)) => ex -> Expr (Maybe n)
+ Indigo.Frontend.Expr: none :: KnownValue t => Expr (Maybe t)
+ Indigo.Frontend.Expr: not :: IsUnaryArithExpr exN Not n => exN -> Expr (UnaryArithResHs Not n)
+ Indigo.Frontend.Expr: now :: Expr Timestamp
+ Indigo.Frontend.Expr: odd :: (ParityExpr n m, ArithOpHs EDiv n m r, exN :~> n) => exN -> Expr Bool
+ Indigo.Frontend.Expr: or :: IsArithExpr exN exM Or n m r => exN -> exM -> Expr r
+ Indigo.Frontend.Expr: pack :: (ex :~> a, NicePackedValue a) => ex -> Expr (Packed a)
+ Indigo.Frontend.Expr: packRaw :: (ex :~> a, NicePackedValue a) => ex -> Expr ByteString
+ Indigo.Frontend.Expr: pair :: (ex1 :~> n, ex2 :~> m, KnownValue (n, m)) => ex1 -> ex2 -> Expr (n, m)
+ Indigo.Frontend.Expr: remove :: (ExprRemovable c, exStruct :~> c, exKey :~> UpdOpKeyHs c) => exKey -> exStruct -> Expr c
+ Indigo.Frontend.Expr: right :: (ex :~> x, KnownValue y, KnownValue (Either y x)) => ex -> Expr (Either y x)
+ Indigo.Frontend.Expr: runFutureContract :: (NiceParameter p, IsoValue (ContractRef p), conExpr :~> FutureContract p) => conExpr -> Expr (Maybe (ContractRef p))
+ Indigo.Frontend.Expr: self :: (NiceParameterFull p, NoExplicitDefaultEntrypoint p, IsoValue (ContractRef p), IsNotInView) => Expr (ContractRef p)
+ Indigo.Frontend.Expr: selfAddress :: Expr Address
+ Indigo.Frontend.Expr: sender :: Expr Address
+ Indigo.Frontend.Expr: sha256 :: (hashExpr :~> bs, BytesLike bs) => hashExpr -> Expr (Hash Sha256 bs)
+ Indigo.Frontend.Expr: sha3 :: (hashExpr :~> bs, BytesLike bs) => hashExpr -> Expr (Hash Sha3 bs)
+ Indigo.Frontend.Expr: sha512 :: (hashExpr :~> bs, BytesLike bs) => hashExpr -> Expr (Hash Sha512 bs)
+ Indigo.Frontend.Expr: size :: IsSizeExpr exN n => exN -> Expr Natural
+ Indigo.Frontend.Expr: slice :: (an :~> Natural, bn :~> Natural, IsSliceExpr ex c) => (an, bn) -> ex -> Expr (Maybe c)
+ Indigo.Frontend.Expr: snd :: (op :~> (n, m), KnownValue m) => op -> Expr m
+ Indigo.Frontend.Expr: some :: (ex :~> t, KnownValue (Maybe t)) => ex -> Expr (Maybe t)
+ Indigo.Frontend.Expr: stDelete :: (StoreHasSubmap store name key value, KnownValue value, exKey :~> key, exStore :~> store) => exStore -> (Label name, exKey) -> Expr store
+ Indigo.Frontend.Expr: stGet :: (StoreHasSubmap store name key value, KnownValue value, exKey :~> key, exStore :~> store) => exStore -> (Label name, exKey) -> Expr (Maybe value)
+ Indigo.Frontend.Expr: stInsert :: (StoreHasSubmap store name key value, exKey :~> key, exVal :~> value, exStore :~> store) => exStore -> (Label name, exKey, exVal) -> Expr store
+ Indigo.Frontend.Expr: stInsertNew :: (StoreHasSubmap store name key value, Dupable key, IsError err, Buildable err, exKey :~> key, exVal :~> value, exStore :~> store) => exStore -> (Label name, err, exKey, exVal) -> Expr store
+ Indigo.Frontend.Expr: stMem :: (StoreHasSubmap store name key value, KnownValue value, exKey :~> key, exStore :~> store) => exStore -> (Label name, exKey) -> Expr Bool
+ Indigo.Frontend.Expr: stUpdate :: (StoreHasSubmap store name key value, exKey :~> key, exVal :~> Maybe value, exStore :~> store) => exStore -> (Label name, exKey, exVal) -> Expr store
+ Indigo.Frontend.Expr: sub :: IsArithExpr exN exM Sub n m r => exN -> exM -> Expr r
+ Indigo.Frontend.Expr: toInt :: ex :~> Natural => ex -> Expr Integer
+ Indigo.Frontend.Expr: totalVotingPower :: Expr Natural
+ Indigo.Frontend.Expr: unName :: (ex :~> (name :! t), KnownValue t) => Label name -> ex -> Expr t
+ Indigo.Frontend.Expr: unpack :: (NiceUnpackedValue a, exb :~> Packed a) => exb -> Expr (Maybe a)
+ Indigo.Frontend.Expr: unpackRaw :: (NiceUnpackedValue a, exb :~> ByteString) => exb -> Expr (Maybe a)
+ Indigo.Frontend.Expr: unwrap :: (InstrUnwrapC dt name, exDt :~> dt, KnownValue (CtorOnlyField name dt)) => Label name -> exDt -> Expr (CtorOnlyField name dt)
+ Indigo.Frontend.Expr: update :: IsUpdExpr exKey exVal exMap map => (exKey, exVal) -> exMap -> Expr map
+ Indigo.Frontend.Expr: varExpr :: KnownValue a => Var a -> Expr a
+ Indigo.Frontend.Expr: votingPower :: keyExpr :~> KeyHash => keyExpr -> Expr Natural
+ Indigo.Frontend.Expr: wrap :: (InstrWrapOneC dt name, exField :~> CtorOnlyField name dt, KnownValue dt) => Label name -> exField -> Expr dt
+ Indigo.Frontend.Expr: xor :: IsArithExpr exN exM Xor n m r => exN -> exM -> Expr r
+ Indigo.Frontend.Internal.Statement: [CalledFrom] :: CallStack -> freer a -> StatementF freer a
+ Indigo.Frontend.Internal.Statement: [Case] :: CaseCommonF (IndigoMCaseClauseL freer) dt ret clauses => Expr dt -> clauses -> StatementF freer (RetVars ret)
+ Indigo.Frontend.Internal.Statement: [ContractCalling] :: (HasEntrypointArg cp epRef epArg, ToTAddress cp vd addr, ToT addr ~ ToT Address, KnownValue epArg, IsoValue (ContractRef epArg)) => Proxy (cp, vd) -> epRef -> Expr addr -> StatementF freer (Var (Maybe (ContractRef epArg)))
+ Indigo.Frontend.Internal.Statement: [ContractGeneral] :: freer () -> StatementF freer ()
+ Indigo.Frontend.Internal.Statement: [ContractName] :: Text -> freer () -> StatementF freer ()
+ Indigo.Frontend.Internal.Statement: [CreateContract] :: (IsObject st, NiceStorage st, NiceParameterFull param, HasSideEffects, NiceViewsDescriptor vd, Typeable vd, IsNotInView) => Contract param st vd -> Expr (Maybe KeyHash) -> Expr Mutez -> Expr st -> StatementF freer (Var Address)
+ Indigo.Frontend.Internal.Statement: [DocGroup] :: DocItem di => (SubDoc -> di) -> freer () -> StatementF freer ()
+ Indigo.Frontend.Internal.Statement: [EffLambda] :: (ExecuteLambdaEff1C st arg res, CreateLambda1CGeneric '[st, Ops] arg res, Typeable res) => Proxy st -> LambdaKind st arg res '[st, Ops]
+ Indigo.Frontend.Internal.Statement: [Emit] :: (HasSideEffects, NicePackedValue a, HasAnnotation a) => FieldAnn -> Expr a -> StatementF freer ()
+ Indigo.Frontend.Internal.Statement: [EntryCaseSimple] :: (CaseCommonF (IndigoMCaseClauseL freer) cp ret clauses, DocumentEntrypoints PlainEntrypointsKind cp, NiceParameterFull cp, RequireFlatParamEps cp) => Expr cp -> clauses -> StatementF freer (RetVars ret)
+ Indigo.Frontend.Internal.Statement: [EntryCase] :: (CaseCommonF (IndigoMCaseClauseL freer) dt ret clauses, DocumentEntrypoints entrypointKind dt) => Proxy entrypointKind -> Expr dt -> clauses -> StatementF freer (RetVars ret)
+ Indigo.Frontend.Internal.Statement: [FailOver] :: ReturnableValue ret => Proxy ret -> (forall inp. Expr a -> SomeIndigoState inp) -> Expr a -> StatementF freer (RetVars ret)
+ Indigo.Frontend.Internal.Statement: [Fail] :: ReturnableValue ret => Proxy ret -> (forall inp. SomeIndigoState inp) -> StatementF freer (RetVars ret)
+ Indigo.Frontend.Internal.Statement: [FinalizeParamCallingDoc] :: (NiceParameterFull cp, RequireSumType cp, HasCallStack) => (Var cp -> freer ()) -> Expr cp -> StatementF freer ()
+ Indigo.Frontend.Internal.Statement: [ForEach] :: (IterOpHs a, KnownValue (IterOpElHs a)) => Expr a -> (Var (IterOpElHs a) -> freer ()) -> StatementF freer ()
+ Indigo.Frontend.Internal.Statement: [IfCons] :: (IfConstraint a b, KnownValue x) => Expr (List x) -> (Var x -> Var (List x) -> freer a) -> freer b -> StatementF freer (RetVars a)
+ Indigo.Frontend.Internal.Statement: [IfRight] :: (IfConstraint a b, KnownValue x, KnownValue y) => Expr (Either y x) -> (Var x -> freer a) -> (Var y -> freer b) -> StatementF freer (RetVars a)
+ Indigo.Frontend.Internal.Statement: [IfSome] :: (IfConstraint a b, KnownValue x) => Expr (Maybe x) -> (Var x -> freer a) -> freer b -> StatementF freer (RetVars a)
+ Indigo.Frontend.Internal.Statement: [If] :: IfConstraint a b => Expr Bool -> freer a -> freer b -> StatementF freer (RetVars a)
+ Indigo.Frontend.Internal.Statement: [LambdaCall1] :: LambdaKind st arg res extra -> String -> (Var arg -> freer res) -> Expr arg -> StatementF freer (RetVars res)
+ Indigo.Frontend.Internal.Statement: [LiftIndigoState] :: (forall inp. SomeIndigoState inp) -> StatementF freer ()
+ Indigo.Frontend.Internal.Statement: [NewVar] :: KnownValue x => Expr x -> StatementF freer (Var x)
+ Indigo.Frontend.Internal.Statement: [OneFieldIndigoMCaseClauseL] :: (name ~ AppendSymbol "c" ctor, KnownValue x, ScopeCodeGen retBr, ret ~ RetExprs retBr, RetOutStack ret ~ RetOutStack retBr) => Label name -> (Var x -> freer retBr) -> IndigoMCaseClauseL freer ret ('CaseClauseParam ctor ('OneField x))
+ Indigo.Frontend.Internal.Statement: [PureLambda] :: (ExecuteLambdaPure1C arg res, CreateLambda1CGeneric '[] arg res, Typeable res) => LambdaKind st arg res '[]
+ Indigo.Frontend.Internal.Statement: [Scope] :: ScopeCodeGen a => freer a -> StatementF freer (RetVars a)
+ Indigo.Frontend.Internal.Statement: [SelfCalling] :: (NiceParameterFull p, KnownValue (GetEntrypointArgCustom p mname), IsoValue (ContractRef (GetEntrypointArgCustom p mname)), IsNotInView) => Proxy p -> EntrypointRef mname -> StatementF freer (Var (ContractRef (GetEntrypointArgCustom p mname)))
+ Indigo.Frontend.Internal.Statement: [SetDelegate] :: (HasSideEffects, IsNotInView) => Expr (Maybe KeyHash) -> StatementF freer ()
+ Indigo.Frontend.Internal.Statement: [SetField] :: (IsObject dt, IsObject ftype, HasField dt fname ftype) => Var dt -> Label fname -> Expr ftype -> StatementF cont ()
+ Indigo.Frontend.Internal.Statement: [SetVar] :: KnownValue x => Var x -> Expr x -> StatementF freer ()
+ Indigo.Frontend.Internal.Statement: [StorageLambda] :: (ExecuteLambda1C st arg res, CreateLambda1CGeneric '[st] arg res, Typeable res) => Proxy st -> LambdaKind st arg res '[st]
+ Indigo.Frontend.Internal.Statement: [TransferTokens] :: (NiceParameter p, HasSideEffects, IsNotInView) => Expr p -> Expr Mutez -> Expr (ContractRef p) -> StatementF freer ()
+ Indigo.Frontend.Internal.Statement: [VarModification] :: (IsObject x, KnownValue y) => ([y, x] :-> '[x]) -> Var x -> Expr y -> StatementF freer ()
+ Indigo.Frontend.Internal.Statement: [WhileLeft] :: (KnownValue x, KnownValue y) => Expr (Either y x) -> (Var y -> freer ()) -> StatementF freer (Var x)
+ Indigo.Frontend.Internal.Statement: [While] :: Expr Bool -> freer () -> StatementF freer ()
+ Indigo.Frontend.Internal.Statement: data IndigoMCaseClauseL freer ret (param :: CaseClauseParam)
+ Indigo.Frontend.Internal.Statement: data LambdaKind st arg res extra
+ Indigo.Frontend.Internal.Statement: data StatementF (freer :: Type -> Type) a
+ Indigo.Frontend.Internal.Statement: type IfConstraint a b = (ScopeCodeGen a, ScopeCodeGen b, CompareBranchesResults (RetExprs a) (RetExprs b), RetVars a ~ RetVars b, RetOutStack a ~ RetOutStack b)
+ Indigo.Frontend.Internal.Statement: withLambdaKind :: LambdaKind st arg res extra -> ((ScopeCodeGen res, KnownValue arg, Typeable res, CreateLambda1CGeneric extra arg res) => r) -> r
+ Indigo.Frontend.Language: annQ :: QuasiQuoter
+ Indigo.Frontend.Language: assertCustomNoArg :: forall tag ex. (MustHaveErrorArg tag MText, CustomErrorHasDoc tag, IsExpr ex Bool, HasCallStack) => Label tag -> ex -> IndigoM ()
+ Indigo.Frontend.Language: emit :: (HasSideEffects, NicePackedValue a, HasAnnotation a, HasCallStack) => FieldAnn -> Expr a -> IndigoM ()
+ Indigo.Frontend.Language: failCustomNoArg :: forall ret tag. (ReturnableValue ret, MustHaveErrorArg tag MText, CustomErrorHasDoc tag, HasCallStack) => Label tag -> IndigoM (RetVars ret)
+ Indigo.Frontend.Language: type FieldAnn = Annotation FieldTag
+ Indigo.Lorentz: (:-|) :: FieldRef l -> FieldRef r -> (:-|) (l :: k1) (r :: k2) (p :: FieldRefTag)
+ Indigo.Lorentz: -- Used in constraint for Lorentz instruction wrapping into a Haskell
+ Indigo.Lorentz: -- newtype and vice versa.
+ Indigo.Lorentz: -- this, <a>entrypointKindPos</a> and <a>entrypointKindSectionName</a>
+ Indigo.Lorentz: -- will be ignored.
+ Indigo.Lorentz: BigMapId :: Natural -> BigMapId (k2 :: k) (v :: k1)
+ Indigo.Lorentz: ChestContentT :: a -> OpenChestT a
+ Indigo.Lorentz: ChestOpenFailedT :: Bool -> OpenChestT a
+ Indigo.Lorentz: ChestT :: Chest -> ChestT a
+ Indigo.Lorentz: ContractCode :: ('[(cp, st)] :-> ContractOut st) -> ContractCode cp st
+ Indigo.Lorentz: ContractData :: ContractCode cp st -> Rec (ContractView st) (RevealViews vd) -> CompilationOptions -> ContractData cp st vd
+ Indigo.Lorentz: DView :: ViewName -> SubDoc -> DView
+ Indigo.Lorentz: DViewArg :: Proxy a -> DViewArg
+ Indigo.Lorentz: DViewDesc :: Proxy vd -> DViewDesc
+ Indigo.Lorentz: DViewRet :: Proxy a -> DViewRet
+ Indigo.Lorentz: EpAddress' :: Address -> EpName -> EpAddress
+ Indigo.Lorentz: Impossible :: Impossible (reason :: Symbol)
+ Indigo.Lorentz: IsDupable :: DupableDecision a
+ Indigo.Lorentz: IsNotDupable :: DupableDecision a
+ Indigo.Lorentz: ReadTicket :: Address -> a -> Natural -> ReadTicket a
+ Indigo.Lorentz: RecLambda :: ((i ++ '[WrappedLambda i o]) :-> o) -> WrappedLambda (i :: [Type]) (o :: [Type])
+ Indigo.Lorentz: SelfRef :: SelfRef (p :: FieldRefTag)
+ Indigo.Lorentz: SomeEntrypointArg :: Proxy a -> SomeEntrypointArg
+ Indigo.Lorentz: Ticket :: Address -> arg -> Natural -> Ticket arg
+ Indigo.Lorentz: UnsafeHash :: ByteString -> Hash (alg :: HashAlgorithmKind) a
+ Indigo.Lorentz: UnsafeUParam :: (MText, ByteString) -> UParam (entries :: [EntrypointKind])
+ Indigo.Lorentz: WrappedLambda :: (i :-> o) -> WrappedLambda (i :: [Type]) (o :: [Type])
+ Indigo.Lorentz: [ContractView] :: forall (name :: Symbol) arg ret st. (KnownSymbol name, NiceViewable arg, NiceViewable ret, HasAnnotation arg, HasAnnotation ret) => ViewCode arg st ret -> ContractView st ('ViewTyInfo name arg ret)
+ Indigo.Lorentz: [cdCode] :: ContractData cp st vd -> ContractCode cp st
+ Indigo.Lorentz: [cdCompilationOptions] :: ContractData cp st vd -> CompilationOptions
+ Indigo.Lorentz: [cdViews] :: ContractData cp st vd -> Rec (ContractView st) (RevealViews vd)
+ Indigo.Lorentz: [dvName] :: DView -> ViewName
+ Indigo.Lorentz: [dvSub] :: DView -> SubDoc
+ Indigo.Lorentz: [rtAmount] :: ReadTicket a -> Natural
+ Indigo.Lorentz: [rtData] :: ReadTicket a -> a
+ Indigo.Lorentz: [rtTicketer] :: ReadTicket a -> Address
+ Indigo.Lorentz: [sopGetAndUpdate] :: StoreSubmapOps store (mname :: k) key value -> forall (s :: [Type]). () => FieldRef mname -> (key : (Maybe value : (store : s))) :-> (Maybe value : (store : s))
+ Indigo.Lorentz: [sopGetFieldOpen] :: StoreFieldOps store (fname :: k) ftype -> forall res (s :: [Type]). HasDupableGetters store => ('[ftype] :-> '[res, ftype]) -> ('[ftype] :-> '[res]) -> FieldRef fname -> (store : s) :-> (res : (store : s))
+ Indigo.Lorentz: [sopSetFieldOpen] :: StoreFieldOps store (fname :: k) ftype -> forall new (s :: [Type]). () => ('[new, ftype] :-> '[ftype]) -> FieldRef fname -> (new : (store : s)) :-> (store : s)
+ Indigo.Lorentz: [tAmount] :: Ticket arg -> Natural
+ Indigo.Lorentz: [tData] :: Ticket arg -> arg
+ Indigo.Lorentz: [tTicketer] :: Ticket arg -> Address
+ Indigo.Lorentz: [unBigMapId] :: BigMapId (k2 :: k) (v :: k1) -> Natural
+ Indigo.Lorentz: [unChestT] :: ChestT a -> Chest
+ Indigo.Lorentz: [unContractCode] :: ContractCode cp st -> '[(cp, st)] :-> ContractOut st
+ Indigo.Lorentz: cDocumentedCode :: Contract cp st vd -> ContractCode cp st
+ Indigo.Lorentz: cMichelsonContract :: Contract cp st vd -> Contract (ToT cp) (ToT st)
+ Indigo.Lorentz: callingAddress :: forall cp vd addr (mname :: Maybe Symbol). (ToTAddress cp vd addr, NiceParameterFull cp) => addr -> EntrypointRef mname -> ContractRef (GetEntrypointArgCustom cp mname)
+ Indigo.Lorentz: callingDefAddress :: (ToTAddress cp vd addr, NiceParameterFull cp) => addr -> ContractRef (GetDefaultEntrypointArg cp)
+ Indigo.Lorentz: cdCodeL :: forall cp st vd cp1. NiceParameterFull cp1 => Lens (ContractData cp st vd) (ContractData cp1 st vd) (ContractCode cp st) (ContractCode cp1 st)
+ Indigo.Lorentz: cdCompilationOptionsL :: Lens' (ContractData cp st vd) CompilationOptions
+ Indigo.Lorentz: class (SingI t, WellTyped t, HasNoOp t, HasNoBigMap t, HasNoContract t, HasNoTicket t, HasNoSaplingState t) => ConstantScope (t :: T)
+ Indigo.Lorentz: class DefArithOp (aop :: k)
+ Indigo.Lorentz: class DefUnaryArithOp (aop :: k) where {
+ Indigo.Lorentz: class dipInp ~ a : Tail dipInp => DipT a (inp :: [Type]) (dipInp :: [Type]) (dipOut :: [Type]) (out :: [Type]) | inp a -> dipInp, dipOut inp a -> out, inp out a -> dipOut
+ Indigo.Lorentz: class st ~ Head st : Tail st => DupT a (st :: [Type])
+ Indigo.Lorentz: class FieldRefHasFinalName (fr :: k) where {
+ Indigo.Lorentz: class HasDupableGetters (a :: k)
+ Indigo.Lorentz: class IsCustomErrorArgRep a
+ Indigo.Lorentz: class IsNotInView
+ Indigo.Lorentz: class KnownFieldRef (ty :: k) where {
+ Indigo.Lorentz: class ToBytesArithOpHs n
+ Indigo.Lorentz: class ToIntegerArithOpHs n
+ Indigo.Lorentz: class TypeHasFieldNamingStrategy (a :: k)
+ Indigo.Lorentz: class ToT s ~ ToT Unwrappabled s => Unwrappable s where {
+ Indigo.Lorentz: class (Typeable vd, RenderViewsImpl RevealViews vd) => ViewsDescriptorHasDoc vd
+ Indigo.Lorentz: comment :: forall (s :: [Type]). CommentType -> s :-> s
+ Indigo.Lorentz: commentAroundFun :: forall (i :: [Type]) (o :: [Type]). Text -> (i :-> o) -> i :-> o
+ Indigo.Lorentz: commentAroundStmt :: forall (i :: [Type]) (o :: [Type]). Text -> (i :-> o) -> i :-> o
+ Indigo.Lorentz: customErrorHaskellRep :: forall (tag :: Symbol). (IsCustomErrorArgRep a, KnownSymbol tag, CustomErrorHasDoc tag) => Proxy tag -> Markdown
+ Indigo.Lorentz: customErrorRepDocDeps :: IsCustomErrorArgRep a => [SomeDocDefinitionItem]
+ Indigo.Lorentz: customGeneric' :: Maybe Type -> Name -> Type -> [Con] -> GenericStrategy -> Q [Dec]
+ Indigo.Lorentz: data BigMap k v
+ Indigo.Lorentz: data Bls12381Fr
+ Indigo.Lorentz: data Bls12381G1
+ Indigo.Lorentz: data Bls12381G2
+ Indigo.Lorentz: data Chest
+ Indigo.Lorentz: data ChestKey
+ Indigo.Lorentz: data ContractData cp st vd
+ Indigo.Lorentz: data ContractView st (v :: ViewTyInfo)
+ Indigo.Lorentz: data DView
+ Indigo.Lorentz: data DViewArg
+ Indigo.Lorentz: data DViewDesc
+ Indigo.Lorentz: data DViewRet
+ Indigo.Lorentz: data DupableDecision a
+ Indigo.Lorentz: data FieldAlias (alias :: k) (p :: FieldRefTag)
+ Indigo.Lorentz: data FieldName (n :: Symbol) (p :: FieldRefTag)
+ Indigo.Lorentz: data FieldRefTag
+ Indigo.Lorentz: data FlattenedEntrypointsKindHiding (hiddenEntrypoints :: [Symbol])
+ Indigo.Lorentz: data Impossible (reason :: Symbol)
+ Indigo.Lorentz: data Keccak (a :: HashAlgoTag)
+ Indigo.Lorentz: data Never
+ Indigo.Lorentz: data NoErrorArg
+ Indigo.Lorentz: data OpenChest
+ Indigo.Lorentz: data OpenChestT a
+ Indigo.Lorentz: data ReadTicket a
+ Indigo.Lorentz: data SelfRef (p :: FieldRefTag)
+ Indigo.Lorentz: data Sha3 (a :: HashAlgoTag)
+ Indigo.Lorentz: data SomeEntrypointArg
+ Indigo.Lorentz: data Ticket arg
+ Indigo.Lorentz: data UnitErrorArg
+ Indigo.Lorentz: data View_ a r
+ Indigo.Lorentz: data WrappedLambda (i :: [Type]) (o :: [Type])
+ Indigo.Lorentz: decideOnDupable :: KnownValue a => DupableDecision a
+ Indigo.Lorentz: defEvalOpHs :: forall (n :: T) (m :: T) (r :: T) (s :: [T]). (DefArithOp aop, ArithOp aop n m, r ~ ArithRes aop n m) => Instr (n : (m : s)) (r : s)
+ Indigo.Lorentz: defUnaryArithOpHs :: forall (n :: T) (r :: T) (s :: [T]). (DefUnaryArithOp aop, UnaryArithOp aop n, r ~ UnaryArithRes aop n, DefUnaryArithOpExtraConstraints aop n) => Instr (n : s) (r : s)
+ Indigo.Lorentz: defaultContractData :: (NiceParameterFull cp, NiceStorageFull st) => (IsNotInView => '[(cp, st)] :-> ContractOut st) -> ContractData cp st ()
+ Indigo.Lorentz: deriveFullType :: Name -> Maybe Kind -> [TyVarBndr flag] -> TypeQ
+ Indigo.Lorentz: entryCaseFlattened :: forall cp (out :: [Type]) (inp :: [Type]) clauses. (CaseTC cp out inp clauses, DocumentEntrypoints FlattenedEntrypointsKind cp) => IsoRecTuple clauses -> (cp : inp) :-> out
+ Indigo.Lorentz: entryCaseFlattenedHiding :: forall (heps :: [Symbol]) cp (out :: [Type]) (inp :: [Type]) clauses. (CaseTC cp out inp clauses, DocumentEntrypoints (FlattenedEntrypointsKindHiding heps) cp, HasEntrypoints (ParameterEntrypointsDerivation cp) cp heps) => IsoRecTuple clauses -> (cp : inp) :-> out
+ Indigo.Lorentz: entryCaseFlattenedHiding_ :: forall (heps :: [Symbol]) cp (out :: [Type]) (inp :: [Type]). (InstrCaseC cp, RMap (CaseClauses cp), DocumentEntrypoints (FlattenedEntrypointsKindHiding heps) cp, HasEntrypoints (ParameterEntrypointsDerivation cp) cp heps) => Rec (CaseClauseL inp out) (CaseClauses cp) -> (cp : inp) :-> out
+ Indigo.Lorentz: entryCaseFlattened_ :: forall cp (out :: [Type]) (inp :: [Type]). (InstrCaseC cp, RMap (CaseClauses cp), DocumentEntrypoints FlattenedEntrypointsKind cp) => Rec (CaseClauseL inp out) (CaseClauses cp) -> (cp : inp) :-> out
+ Indigo.Lorentz: entrypointKindOverrideSpecified :: EntrypointKindHasDoc ep => Dict ((EntrypointKindOverride ep == ep) ~ 'False)
+ Indigo.Lorentz: errorDocArg :: QuasiQuoter
+ Indigo.Lorentz: evalArithOpHs :: forall (s :: [Type]). ArithOpHs aop n m r => (n : (m : s)) :-> (r : s)
+ Indigo.Lorentz: evalToBytesOpHs :: forall bs (s :: [Type]). (ToBytesArithOpHs n, BytesLike bs) => (n : s) :-> (bs : s)
+ Indigo.Lorentz: evalToIntOpHs :: forall (s :: [Type]). ToIntegerArithOpHs n => (n : s) :-> (Integer : s)
+ Indigo.Lorentz: evalUnaryArithOpHs :: forall (s :: [Type]). UnaryArithOpHs aop n => (n : s) :-> (UnaryArithResHs aop n : s)
+ Indigo.Lorentz: fieldNameFromLabel :: forall (n :: Symbol). Label n -> FieldSymRef n
+ Indigo.Lorentz: fieldNameToLabel :: forall (n :: Symbol). FieldSymRef n -> Label n
+ Indigo.Lorentz: fieldRefFinalName :: FieldRefHasFinalName fr => FieldRef fr -> Label (FieldRefFinalName fr)
+ Indigo.Lorentz: fromDepthsStrategy' :: (Int -> [Natural]) -> (Int -> [Natural]) -> GenericStrategy
+ Indigo.Lorentz: getFieldOpen :: forall dt (name :: Symbol) res (st :: [Type]). (InstrGetFieldC dt name, HasDupableGetters dt) => ('[GetFieldType dt name] :-> '[res, GetFieldType dt name]) -> ('[GetFieldType dt name] :-> '[res]) -> Label name -> (dt : st) :-> (res : (dt : st))
+ Indigo.Lorentz: infixr 8 :-|
+ Indigo.Lorentz: justComment :: forall (s :: [Type]). Text -> s :-> s
+ Indigo.Lorentz: lSign :: (MonadRandom m, BytesLike a) => SecretKey -> a -> m (TSignature a)
+ Indigo.Lorentz: makeRightBalDepths :: Int -> [Natural]
+ Indigo.Lorentz: mangleGenericStrategyConstructors :: (Text -> Text) -> GenericStrategy -> GenericStrategy
+ Indigo.Lorentz: mangleGenericStrategyFields :: (Text -> Text) -> GenericStrategy -> GenericStrategy
+ Indigo.Lorentz: mkBigMap :: ToBigMap m => m -> BigMap (ToBigMapKey m) (ToBigMapValue m)
+ Indigo.Lorentz: mkContract :: (NiceParameterFull cp, NiceStorageFull st) => ContractCode cp st -> Contract cp st ()
+ Indigo.Lorentz: mkContractCode :: (IsNotInView => '[(cp, st)] :-> ContractOut st) -> ContractCode cp st
+ Indigo.Lorentz: mkContractWith :: (NiceParameterFull cp, NiceStorageFull st) => CompilationOptions -> ContractCode cp st -> Contract cp st ()
+ Indigo.Lorentz: mkFieldRef :: forall (p :: FieldRefTag). KnownFieldRef ty => FieldRefObject ty p
+ Indigo.Lorentz: mkLambda :: forall (i :: [Type]) (o :: [Type]). (IsNotInView => i :-> o) -> WrappedLambda i o
+ Indigo.Lorentz: mkLambdaRec :: forall (i :: [Type]) (o :: [Type]). (IsNotInView => (i ++ '[WrappedLambda i o]) :-> o) -> WrappedLambda i o
+ Indigo.Lorentz: mkView :: forall (name :: Symbol) arg ret st. (KnownSymbol name, NiceViewable arg, NiceViewable ret, HasAnnotation arg, HasAnnotation ret, TypeHasDoc arg, TypeHasDoc ret) => ViewCode arg st ret -> ContractView st ('ViewTyInfo name arg ret)
+ Indigo.Lorentz: newtype BigMapId (k2 :: k) (v :: k1)
+ Indigo.Lorentz: newtype ChestT a
+ Indigo.Lorentz: newtype ContractCode cp st
+ Indigo.Lorentz: noViews :: forall {k1} {k2} contract (cp :: k1) (st :: k2). contract cp st () -> contract cp st ()
+ Indigo.Lorentz: openChestT :: forall a (s :: [Type]). BytesLike a => (ChestKey : (ChestT a : (Natural : s))) :-> (OpenChestT a : s)
+ Indigo.Lorentz: pattern EpAddress :: forall (kind :: AddressKind). () => KindedAddress kind -> EpName -> EpAddress
+ Indigo.Lorentz: reifyDataType :: Name -> Q (Name, Cxt, Maybe Kind, [TyVarBndr ()], [Con])
+ Indigo.Lorentz: renderViewsDescriptorDoc :: ViewsDescriptorHasDoc vd => Proxy vd -> Builder
+ Indigo.Lorentz: setFieldOpen :: forall dt (name :: Symbol) new (st :: [Type]). InstrSetFieldC dt name => ('[new, GetFieldType dt name] :-> '[GetFieldType dt name]) -> Label name -> (new : (dt : st)) :-> (dt : st)
+ Indigo.Lorentz: setViews :: forall vd cp st. (RecFromTuple (Rec (ContractView st) (RevealViews vd)), NiceViewsDescriptor vd) => IsoRecTuple (Rec (ContractView st) (RevealViews vd)) -> ContractData cp st () -> ContractData cp st vd
+ Indigo.Lorentz: setViewsRec :: forall vd cp st. NiceViewsDescriptor vd => Rec (ContractView st) (RevealViews vd) -> ContractData cp st () -> ContractData cp st vd
+ Indigo.Lorentz: simpleFailUsing :: forall e (s :: [Type]) (t :: [Type]). IsError e => e -> s :-> t
+ Indigo.Lorentz: sopGetField :: forall {k} ftype store (fname :: k) (s :: [Type]). (Dupable ftype, HasDupableGetters store) => StoreFieldOps store fname ftype -> FieldRef fname -> (store : s) :-> (ftype : (store : s))
+ Indigo.Lorentz: sopSetField :: forall {k} store (fname :: k) ftype (s :: [Type]). StoreFieldOps store fname ftype -> FieldRef fname -> (ftype : (store : s)) :-> (store : s)
+ Indigo.Lorentz: stAlias :: forall {k} (alias :: k). FieldRef (FieldAlias alias)
+ Indigo.Lorentz: stGetAndUpdate :: forall {k} store (mname :: k) key value (s :: [Type]). StoreHasSubmap store mname key value => FieldRef mname -> (key : (Maybe value : (store : s))) :-> (Maybe value : (store : s))
+ Indigo.Lorentz: stGetFieldNamed :: forall {k} store (fname :: k) ftype (s :: [Type]). (StoreHasField store fname ftype, FieldRefHasFinalName fname, Dupable ftype, HasDupableGetters store) => FieldRef fname -> (store : s) :-> ((FieldRefFinalName fname :! ftype) : (store : s))
+ Indigo.Lorentz: stNested :: StNestedImpl f SelfRef => f
+ Indigo.Lorentz: stNickname :: forall (name :: Symbol). Label name -> FieldRef (FieldAlias name)
+ Indigo.Lorentz: stToFieldNamed :: forall {k} store (fname :: k) ftype (s :: [Type]). (StoreHasField store fname ftype, FieldRefHasFinalName fname) => FieldRef fname -> (store : s) :-> ((FieldRefFinalName fname :! ftype) : s)
+ Indigo.Lorentz: this :: forall (p :: FieldRefTag). SelfRef p
+ Indigo.Lorentz: toMichelsonContract :: Contract cp st vd -> Contract (ToT cp) (ToT st)
+ Indigo.Lorentz: type Address = Constrained NullConstraint :: AddressKind -> Constraint KindedAddress
+ Indigo.Lorentz: type CustomErrorRep (tag :: Symbol) = CustomErrorArgRep ErrorArg tag
+ Indigo.Lorentz: type DefUnaryArithOpExtraConstraints aop :: k n :: T = ();
+ Indigo.Lorentz: type Dupable a = (ProperDupableBetterErrors ToT a, KnownValue a)
+ Indigo.Lorentz: type EntrypointKindOverride ep = ep;
+ Indigo.Lorentz: type FieldNickname (alias :: Symbol) = FieldAlias alias
+ Indigo.Lorentz: type FieldRef (name :: k) = FieldRefObject name 'FieldRefTag
+ Indigo.Lorentz: type FieldRefKind = FieldRefTag -> Type
+ Indigo.Lorentz: type FieldSymRef (name :: Symbol) = FieldRef name
+ Indigo.Lorentz: type FlattenedEntrypointsKind = FlattenedEntrypointsKindHiding '[] :: [Symbol]
+ Indigo.Lorentz: type Fn a b = '[a] :-> '[b]
+ Indigo.Lorentz: type KeyHash = Hash 'HashKindPublicKey
+ Indigo.Lorentz: type MustHaveErrorArg (errorTag :: Symbol) expectedArgRep = FailUnlessEqual CustomErrorRep errorTag expectedArgRep 'Text "Error argument type is " :<>: 'ShowType expectedArgRep :<>: 'Text " but given error requires argument of type " :<>: 'ShowType CustomErrorRep errorTag
+ Indigo.Lorentz: type NiceNoBigMap n = (KnownValue n, HasNoBigMap ToT n)
+ Indigo.Lorentz: type NiceStorageFull a = (NiceStorage a, HasAnnotation a)
+ Indigo.Lorentz: type NiceUntypedValue a = (ProperUntypedValBetterErrors ToT a, KnownValue a)
+ Indigo.Lorentz: type NiceViewable a = (ProperViewableBetterErrors ToT a, KnownValue a)
+ Indigo.Lorentz: type NiceViews (vs :: [ViewTyInfo]) = RequireAllUnique "view" ViewsNames vs
+ Indigo.Lorentz: type NiceViewsDescriptor vd = NiceViews RevealViews vd
+ Indigo.Lorentz: type Unwrappabled s = GUnwrappabled s Rep s;
+ Indigo.Lorentz: type ViewCode arg st ret = '[(arg, st)] :-> '[ret]
+ Indigo.Lorentz: type WellTypedToT a = (IsoValue a, WellTyped ToT a)
+ Indigo.Lorentz: typeDocBuiltMichelsonRep :: TypeHasDoc a => Proxy a -> Builder
+ Indigo.Lorentz: typeFieldNamingStrategy :: TypeHasFieldNamingStrategy a => Text -> Text
+ Indigo.Lorentz: tz :: QuasiQuoter
+ Indigo.Lorentz: unsafeCoerceWrap :: forall a (s :: [Type]). Unwrappable a => (Unwrappabled a : s) :-> (a : s)
+ Indigo.Lorentz: unsafeConcreteTypeDocHaskellRep :: (Typeable a, GenericIsoValue a, GTypeHasDoc (Rep a)) => TypeDocHaskellRep b
+ Indigo.Lorentz: unsafeConcreteTypeDocMichelsonRep :: forall {k} a (b :: k). (Typeable a, KnownIsoT a) => TypeDocMichelsonRep b
+ Indigo.Lorentz: unsafeUnwrap_ :: forall dt (name :: Symbol) (st :: [Type]). InstrUnwrapC dt name => Label name -> (dt : st) :-> (CtorOnlyField name dt : st)
+ Indigo.Lorentz: verifyErrorTag :: IsCustomErrorArgRep a => MText -> a -> Either Text a
+ Indigo.Lorentz: viewsDescriptorName :: ViewsDescriptorHasDoc vd => Proxy vd -> Text
+ Indigo.Prelude: ApplicativeBoolean :: f bool -> ApplicativeBoolean (f :: k -> Type) (bool :: k)
+ Indigo.Prelude: [getDown] :: Down a -> a
+ Indigo.Prelude: all1 :: Boolean b => (a -> b) -> NonEmpty a -> b
+ Indigo.Prelude: and1 :: Boolean a => NonEmpty a -> a
+ Indigo.Prelude: any1 :: Boolean b => (a -> b) -> NonEmpty a -> b
+ Indigo.Prelude: class Boolean a
+ Indigo.Prelude: class Boolean a => BooleanMonoid a
+ Indigo.Prelude: class FromList l where {
+ Indigo.Prelude: false :: BooleanMonoid a => a
+ Indigo.Prelude: for :: (Traversable t, Applicative f) => t a -> (a -> f b) -> f (t b)
+ Indigo.Prelude: fromIntegralMaybe :: (Integral a, Integral b, Bits a, Bits b) => a -> Maybe b
+ Indigo.Prelude: fromIntegralNoOverflow :: (Integral a, Integral b) => a -> Either ArithException b
+ Indigo.Prelude: fromIntegralOverflowing :: (Integral a, Num b) => a -> b
+ Indigo.Prelude: fromIntegralToRealFrac :: (Integral a, RealFrac b, CheckIntSubType a Integer) => a -> b
+ Indigo.Prelude: fromList :: FromList l => [ListElement l] -> l
+ Indigo.Prelude: hoistEither :: forall (m :: Type -> Type) e a. Applicative m => Either e a -> ExceptT e m a
+ Indigo.Prelude: hoistMaybe :: forall (m :: Type -> Type) a. Applicative m => Maybe a -> MaybeT m a
+ Indigo.Prelude: naturalFromInt :: Int -> Natural
+ Indigo.Prelude: newtype ApplicativeBoolean (f :: k -> Type) (bool :: k)
+ Indigo.Prelude: or1 :: Boolean a => NonEmpty a -> a
+ Indigo.Prelude: safeFoldl1 :: Container t => (Element t -> Element t -> Element t) -> t -> Maybe (Element t)
+ Indigo.Prelude: safeFoldr1 :: Container t => (Element t -> Element t -> Element t) -> t -> Maybe (Element t)
+ Indigo.Prelude: safeMaximum :: Container t => t -> Maybe (Element t)
+ Indigo.Prelude: safeMinimum :: Container t => t -> Maybe (Element t)
+ Indigo.Prelude: someNE :: Alternative f => f a -> f (NonEmpty a)
+ Indigo.Prelude: true :: BooleanMonoid a => a
+ Indigo.Prelude: type CheckIntSubType a b = (CheckIntSubTypeErrors a b IsIntSubType a b, IsIntSubType a b ~ 'True)
+ Indigo.Prelude: type FromListC l = ();
+ Indigo.Prelude: type ListElement l = Item l;
+ Indigo.Prelude: type Type = Type
+ Indigo.Prelude: type Word62 = OddWord Word64 One One One One One Zero ()
+ Indigo.Prelude: type Word63 = OddWord Word64 One One One One One One ()
+ Indigo.Prelude: unsafe :: (HasCallStack, Buildable a) => Either a b -> b
+ Indigo.Prelude: unsafeM :: (MonadFail m, Buildable a) => Either a b -> m b
+ Indigo.Prelude: updateMVar' :: MonadIO m => MVar s -> StateT s IO a -> m a
+ Indigo.Prelude: updateTVar' :: TVar s -> StateT s STM a -> STM a
+ Indigo.Rebound: class IsLabel (x :: Symbol) a
+ Indigo.Rebound: fromInteger :: Integer -> NumType n t -> t
+ Indigo.Rebound: fromLabel :: IsLabel x a => a
+ Indigo.Rebound: ifThenElse :: (IfConstraint a b, IsExpr exa Bool) => exa -> IndigoM a -> IndigoM b -> IndigoM (RetVars a)
+ Indigo.Rebound: int :: NumType 'Int Integer
+ Indigo.Rebound: mutez :: NumType 'Mtz Mutez
+ Indigo.Rebound: nat :: NumType 'Nat Natural
- Indigo: (#) :: forall (a :: [Type]) (b :: [Type]) (c :: [Type]). (a :-> b) -> (b :-> c) -> a :-> c
+ Indigo: (#) :: (a :-> b) -> (b :-> c) -> a :-> c
- Indigo: (%) :: IsModExpr exN exM n m => exN -> exM -> Expr (EModOpResHs n m)
+ Indigo: (%) :: forall ratio exN exM n m reminder. IsModExpr exN exM n m ratio reminder => exN -> exM -> Expr reminder
- Indigo: (&&) :: IsArithExpr exN exM And n m => exN -> exM -> Expr (ArithResHs And n m)
+ Indigo: (&&) :: IsArithExpr exN exM And n m r => exN -> exM -> Expr r
- Indigo: (&&=) :: (IsExpr ex1 n, IsObject m, ArithOpHs And n m, ArithResHs And n m ~ m, HasCallStack) => Var m -> ex1 -> IndigoM ()
+ Indigo: (&&=) :: (IsExpr ex1 n, IsObject m, ArithOpHs And n m m, HasCallStack) => Var m -> ex1 -> IndigoM ()
- Indigo: (*) :: IsArithExpr exN exM Mul n m => exN -> exM -> Expr (ArithResHs Mul n m)
+ Indigo: (*) :: IsArithExpr exN exM Mul n m r => exN -> exM -> Expr r
- Indigo: (*=) :: (IsExpr ex1 n, IsObject m, ArithOpHs Mul n m, ArithResHs Mul n m ~ m, HasCallStack) => Var m -> ex1 -> IndigoM ()
+ Indigo: (*=) :: (IsExpr ex1 n, IsObject m, ArithOpHs Mul n m m, HasCallStack) => Var m -> ex1 -> IndigoM ()
- Indigo: (+) :: IsArithExpr exN exM Add n m => exN -> exM -> Expr (ArithResHs Add n m)
+ Indigo: (+) :: IsArithExpr exN exM Add n m r => exN -> exM -> Expr r
- Indigo: (++@) :: (StoreHasSubmap store name key value, IsError err, Buildable err, exKey :~> key, exVal :~> value, exStore :~> store) => exStore -> (Label name, err, exKey, exVal) -> Expr store
+ Indigo: (++@) :: (StoreHasSubmap store name key value, Dupable key, IsError err, Buildable err, exKey :~> key, exVal :~> value, exStore :~> store) => exStore -> (Label name, err, exKey, exVal) -> Expr store
- Indigo: (+=) :: (IsExpr ex1 n, IsObject m, ArithOpHs Add n m, ArithResHs Add n m ~ m, HasCallStack) => Var m -> ex1 -> IndigoM ()
+ Indigo: (+=) :: (IsExpr ex1 n, IsObject m, ArithOpHs Add n m m, HasCallStack) => Var m -> ex1 -> IndigoM ()
- Indigo: (-) :: IsArithExpr exN exM Sub n m => exN -> exM -> Expr (ArithResHs Sub n m)
+ Indigo: (-) :: IsArithExpr exN exM Sub n m r => exN -> exM -> Expr r
- Indigo: (-=) :: (IsExpr ex1 n, IsObject m, ArithOpHs Sub n m, ArithResHs Sub n m ~ m, HasCallStack) => Var m -> ex1 -> IndigoM ()
+ Indigo: (-=) :: (IsExpr ex1 n, IsObject m, ArithOpHs Sub n m m, HasCallStack) => Var m -> ex1 -> IndigoM ()
- Indigo: (/) :: IsDivExpr exN exM n m => exN -> exM -> Expr (EDivOpResHs n m)
+ Indigo: (/) :: forall reminder exN exM n m ratio. IsDivExpr exN exM n m ratio reminder => exN -> exM -> Expr ratio
- Indigo: (<<<) :: IsArithExpr exN exM Lsl n m => exN -> exM -> Expr (ArithResHs Lsl n m)
+ Indigo: (<<<) :: IsArithExpr exN exM Lsl n m r => exN -> exM -> Expr r
- Indigo: (<<<=) :: (IsExpr ex1 n, IsObject m, ArithOpHs Lsl n m, ArithResHs Lsl n m ~ m, HasCallStack) => Var m -> ex1 -> IndigoM ()
+ Indigo: (<<<=) :: (IsExpr ex1 n, IsObject m, ArithOpHs Lsl n m m, HasCallStack) => Var m -> ex1 -> IndigoM ()
- Indigo: (>>>) :: IsArithExpr exN exM Lsr n m => exN -> exM -> Expr (ArithResHs Lsr n m)
+ Indigo: (>>>) :: IsArithExpr exN exM Lsr n m r => exN -> exM -> Expr r
- Indigo: (>>>=) :: (IsExpr ex1 n, IsObject m, ArithOpHs Lsr n m, ArithResHs Lsr n m ~ m, HasCallStack) => Var m -> ex1 -> IndigoM ()
+ Indigo: (>>>=) :: (IsExpr ex1 n, IsObject m, ArithOpHs Lsr n m m, HasCallStack) => Var m -> ex1 -> IndigoM ()
- Indigo: (^) :: IsArithExpr exN exM Xor n m => exN -> exM -> Expr (ArithResHs Xor n m)
+ Indigo: (^) :: IsArithExpr exN exM Xor n m r => exN -> exM -> Expr r
- Indigo: (^=) :: (IsExpr ex1 n, IsObject m, ArithOpHs Xor n m, ArithResHs Xor n m ~ m, HasCallStack) => Var m -> ex1 -> IndigoM ()
+ Indigo: (^=) :: (IsExpr ex1 n, IsObject m, ArithOpHs Xor n m m, HasCallStack) => Var m -> ex1 -> IndigoM ()
- Indigo: (||) :: IsArithExpr exN exM Or n m => exN -> exM -> Expr (ArithResHs Or n m)
+ Indigo: (||) :: IsArithExpr exN exM Or n m r => exN -> exM -> Expr r
- Indigo: (||=) :: (IsExpr ex1 n, IsObject m, ArithOpHs Or n m, ArithResHs Or n m ~ m, HasCallStack) => Var m -> ex1 -> IndigoM ()
+ Indigo: (||=) :: (IsExpr ex1 n, IsObject m, ArithOpHs Or n m m, HasCallStack) => Var m -> ex1 -> IndigoM ()
- Indigo: All :: Bool -> All
+ Indigo: All :: a -> All a
- Indigo: Any :: Bool -> Any
+ Indigo: Any :: a -> Any a
- Indigo: CustomError :: Label tag -> ErrorArg tag -> CustomError (tag :: Symbol)
+ Indigo: CustomError :: Label tag -> CustomErrorRep tag -> CustomError (tag :: Symbol)
- Indigo: DEntrypointArg :: Maybe DType -> [ParamBuildingStep] -> Type -> DEntrypointArg
+ Indigo: DEntrypointArg :: Maybe SomeEntrypointArg -> [ParamBuildingStep] -> DEntrypointArg
- Indigo: StoreEntrypointOps :: (forall (s :: [Type]). () => Label epName -> (store : s) :-> (EntrypointLambda epParam epStore : s)) -> (forall (s :: [Type]). () => Label epName -> (EntrypointLambda epParam epStore : (store : s)) :-> (store : s)) -> (forall (s :: [Type]). () => Label epName -> (store : s) :-> (epStore : s)) -> (forall (s :: [Type]). () => Label epName -> (epStore : (store : s)) :-> (store : s)) -> StoreEntrypointOps store (epName :: Symbol) epParam epStore
+ Indigo: StoreEntrypointOps :: (forall (s :: [Type]). () => Label epName -> (store : s) :-> (EntrypointLambda epParam epStore : s)) -> (forall (s :: [Type]). HasDupableGetters store => Label epName -> (EntrypointLambda epParam epStore : (store : s)) :-> (store : s)) -> (forall (s :: [Type]). () => Label epName -> (store : s) :-> (epStore : s)) -> (forall (s :: [Type]). () => Label epName -> (epStore : (store : s)) :-> (store : s)) -> StoreEntrypointOps store (epName :: Symbol) epParam epStore
- Indigo: StoreFieldOps :: (forall (s :: [Type]). () => Label fname -> (store : s) :-> (ftype : s)) -> (forall (s :: [Type]). () => Label fname -> (ftype : (store : s)) :-> (store : s)) -> StoreFieldOps store (fname :: Symbol) ftype
+ Indigo: StoreFieldOps :: (forall (s :: [Type]). () => FieldRef fname -> (store : s) :-> (ftype : s)) -> (forall res (s :: [Type]). HasDupableGetters store => ('[ftype] :-> '[res, ftype]) -> ('[ftype] :-> '[res]) -> FieldRef fname -> (store : s) :-> (res : (store : s))) -> (forall new (s :: [Type]). () => ('[new, ftype] :-> '[ftype]) -> FieldRef fname -> (new : (store : s)) :-> (store : s)) -> StoreFieldOps store (fname :: k) ftype
- Indigo: StoreSubmapOps :: (forall (s :: [Type]). () => Label mname -> (key : (store : s)) :-> (Bool : s)) -> (forall (s :: [Type]). KnownValue value => Label mname -> (key : (store : s)) :-> (Maybe value : s)) -> (forall (s :: [Type]). () => Label mname -> (key : (Maybe value : (store : s))) :-> (store : s)) -> (forall (s :: [Type]). () => Label mname -> (key : (store : s)) :-> (store : s)) -> (forall (s :: [Type]). () => Label mname -> (key : (value : (store : s))) :-> (store : s)) -> StoreSubmapOps store (mname :: Symbol) key value
+ Indigo: StoreSubmapOps :: (forall (s :: [Type]). () => FieldRef mname -> (key : (store : s)) :-> (Bool : s)) -> (forall (s :: [Type]). KnownValue value => FieldRef mname -> (key : (store : s)) :-> (Maybe value : s)) -> (forall (s :: [Type]). () => FieldRef mname -> (key : (Maybe value : (store : s))) :-> (store : s)) -> (forall (s :: [Type]). () => FieldRef mname -> (key : (Maybe value : (store : s))) :-> (Maybe value : (store : s))) -> (forall (s :: [Type]). () => FieldRef mname -> (key : (store : s)) :-> (store : s)) -> (forall (s :: [Type]). () => FieldRef mname -> (key : (value : (store : s))) :-> (store : s)) -> StoreSubmapOps store (mname :: k) key value
- Indigo: TAddress :: Address -> TAddress (p :: k)
+ Indigo: TAddress :: Address -> TAddress p vd
- Indigo: [:&] :: forall u (a :: u -> Type) (r :: u) (rs :: [u]). !a r -> !Rec a rs -> Rec a (r : rs)
+ Indigo: [:&] :: forall {u} (a :: u -> Type) (r :: u) (rs :: [u]). !a r -> !Rec a rs -> Rec a (r : rs)
- Indigo: [Add] :: (ArithOpHs Add n m, KnownValue (ArithResHs Add n m)) => Expr n -> Expr m -> Expr (ArithResHs Add n m)
+ Indigo: [Add] :: (ArithOpHs Add n m r, KnownValue r) => Expr n -> Expr m -> Expr r
- Indigo: [And] :: (ArithOpHs And n m, KnownValue (ArithResHs And n m)) => Expr n -> Expr m -> Expr (ArithResHs And n m)
+ Indigo: [And] :: (ArithOpHs And n m r, KnownValue r) => Expr n -> Expr m -> Expr r
- Indigo: [ContractCallingUnsafe] :: NiceParameter arg => EpName -> Expr Address -> Expr (Maybe (ContractRef arg))
+ Indigo: [ContractCallingUnsafe] :: (NiceParameter arg, IsoValue (ContractRef arg)) => EpName -> Expr Address -> Expr (Maybe (ContractRef arg))
- Indigo: [Contract] :: (NiceParameterFull p, NoExplicitDefaultEntrypoint p, ToTAddress p addr, ToT addr ~ ToT Address) => Expr addr -> Expr (Maybe (ContractRef p))
+ Indigo: [Contract] :: (NiceParameterFull p, NoExplicitDefaultEntrypoint p, IsoValue (ContractRef p), ToTAddress p vd addr, ToT addr ~ ToT Address) => Proxy vd -> Expr addr -> Expr (Maybe (ContractRef p))
- Indigo: [ConvertEpAddressToContract] :: NiceParameter p => Expr EpAddress -> Expr (Maybe (ContractRef p))
+ Indigo: [ConvertEpAddressToContract] :: (NiceParameter p, IsoValue (ContractRef p)) => Expr EpAddress -> Expr (Maybe (ContractRef p))
- Indigo: [Div] :: (EDivOpHs n m, KnownValue (EDivOpResHs n m)) => Expr n -> Expr m -> Expr (EDivOpResHs n m)
+ Indigo: [Div] :: (KnownValue ratio, ArithOpHs EDiv n m (Maybe (ratio, reminder))) => Expr n -> Expr m -> Proxy reminder -> Expr ratio
- Indigo: [Lsl] :: (ArithOpHs Lsl n m, KnownValue (ArithResHs Lsl n m)) => Expr n -> Expr m -> Expr (ArithResHs Lsl n m)
+ Indigo: [Lsl] :: (ArithOpHs Lsl n m r, KnownValue r) => Expr n -> Expr m -> Expr r
- Indigo: [Lsr] :: (ArithOpHs Lsr n m, KnownValue (ArithResHs Lsr n m)) => Expr n -> Expr m -> Expr (ArithResHs Lsr n m)
+ Indigo: [Lsr] :: (ArithOpHs Lsr n m r, KnownValue r) => Expr n -> Expr m -> Expr r
- Indigo: [MakeView] :: KnownValue (View a r) => Expr a -> Expr (ContractRef r) -> Expr (View a r)
+ Indigo: [MakeView] :: KnownValue (View_ a r) => Expr a -> Expr (ContractRef r) -> Expr (View_ a r)
- Indigo: [Mod] :: (EDivOpHs n m, KnownValue (EModOpResHs n m)) => Expr n -> Expr m -> Expr (EModOpResHs n m)
+ Indigo: [Mod] :: (KnownValue reminder, ArithOpHs EDiv n m (Maybe (ratio, reminder))) => Expr n -> Expr m -> Proxy ratio -> Expr reminder
- Indigo: [Mul] :: (ArithOpHs Mul n m, KnownValue (ArithResHs Mul n m)) => Expr n -> Expr m -> Expr (ArithResHs Mul n m)
+ Indigo: [Mul] :: (ArithOpHs Mul n m r, KnownValue r) => Expr n -> Expr m -> Expr r
- Indigo: [NoRef] :: KnownValue a => StkEl a
+ Indigo: [NoRef] :: (KnownValue a, KnownIsoT a) => StkEl a
- Indigo: [Or] :: (ArithOpHs Or n m, KnownValue (ArithResHs Or n m)) => Expr n -> Expr m -> Expr (ArithResHs Or n m)
+ Indigo: [Or] :: (ArithOpHs Or n m r, KnownValue r) => Expr n -> Expr m -> Expr r
- Indigo: [RNil] :: forall u (a :: u -> Type). Rec a ('[] :: [u])
+ Indigo: [RNil] :: forall {u} (a :: u -> Type). Rec a ('[] :: [u])
- Indigo: [Ref] :: KnownValue a => RefId -> StkEl a
+ Indigo: [Ref] :: (KnownValue a, KnownIsoT a) => RefId -> StkEl a
- Indigo: [RunFutureContract] :: NiceParameter p => Expr (FutureContract p) -> Expr (Maybe (ContractRef p))
+ Indigo: [RunFutureContract] :: (NiceParameter p, IsoValue (ContractRef p)) => Expr (FutureContract p) -> Expr (Maybe (ContractRef p))
- Indigo: [Self] :: (NiceParameterFull p, NoExplicitDefaultEntrypoint p) => Expr (ContractRef p)
+ Indigo: [Self] :: (NiceParameterFull p, NoExplicitDefaultEntrypoint p, IsoValue (ContractRef p), IsNotInView) => Expr (ContractRef p)
- Indigo: [SomeContractCode] :: forall cp st. (NiceParameterFull cp, NiceStorage st) => ContractCode cp st -> SomeContractCode
+ Indigo: [SomeContractCode] :: forall cp st. (NiceParameter cp, NiceStorage st) => ContractCode cp st -> SomeContractCode
- Indigo: [StInsertNew] :: (StoreHasSubmap store name key value, KnownValue store, IsError err, Buildable err) => Label name -> err -> Expr key -> Expr value -> Expr store -> Expr store
+ Indigo: [StInsertNew] :: (StoreHasSubmap store name key value, KnownValue store, Dupable key, IsError err, Buildable err) => Label name -> err -> Expr key -> Expr value -> Expr store -> Expr store
- Indigo: [Sub] :: (ArithOpHs Sub n m, KnownValue (ArithResHs Sub n m)) => Expr n -> Expr m -> Expr (ArithResHs Sub n m)
+ Indigo: [Sub] :: (ArithOpHs Sub n m r, KnownValue r) => Expr n -> Expr m -> Expr r
- Indigo: [Xor] :: (ArithOpHs Xor n m, KnownValue (ArithResHs Xor n m)) => Expr n -> Expr m -> Expr (ArithResHs Xor n m)
+ Indigo: [Xor] :: (ArithOpHs Xor n m r, KnownValue r) => Expr n -> Expr m -> Expr r
- Indigo: [ceArg] :: CustomError (tag :: Symbol) -> ErrorArg tag
+ Indigo: [ceArg] :: CustomError (tag :: Symbol) -> CustomErrorRep tag
- Indigo: [epaArg] :: DEntrypointArg -> Maybe DType
+ Indigo: [epaArg] :: DEntrypointArg -> Maybe SomeEntrypointArg
- Indigo: [getAll] :: All -> Bool
+ Indigo: [getAll] :: All a -> a
- Indigo: [getAny] :: Any -> Bool
+ Indigo: [getAny] :: Any a -> a
- Indigo: [sopDelete] :: StoreSubmapOps store (mname :: Symbol) key value -> forall (s :: [Type]). () => Label mname -> (key : (store : s)) :-> (store : s)
+ Indigo: [sopDelete] :: StoreSubmapOps store (mname :: k) key value -> forall (s :: [Type]). () => FieldRef mname -> (key : (store : s)) :-> (store : s)
- Indigo: [sopGet] :: StoreSubmapOps store (mname :: Symbol) key value -> forall (s :: [Type]). KnownValue value => Label mname -> (key : (store : s)) :-> (Maybe value : s)
+ Indigo: [sopGet] :: StoreSubmapOps store (mname :: k) key value -> forall (s :: [Type]). KnownValue value => FieldRef mname -> (key : (store : s)) :-> (Maybe value : s)
- Indigo: [sopInsert] :: StoreSubmapOps store (mname :: Symbol) key value -> forall (s :: [Type]). () => Label mname -> (key : (value : (store : s))) :-> (store : s)
+ Indigo: [sopInsert] :: StoreSubmapOps store (mname :: k) key value -> forall (s :: [Type]). () => FieldRef mname -> (key : (value : (store : s))) :-> (store : s)
- Indigo: [sopMem] :: StoreSubmapOps store (mname :: Symbol) key value -> forall (s :: [Type]). () => Label mname -> (key : (store : s)) :-> (Bool : s)
+ Indigo: [sopMem] :: StoreSubmapOps store (mname :: k) key value -> forall (s :: [Type]). () => FieldRef mname -> (key : (store : s)) :-> (Bool : s)
- Indigo: [sopSetEpLambda] :: StoreEntrypointOps store (epName :: Symbol) epParam epStore -> forall (s :: [Type]). () => Label epName -> (EntrypointLambda epParam epStore : (store : s)) :-> (store : s)
+ Indigo: [sopSetEpLambda] :: StoreEntrypointOps store (epName :: Symbol) epParam epStore -> forall (s :: [Type]). HasDupableGetters store => Label epName -> (EntrypointLambda epParam epStore : (store : s)) :-> (store : s)
- Indigo: [sopToField] :: StoreFieldOps store (fname :: Symbol) ftype -> forall (s :: [Type]). () => Label fname -> (store : s) :-> (ftype : s)
+ Indigo: [sopToField] :: StoreFieldOps store (fname :: k) ftype -> forall (s :: [Type]). () => FieldRef fname -> (store : s) :-> (ftype : s)
- Indigo: [sopUpdate] :: StoreSubmapOps store (mname :: Symbol) key value -> forall (s :: [Type]). () => Label mname -> (key : (Maybe value : (store : s))) :-> (store : s)
+ Indigo: [sopUpdate] :: StoreSubmapOps store (mname :: k) key value -> forall (s :: [Type]). () => FieldRef mname -> (key : (Maybe value : (store : s))) :-> (store : s)
- Indigo: [unTAddress] :: TAddress (p :: k) -> Address
+ Indigo: [unTAddress] :: TAddress p vd -> Address
- Indigo: add :: IsArithExpr exN exM Add n m => exN -> exM -> Expr (ArithResHs Add n m)
+ Indigo: add :: IsArithExpr exN exM Add n m r => exN -> exM -> Expr r
- Indigo: all :: Container t => (Element t -> Bool) -> t -> Bool
+ Indigo: all :: (Container c, BooleanMonoid b) => (Element c -> b) -> c -> b
- Indigo: allowCheckedCoerce :: forall k1 k2 (a :: k1) (b :: k2). Dict (CanCastTo a b, CanCastTo b a)
+ Indigo: allowCheckedCoerce :: forall {k1} {k2} (a :: k1) (b :: k2). Dict (CanCastTo a b, CanCastTo b a)
- Indigo: allowCheckedCoerceTo :: forall k1 k2 (b :: k1) (a :: k2). Dict (CanCastTo a b)
+ Indigo: allowCheckedCoerceTo :: forall {k1} {k2} (b :: k1) (a :: k2). Dict (CanCastTo a b)
- Indigo: and :: IsArithExpr exN exM And n m => exN -> exM -> Expr (ArithResHs And n m)
+ Indigo: and :: IsArithExpr exN exM And n m r => exN -> exM -> Expr r
- Indigo: any :: Container t => (Element t -> Bool) -> t -> Bool
+ Indigo: any :: (Container c, BooleanMonoid b) => (Element c -> b) -> c -> b
- Indigo: assertCustom :: forall tag err errEx ex. (err ~ ErrorArg tag, CustomErrorHasDoc tag, NiceConstant err, IsExpr errEx err, IsExpr ex Bool, HasCallStack) => Label tag -> errEx -> ex -> IndigoM ()
+ Indigo: assertCustom :: forall tag err errEx ex. (MustHaveErrorArg tag (MText, err), CustomErrorHasDoc tag, NiceConstant err, IsExpr errEx err, IsExpr ex Bool, HasCallStack) => Label tag -> errEx -> ex -> IndigoM ()
- Indigo: assertCustom_ :: forall tag notVoidErrorMsg ex. (RequireNoArgError tag notVoidErrorMsg, CustomErrorHasDoc tag, IsExpr ex Bool, HasCallStack) => Label tag -> ex -> IndigoM ()
+ Indigo: assertCustom_ :: forall tag ex. (MustHaveErrorArg tag (MText, ()), CustomErrorHasDoc tag, IsExpr ex Bool, HasCallStack) => Label tag -> ex -> IndigoM ()
- Indigo: class (ArithOp aop ToT n ToT m, NiceComparable n, NiceComparable m, ToT ArithResHs aop n m ~ ArithRes aop ToT n ToT m) => ArithOpHs aop n m where {
+ Indigo: class ArithOpHs aop n m r
- Indigo: class (IsoValue a, HasNoNestedBigMaps ToT a) => CanHaveBigMap a
+ Indigo: class (HasNoNestedBigMaps ToT a, IsoValue a) => CanHaveBigMap a
- Indigo: class (KnownSymbol tag, TypeHasDoc ErrorArg tag, IsError CustomError tag) => CustomErrorHasDoc (tag :: Symbol)
+ Indigo: class (KnownSymbol tag, TypeHasDoc CustomErrorRep tag, IsError CustomError tag) => CustomErrorHasDoc (tag :: Symbol)
- Indigo: class Typeable ep => EntrypointKindHasDoc ep
+ Indigo: class Typeable ep => EntrypointKindHasDoc ep where {
- Indigo: class (Typeable e, ErrorHasDoc e) => IsError e
+ Indigo: class ErrorHasDoc e => IsError e
- Indigo: class (IsoValue a, ForbidBigMap ToT a) => NoBigMap a
+ Indigo: class (ForbidBigMap ToT a, IsoValue a) => NoBigMap a
- Indigo: class (IsoValue a, ForbidContract ToT a) => NoContractType a
+ Indigo: class (ForbidContract ToT a, IsoValue a) => NoContractType a
- Indigo: class (IsoValue a, ForbidOp ToT a) => NoOperation a
+ Indigo: class (ForbidOp ToT a, IsoValue a) => NoOperation a
- Indigo: class StoreHasField store (fname :: Symbol) ftype | store fname -> ftype
+ Indigo: class StoreHasField store (fname :: k) ftype | store fname -> ftype
- Indigo: class StoreHasSubmap store (mname :: Symbol) key value | store mname -> key value
+ Indigo: class StoreHasSubmap store (mname :: k) key value | store mname -> key value
- Indigo: class ToTAddress cp a
+ Indigo: class ToTAddress cp vd a
- Indigo: class (UnaryArithOp aop ToT n, NiceComparable n, ToT UnaryArithResHs aop n ~ UnaryArithRes aop ToT n) => UnaryArithOpHs aop n where {
+ Indigo: class UnaryArithOpHs aop n where {
- Indigo: class ToT s ~ ToT Unwrappable s => Wrappable s where {
+ Indigo: class Unwrappable s => Wrappable s
- Indigo: coerceUnwrap :: forall a (s :: [Type]). Wrappable a => (a : s) :-> (Unwrappable a : s)
+ Indigo: coerceUnwrap :: forall a (s :: [Type]). Unwrappable a => (a : s) :-> (Unwrappabled a : s)
- Indigo: coerceWrap :: forall a (s :: [Type]). Wrappable a => (Unwrappable a : s) :-> (a : s)
+ Indigo: coerceWrap :: forall a (s :: [Type]). Wrappable a => (Unwrappabled a : s) :-> (a : s)
- Indigo: compileLorentzContract :: (NiceParameterFull cp, NiceStorage st) => Contract cp st -> Contract (ToT cp) (ToT st)
+ Indigo: compileLorentzContract :: ContractData cp st vd -> Contract cp st vd
- Indigo: composeStoreEntrypointOps :: forall (nameInStore :: Symbol) store substore (epName :: Symbol) epParam epStore. Label nameInStore -> StoreFieldOps store nameInStore substore -> StoreEntrypointOps substore epName epParam epStore -> StoreEntrypointOps store epName epParam epStore
+ Indigo: composeStoreEntrypointOps :: forall {k} store substore (nameInStore :: k) (epName :: Symbol) epParam epStore. (HasDupableGetters store, Dupable substore) => FieldRef nameInStore -> StoreFieldOps store nameInStore substore -> StoreEntrypointOps substore epName epParam epStore -> StoreEntrypointOps store epName epParam epStore
- Indigo: composeStoreFieldOps :: forall (nameInStore :: Symbol) store substore (nameInSubstore :: Symbol) field. Label nameInStore -> StoreFieldOps store nameInStore substore -> StoreFieldOps substore nameInSubstore field -> StoreFieldOps store nameInSubstore field
+ Indigo: composeStoreFieldOps :: forall {k1} {k2} substore (nameInStore :: k1) store (nameInSubstore :: k2) field. HasDupableGetters substore => FieldRef nameInStore -> StoreFieldOps store nameInStore substore -> StoreFieldOps substore nameInSubstore field -> StoreFieldOps store nameInSubstore field
- Indigo: composeStoreSubmapOps :: forall (nameInStore :: Symbol) store substore (mname :: Symbol) key value. Label nameInStore -> StoreFieldOps store nameInStore substore -> StoreSubmapOps substore mname key value -> StoreSubmapOps store mname key value
+ Indigo: composeStoreSubmapOps :: forall {k1} {k2} store substore (nameInStore :: k1) (mname :: k2) key value. (HasDupableGetters store, Dupable substore) => FieldRef nameInStore -> StoreFieldOps store nameInStore substore -> StoreSubmapOps substore mname key value -> StoreSubmapOps store mname key value
- Indigo: concreteTypeDocMichelsonRep :: forall k a (b :: k). (Typeable a, SingI (ToT a), HaveCommonTypeCtor b a) => TypeDocMichelsonRep b
+ Indigo: concreteTypeDocMichelsonRep :: forall {k} a (b :: k). (Typeable a, KnownIsoT a, HaveCommonTypeCtor b a) => TypeDocMichelsonRep b
- Indigo: constructStack :: forall dt (fields :: [Type]) (st :: [Type]). (InstrConstructC dt, ToTs fields ~ ToTs (ConstructorFieldTypes dt), KnownList fields) => (fields ++ st) :-> (dt : st)
+ Indigo: constructStack :: forall dt (fields :: [Type]) (st :: [Type]). (InstrConstructC dt, fields ~ ConstructorFieldTypes dt, (ToTs fields ++ ToTs st) ~ ToTs (fields ++ st)) => (fields ++ st) :-> (dt : st)
- Indigo: contract :: (NiceParameterFull p, NoExplicitDefaultEntrypoint p, ToTAddress p addr, ToT addr ~ ToT Address, exAddr :~> addr) => exAddr -> Expr (Maybe (ContractRef p))
+ Indigo: contract :: forall p vd addr exAddr. (NiceParameterFull p, NoExplicitDefaultEntrypoint p, IsoValue (ContractRef p), ToTAddress p vd addr, ToT addr ~ ToT Address, exAddr :~> addr) => exAddr -> Expr (Maybe (ContractRef p))
- Indigo: contractCalling :: forall cp epRef epArg addr exAddr. (HasEntrypointArg cp epRef epArg, ToTAddress cp addr, ToT addr ~ ToT Address, exAddr :~> addr, KnownValue epArg, HasCallStack) => epRef -> exAddr -> IndigoM (Var (Maybe (ContractRef epArg)))
+ Indigo: contractCalling :: forall cp vd epRef epArg addr exAddr. (HasEntrypointArg cp epRef epArg, ToTAddress cp vd addr, ToT addr ~ ToT Address, exAddr :~> addr, KnownValue epArg, IsoValue (ContractRef epArg), HasCallStack) => epRef -> exAddr -> IndigoM (Var (Maybe (ContractRef epArg)))
- Indigo: contractCallingString :: (NiceParameter arg, exAddr :~> Address) => MText -> exAddr -> Expr (Maybe (ContractRef arg))
+ Indigo: contractCallingString :: (NiceParameter arg, IsoValue (ContractRef arg), exAddr :~> Address) => MText -> exAddr -> Expr (Maybe (ContractRef arg))
- Indigo: contractCallingUnsafe :: (NiceParameter arg, exAddr :~> Address) => EpName -> exAddr -> Expr (Maybe (ContractRef arg))
+ Indigo: contractCallingUnsafe :: (NiceParameter arg, IsoValue (ContractRef arg), exAddr :~> Address) => EpName -> exAddr -> Expr (Maybe (ContractRef arg))
- Indigo: convertEpAddressToContract :: (NiceParameter p, epExpr :~> EpAddress) => epExpr -> Expr (Maybe (ContractRef p))
+ Indigo: convertEpAddressToContract :: (NiceParameter p, IsoValue (ContractRef p), epExpr :~> EpAddress) => epExpr -> Expr (Maybe (ContractRef p))
- Indigo: createContract :: (IsObject st, IsExpr exk (Maybe KeyHash), IsExpr exm Mutez, IsExpr exs st, NiceStorage st, NiceParameterFull param, HasSideEffects, HasCallStack) => (HasStorage st => Var param -> IndigoM ()) -> exk -> exm -> exs -> IndigoM (Var Address)
+ Indigo: createContract :: forall st exk exm exs param. (IsObject st, IsExpr exk (Maybe KeyHash), IsExpr exm Mutez, IsExpr exs st, NiceStorageFull st, NiceParameterFull param, HasSideEffects, HasCallStack, IsNotInView) => (HasStorage st => Var param -> IndigoM ()) -> exk -> exm -> exs -> IndigoM (Var Address)
- Indigo: createLorentzContract :: (IsObject st, IsExpr exk (Maybe KeyHash), IsExpr exm Mutez, IsExpr exs st, NiceStorage st, NiceParameterFull param, HasSideEffects, HasCallStack) => Contract param st -> exk -> exm -> exs -> IndigoM (Var Address)
+ Indigo: createLorentzContract :: (IsObject st, IsExpr exk (Maybe KeyHash), IsExpr exm Mutez, IsExpr exs st, NiceStorage st, NiceParameterFull param, NiceViewsDescriptor vd, Typeable vd, HasSideEffects, HasCallStack, IsNotInView) => Contract param st vd -> exk -> exm -> exs -> IndigoM (Var Address)
- Indigo: data StoreFieldOps store (fname :: Symbol) ftype
+ Indigo: data StoreFieldOps store (fname :: k) ftype
- Indigo: data StoreSubmapOps store (mname :: Symbol) key value
+ Indigo: data StoreSubmapOps store (mname :: k) key value
- Indigo: deconstruct :: forall dt (fields :: [Type]) (st :: [Type]). (InstrDeconstructC dt, KnownList fields, ToTs fields ~ ToTs (ConstructorFieldTypes dt)) => (dt : st) :-> (fields ++ st)
+ Indigo: deconstruct :: forall dt (fields :: [Type]) (st :: [Type]). (InstrDeconstructC dt (ToTs st), fields ~ GFieldTypes (Rep dt) ('[] :: [Type]), (ToTs fields ++ ToTs st) ~ ToTs (fields ++ st)) => (dt : st) :-> (fields ++ st)
- Indigo: defContract :: HasCallStack => (HasSideEffects => IndigoM ()) -> HasSideEffects => IndigoProcedure
+ Indigo: defContract :: HasCallStack => ((HasSideEffects, IsNotInView) => IndigoM ()) -> (HasSideEffects, IsNotInView) => IndigoProcedure
- Indigo: defaultContract :: (NiceParameterFull cp, HasCallStack) => ContractCode cp st -> Contract cp st
+ Indigo: defaultContract :: (NiceParameterFull cp, NiceStorageFull st) => (IsNotInView => '[(cp, st)] :-> ContractOut st) -> Contract cp st ()
- Indigo: dipT :: forall a (inp :: [Type]) (dinp :: [Type]) (dout :: [Type]) (out :: [Type]). DipT inp a inp dinp dout out => (dinp :-> dout) -> inp :-> out
+ Indigo: dipT :: DipT a inp dipInp dipOut out => (dipInp :-> dipOut) -> inp :-> out
- Indigo: div :: IsDivExpr exN exM n m => exN -> exM -> Expr (EDivOpResHs n m)
+ Indigo: div :: forall reminder exN exM n m ratio. IsDivExpr exN exM n m ratio reminder => exN -> exM -> Expr ratio
- Indigo: documentEntrypoint :: forall kind (epName :: Symbol) param (s :: [Type]) (out :: [Type]). (KnownSymbol epName, DocItem (DEntrypoint kind), TypeHasDoc param, HasAnnotation param, KnownValue param) => ((param : s) :-> out) -> (param : s) :-> out
+ Indigo: documentEntrypoint :: forall kind (epName :: Symbol) param (s :: [Type]) (out :: [Type]). (KnownSymbol epName, DocItem (DEntrypoint kind), NiceParameter param, TypeHasDoc param) => ((param : s) :-> out) -> (param : s) :-> out
- Indigo: dropT :: forall a (inp :: [Type]) (dinp :: [Type]) (dout :: [Type]) (out :: [Type]). (DipT inp a inp dinp dout out, dinp ~ (a : dout)) => inp :-> out
+ Indigo: dropT :: forall a (inp :: [Type]) (dinp :: [Type]) (dout :: [Type]) (out :: [Type]). (DipT a inp dinp dout out, dinp ~ (a : dout)) => inp :-> out
- Indigo: dupT :: forall a (st :: [Type]). DupT st a st => st :-> (a : st)
+ Indigo: dupT :: DupT a st => st :-> (a : st)
- Indigo: errorFromVal :: forall (t :: T). (IsError e, KnownT t) => Value t -> Either Text e
+ Indigo: errorFromVal :: forall (t :: T). (IsError e, SingI t) => Value t -> Either Text e
- Indigo: errorFromValNumeric :: forall (t :: T) e. (KnownT t, IsError e) => ErrorTagMap -> Value t -> Either Text e
+ Indigo: errorFromValNumeric :: forall (t :: T) e. (SingI t, IsError e) => ErrorTagMap -> Value t -> Either Text e
- Indigo: errorToValNumeric :: IsError e => ErrorTagMap -> e -> (forall (t :: T). ErrorScope t => Value t -> r) -> r
+ Indigo: errorToValNumeric :: IsError e => ErrorTagMap -> e -> (forall (t :: T). ConstantScope t => Value t -> r) -> r
- Indigo: even :: Integral a => a -> Bool
+ Indigo: even :: (ParityExpr n m, ArithOpHs EDiv n m r, exN :~> n) => exN -> Expr Bool
- Indigo: failCustom :: forall ret tag err ex. (ReturnableValue ret, err ~ ErrorArg tag, CustomErrorHasDoc tag, NiceConstant err, ex :~> err, HasCallStack) => Label tag -> ex -> IndigoM (RetVars ret)
+ Indigo: failCustom :: forall ret tag err ex. (ReturnableValue ret, MustHaveErrorArg tag (MText, err), CustomErrorHasDoc tag, NiceConstant err, ex :~> err, HasCallStack) => Label tag -> ex -> IndigoM (RetVars ret)
- Indigo: failCustom_ :: forall ret tag notVoidErrorMsg. (ReturnableValue ret, RequireNoArgError tag notVoidErrorMsg, CustomErrorHasDoc tag, HasCallStack) => Label tag -> IndigoM (RetVars ret)
+ Indigo: failCustom_ :: forall ret tag. (ReturnableValue ret, MustHaveErrorArg tag (MText, ()), CustomErrorHasDoc tag, HasCallStack) => Label tag -> IndigoM (RetVars ret)
- Indigo: failUsing :: forall e (s :: [Type]) (t :: [Type]). IsError e => e -> s :-> t
+ Indigo: failUsing :: forall (s :: [Type]) (t :: [Type]). (IsError e, IsError e) => e -> s :-> t
- Indigo: failWith :: forall ret a ex. (IsExpr ex a, ReturnableValue ret, HasCallStack) => ex -> IndigoM (RetVars ret)
+ Indigo: failWith :: forall ret a ex. (NiceConstant a, IsExpr ex a, ReturnableValue ret, HasCallStack) => ex -> IndigoM (RetVars ret)
- Indigo: fieldLensDeeper :: forall dt targetName targetType fname. (AccessFieldC dt fname, HasFieldOfType dt fname (GetFieldType dt fname), HasField (GetFieldType dt fname) targetName targetType) => Label fname -> FieldLens dt targetName targetType
+ Indigo: fieldLensDeeper :: forall dt targetName targetType fname. (AccessFieldC dt fname, HasFieldOfType dt fname (GetFieldType dt fname), HasDupableGetters (GetFieldType dt fname), HasField (GetFieldType dt fname) targetName targetType) => Label fname -> FieldLens dt targetName targetType
- Indigo: foldl1 :: Container t => (Element t -> Element t -> Element t) -> t -> Element t
+ Indigo: foldl1 :: (a -> a -> a) -> NonEmpty a -> a
- Indigo: foldr1 :: Container t => (Element t -> Element t -> Element t) -> t -> Element t
+ Indigo: foldr1 :: (a -> a -> a) -> NonEmpty a -> a
- Indigo: fromIntegral :: (Integral a, Num b) => a -> b
+ Indigo: fromIntegral :: (Integral a, Integral b, CheckIntSubType a b) => a -> b
- Indigo: fromNamed :: forall (name :: Symbol) a (s :: [Type]). Label name -> (NamedF Identity a name : s) :-> (a : s)
+ Indigo: fromNamed :: forall (name :: Symbol) a (s :: [Type]). Label name -> ((name :! a) : s) :-> (a : s)
- Indigo: gForcedCoerce_ :: forall k t (a :: k) (b :: k) (s :: [Type]). MichelsonCoercible (t a) (t b) => (t a : s) :-> (t b : s)
+ Indigo: gForcedCoerce_ :: forall {k} t (a :: k) (b :: k) (s :: [Type]). MichelsonCoercible (t a) (t b) => (t a : s) :-> (t b : s)
- Indigo: getField :: forall dt (name :: Symbol) (st :: [Type]). InstrGetFieldC dt name => Label name -> (dt : st) :-> (GetFieldType dt name : (dt : st))
+ Indigo: getField :: forall dt (name :: Symbol) (st :: [Type]). (InstrGetFieldC dt name, Dupable (GetFieldType dt name), HasDupableGetters dt) => Label name -> (dt : st) :-> (GetFieldType dt name : (dt : st))
- Indigo: getFieldNamed :: forall dt (name :: Symbol) (st :: [Type]). InstrGetFieldC dt name => Label name -> (dt : st) :-> ((name :! GetFieldType dt name) : (dt : st))
+ Indigo: getFieldNamed :: forall dt (name :: Symbol) (st :: [Type]). (InstrGetFieldC dt name, Dupable (GetFieldType dt name), HasDupableGetters dt) => Label name -> (dt : st) :-> ((name :! GetFieldType dt name) : (dt : st))
- Indigo: haskellRepStripFieldPrefix :: HasCallStack => TypeDocHaskellRep a -> TypeDocHaskellRep a
+ Indigo: haskellRepStripFieldPrefix :: TypeDocHaskellRep a -> TypeDocHaskellRep a
- Indigo: homomorphicTypeDocMichelsonRep :: SingI (ToT a) => TypeDocMichelsonRep a
+ Indigo: homomorphicTypeDocMichelsonRep :: KnownIsoT a => TypeDocMichelsonRep a
- Indigo: infixl 0 `on`
+ Indigo: infixl 0 `hashWithSalt`
- Indigo: interpretLorentzInstr :: forall (inp :: [Type]) (out :: [Type]). (IsoValuesStack inp, IsoValuesStack out) => ContractEnv -> (inp :-> out) -> Rec Identity inp -> Either MichelsonFailed (Rec Identity out)
+ Indigo: interpretLorentzInstr :: forall (inp :: [Type]) (out :: [Type]). (IsoValuesStack inp, IsoValuesStack out) => ContractEnv -> (IsNotInView => inp :-> out) -> Rec Identity inp -> Either (MichelsonFailureWithStack Void) (Rec Identity out)
- Indigo: interpretLorentzLambda :: (IsoValue inp, IsoValue out) => ContractEnv -> Lambda inp out -> inp -> Either MichelsonFailed out
+ Indigo: interpretLorentzLambda :: (IsoValue inp, IsoValue out) => ContractEnv -> (IsNotInView => Fn inp out) -> inp -> Either (MichelsonFailureWithStack Void) out
- Indigo: isoErrorFromVal :: forall (t :: T) e. (Typeable t, Typeable (ToT e), IsoValue e) => Value t -> Either Text e
+ Indigo: isoErrorFromVal :: forall (t :: T) e. (SingI t, KnownIsoT e, IsoValue e) => Value t -> Either Text e
- Indigo: lEncodeValue :: NicePrintedValue a => a -> ByteString
+ Indigo: lEncodeValue :: NiceUntypedValue a => a -> ByteString
- Indigo: lsl :: IsArithExpr exN exM Lsl n m => exN -> exM -> Expr (ArithResHs Lsl n m)
+ Indigo: lsl :: IsArithExpr exN exM Lsl n m r => exN -> exM -> Expr r
- Indigo: lsr :: IsArithExpr exN exM Lsr n m => exN -> exM -> Expr (ArithResHs Lsr n m)
+ Indigo: lsr :: IsArithExpr exN exM Lsr n m r => exN -> exM -> Expr r
- Indigo: makeView :: (KnownValue (View a r), exa :~> a, exCRef :~> ContractRef r) => exa -> exCRef -> Expr (View a r)
+ Indigo: makeView :: (KnownValue (View_ a r), exa :~> a, exCRef :~> ContractRef r) => exa -> exCRef -> Expr (View_ a r)
- Indigo: mapAccumL :: Traversable t => (a -> b -> (a, c)) -> a -> t b -> (a, t c)
+ Indigo: mapAccumL :: Traversable t => (s -> a -> (s, b)) -> s -> t a -> (s, t b)
- Indigo: mapAccumR :: Traversable t => (a -> b -> (a, c)) -> a -> t b -> (a, t c)
+ Indigo: mapAccumR :: Traversable t => (s -> a -> (s, b)) -> s -> t a -> (s, t b)
- Indigo: mapStoreFieldOps :: forall field1 field2 store (name :: Symbol). LIso field1 field2 -> StoreFieldOps store name field1 -> StoreFieldOps store name field2
+ Indigo: mapStoreFieldOps :: forall {k} field1 field2 store (name :: k). KnownValue field1 => LIso field1 field2 -> StoreFieldOps store name field1 -> StoreFieldOps store name field2
- Indigo: mapStoreSubmapOpsKey :: forall key2 key1 store (name :: Symbol) value. Lambda key2 key1 -> StoreSubmapOps store name key1 value -> StoreSubmapOps store name key2 value
+ Indigo: mapStoreSubmapOpsKey :: forall {k} key2 key1 store (name :: k) value. Fn key2 key1 -> StoreSubmapOps store name key1 value -> StoreSubmapOps store name key2 value
- Indigo: mapStoreSubmapOpsValue :: forall value1 value2 store (name :: Symbol) key. KnownValue value1 => LIso value1 value2 -> StoreSubmapOps store name key value1 -> StoreSubmapOps store name key value2
+ Indigo: mapStoreSubmapOpsValue :: forall {k} value1 value2 store (name :: k) key. (KnownValue value1, KnownValue value2) => LIso value1 value2 -> StoreSubmapOps store name key value1 -> StoreSubmapOps store name key value2
- Indigo: maximum :: Container t => t -> Element t
+ Indigo: maximum :: Ord a => NonEmpty a -> a
- Indigo: maximumBy :: Foldable t => (a -> a -> Ordering) -> t a -> a
+ Indigo: maximumBy :: (a -> a -> Ordering) -> NonEmpty a -> a
- Indigo: minimum :: Container t => t -> Element t
+ Indigo: minimum :: Ord a => NonEmpty a -> a
- Indigo: minimumBy :: Foldable t => (a -> a -> Ordering) -> t a -> a
+ Indigo: minimumBy :: (a -> a -> Ordering) -> NonEmpty a -> a
- Indigo: mkDEntrypointArgSimple :: (KnownValue t, HasAnnotation t, TypeHasDoc t) => DEntrypointArg
+ Indigo: mkDEntrypointArgSimple :: (NiceParameter t, TypeHasDoc t) => DEntrypointArg
- Indigo: mkDEpUType :: (KnownValue t, HasAnnotation t) => Type
+ Indigo: mkDEpUType :: HasAnnotation t => Ty
- Indigo: mkUType :: forall (x :: T). SingI x => Notes x -> Type
+ Indigo: mkUType :: forall (x :: T). Notes x -> Ty
- Indigo: mod :: IsModExpr exN exM n m => exN -> exM -> Expr (EModOpResHs n m)
+ Indigo: mod :: forall ratio exN exM n m reminder. IsModExpr exN exM n m ratio reminder => exN -> exM -> Expr reminder
- Indigo: modifyField :: forall dt (name :: Symbol) (st :: [Type]). (InstrGetFieldC dt name, InstrSetFieldC dt name) => Label name -> (forall (st0 :: [Type]). () => (GetFieldType dt name : st0) :-> (GetFieldType dt name : st0)) -> (dt : st) :-> (dt : st)
+ Indigo: modifyField :: forall dt (name :: Symbol) (st :: [Type]). (InstrGetFieldC dt name, InstrSetFieldC dt name, Dupable (GetFieldType dt name), HasDupableGetters dt) => Label name -> (forall (st0 :: [Type]). () => (GetFieldType dt name : st0) :-> (GetFieldType dt name : st0)) -> (dt : st) :-> (dt : st)
- Indigo: mul :: IsArithExpr exN exM Mul n m => exN -> exM -> Expr (ArithResHs Mul n m)
+ Indigo: mul :: IsArithExpr exN exM Mul n m r => exN -> exM -> Expr r
- Indigo: newtype All
+ Indigo: newtype All a
- Indigo: newtype Any
+ Indigo: newtype Any a
- Indigo: newtype TAddress (p :: k)
+ Indigo: newtype TAddress p vd
- Indigo: odd :: Integral a => a -> Bool
+ Indigo: odd :: (ParityExpr n m, ArithOpHs EDiv n m r, exN :~> n) => exN -> Expr Bool
- Indigo: or :: IsArithExpr exN exM Or n m => exN -> exM -> Expr (ArithResHs Or n m)
+ Indigo: or :: IsArithExpr exN exM Or n m r => exN -> exM -> Expr r
- Indigo: parseLorentzValue :: KnownValue v => Text -> Either ParseLorentzError v
+ Indigo: parseLorentzValue :: KnownValue v => MichelsonSource -> Text -> Either ParseLorentzError v
- Indigo: printAsMichelson :: forall param st m. (IsObject st, NiceParameterFull param, NiceStorage st, MonadIO m) => CommentSettings -> IndigoContract param st -> m ()
+ Indigo: printAsMichelson :: forall param st m. (IsObject st, NiceParameterFull param, NiceStorageFull st, MonadIO m) => CommentSettings -> IndigoContract param st -> m ()
- Indigo: printDocumentation :: forall param st m. (IsObject st, NiceParameterFull param, MonadIO m) => IndigoContract param st -> m ()
+ Indigo: printDocumentation :: forall param st m. (IsObject st, NiceParameterFull param, NiceStorageFull st, MonadIO m) => IndigoContract param st -> m ()
- Indigo: printIndigoContract :: forall param st. (IsObject st, NiceParameterFull param, NiceStorage st) => Bool -> CommentSettings -> IndigoContract param st -> LText
+ Indigo: printIndigoContract :: forall param st. (IsObject st, NiceParameterFull param, NiceStorageFull st) => Bool -> CommentSettings -> IndigoContract param st -> LText
- Indigo: printLorentzContract :: (NiceParameterFull cp, NiceStorage st) => Bool -> Contract cp st -> LText
+ Indigo: printLorentzContract :: Bool -> Contract cp st vd -> LText
- Indigo: printLorentzValue :: NicePrintedValue v => Bool -> v -> LText
+ Indigo: printLorentzValue :: NiceUntypedValue v => Bool -> v -> LText
- Indigo: project :: forall arg r viewExpr exr. (KnownValue arg, NiceParameter r, viewExpr :~> View arg r, exr :~> r, HasSideEffects) => viewExpr -> (Expr arg -> IndigoM exr) -> IndigoM ()
+ Indigo: project :: forall arg r viewExpr exr. (KnownValue arg, NiceParameter r, viewExpr :~> View_ arg r, exr :~> r, HasSideEffects, IsNotInView) => viewExpr -> (Expr arg -> IndigoM exr) -> IndigoM ()
- Indigo: renderIndigoDoc :: forall param st. (IsObject st, NiceParameterFull param) => IndigoContract param st -> LText
+ Indigo: renderIndigoDoc :: forall param st. (IsObject st, NiceParameterFull param, NiceStorageFull st) => IndigoContract param st -> LText
- Indigo: runFutureContract :: (NiceParameter p, conExpr :~> FutureContract p) => conExpr -> Expr (Maybe (ContractRef p))
+ Indigo: runFutureContract :: (NiceParameter p, IsoValue (ContractRef p), conExpr :~> FutureContract p) => conExpr -> Expr (Maybe (ContractRef p))
- Indigo: saveAsMichelson :: forall param st m. (IsObject st, NiceParameterFull param, NiceStorage st, MonadIO m, MonadMask m) => CommentSettings -> IndigoContract param st -> FilePath -> m ()
+ Indigo: saveAsMichelson :: forall param st m. (IsObject st, NiceParameterFull param, NiceStorageFull st, MonadIO m, MonadMask m) => CommentSettings -> IndigoContract param st -> FilePath -> m ()
- Indigo: saveDocumentation :: forall param st m. (IsObject st, NiceParameterFull param, MonadIO m, MonadMask m) => IndigoContract param st -> FilePath -> m ()
+ Indigo: saveDocumentation :: forall param st m. (IsObject st, NiceParameterFull param, NiceStorageFull st, MonadIO m, MonadMask m) => IndigoContract param st -> FilePath -> m ()
- Indigo: self :: (NiceParameterFull p, NoExplicitDefaultEntrypoint p) => Expr (ContractRef p)
+ Indigo: self :: (NiceParameterFull p, NoExplicitDefaultEntrypoint p, IsoValue (ContractRef p), IsNotInView) => Expr (ContractRef p)
- Indigo: selfCalling :: forall p mname. (NiceParameterFull p, KnownValue (GetEntrypointArgCustom p mname), HasCallStack) => EntrypointRef mname -> IndigoM (Var (ContractRef (GetEntrypointArgCustom p mname)))
+ Indigo: selfCalling :: forall p mname. (NiceParameterFull p, KnownValue (GetEntrypointArgCustom p mname), IsoValue (ContractRef (GetEntrypointArgCustom p mname)), HasCallStack, IsNotInView) => EntrypointRef mname -> IndigoM (Var (ContractRef (GetEntrypointArgCustom p mname)))
- Indigo: seq :: a -> b -> b
+ Indigo: seq :: forall {r :: RuntimeRep} a (b :: TYPE r). a -> b -> b
- Indigo: sequenceStoreSubmapOps :: forall store substore value (name :: Symbol) (subName :: Symbol) key1 key2. (NiceConstant substore, KnownValue value) => Label name -> LIso (Maybe substore) substore -> StoreSubmapOps store name key1 substore -> StoreSubmapOps substore subName key2 value -> StoreSubmapOps store subName (key1, key2) value
+ Indigo: sequenceStoreSubmapOps :: forall {k1} {k2} store substore value (name :: k1) (subName :: k2) key1 key2. (NiceConstant substore, KnownValue value, Dupable (key1, key2), Dupable store) => FieldRef name -> LIso (Maybe substore) substore -> StoreSubmapOps store name key1 substore -> StoreSubmapOps substore subName key2 value -> StoreSubmapOps store subName (key1, key2) value
- Indigo: setDelegate :: (HasSideEffects, IsExpr ex (Maybe KeyHash), HasCallStack) => ex -> IndigoM ()
+ Indigo: setDelegate :: (HasSideEffects, IsExpr ex (Maybe KeyHash), HasCallStack, IsNotInView) => ex -> IndigoM ()
- Indigo: show :: forall b a. (Show a, IsString b) => a -> b
+ Indigo: show :: forall b a. (PrettyShow a, Show a, IsString b) => a -> b
- Indigo: stEntrypoint :: forall store (epName :: Symbol) epParam epStore (s :: [Type]). StoreHasEntrypoint store epName epParam epStore => Label epName -> (epParam : (store : s)) :-> (([Operation], store) : s)
+ Indigo: stEntrypoint :: forall store (epName :: Symbol) epParam epStore (s :: [Type]). (StoreHasEntrypoint store epName epParam epStore, Dupable store) => Label epName -> (epParam : (store : s)) :-> (([Operation], store) : s)
- Indigo: stGetEpLambda :: forall store (epName :: Symbol) epParam epStore (s :: [Type]). StoreHasEntrypoint store epName epParam epStore => Label epName -> (store : s) :-> (EntrypointLambda epParam epStore : (store : s))
+ Indigo: stGetEpLambda :: forall store (epName :: Symbol) epParam epStore (s :: [Type]). (StoreHasEntrypoint store epName epParam epStore, Dupable store) => Label epName -> (store : s) :-> (EntrypointLambda epParam epStore : (store : s))
- Indigo: stGetEpStore :: forall store (epName :: Symbol) epParam epStore (s :: [Type]). StoreHasEntrypoint store epName epParam epStore => Label epName -> (store : s) :-> (epStore : (store : s))
+ Indigo: stGetEpStore :: forall store (epName :: Symbol) epParam epStore (s :: [Type]). (StoreHasEntrypoint store epName epParam epStore, Dupable store) => Label epName -> (store : s) :-> (epStore : (store : s))
- Indigo: stGetField :: forall store (fname :: Symbol) ftype (s :: [Type]). StoreHasField store fname ftype => Label fname -> (store : s) :-> (ftype : (store : s))
+ Indigo: stGetField :: forall {k} store (fname :: k) ftype (s :: [Type]). (StoreHasField store fname ftype, Dupable ftype, HasDupableGetters store) => FieldRef fname -> (store : s) :-> (ftype : (store : s))
- Indigo: stInsertNew :: (StoreHasSubmap store name key value, IsError err, Buildable err, exKey :~> key, exVal :~> value, exStore :~> store) => exStore -> (Label name, err, exKey, exVal) -> Expr store
+ Indigo: stInsertNew :: (StoreHasSubmap store name key value, Dupable key, IsError err, Buildable err, exKey :~> key, exVal :~> value, exStore :~> store) => exStore -> (Label name, err, exKey, exVal) -> Expr store
- Indigo: stSetEpLambda :: forall store (epName :: Symbol) epParam epStore (s :: [Type]). StoreHasEntrypoint store epName epParam epStore => Label epName -> (EntrypointLambda epParam epStore : (store : s)) :-> (store : s)
+ Indigo: stSetEpLambda :: forall store (epName :: Symbol) epParam epStore (s :: [Type]). (StoreHasEntrypoint store epName epParam epStore, HasDupableGetters store) => Label epName -> (EntrypointLambda epParam epStore : (store : s)) :-> (store : s)
- Indigo: stSetField :: forall store (fname :: Symbol) ftype (s :: [Type]). StoreHasField store fname ftype => Label fname -> (ftype : (store : s)) :-> (store : s)
+ Indigo: stSetField :: forall {k} store (fname :: k) ftype (s :: [Type]). StoreHasField store fname ftype => FieldRef fname -> (ftype : (store : s)) :-> (store : s)
- Indigo: stToField :: forall store (fname :: Symbol) ftype (s :: [Type]). StoreHasField store fname ftype => Label fname -> (store : s) :-> (ftype : s)
+ Indigo: stToField :: forall {k} store (fname :: k) ftype (s :: [Type]). StoreHasField store fname ftype => FieldRef fname -> (store : s) :-> (ftype : s)
- Indigo: stackRef :: forall (gn :: Nat) (st :: [T]) (n :: Peano). (n ~ ToPeano gn, SingI n, KnownPeano n, RequireLongerThan st n) => PrintComment st
+ Indigo: stackRef :: forall (gn :: Nat) (st :: [T]) (n :: Peano). (n ~ ToPeano gn, SingI n, RequireLongerThan st n) => PrintComment st
- Indigo: storeEntrypointOpsDeeper :: forall store (nameInStore :: Symbol) substore (epName :: Symbol) epParam epStore. (HasFieldOfType store nameInStore substore, StoreHasEntrypoint substore epName epParam epStore) => Label nameInStore -> StoreEntrypointOps store epName epParam epStore
+ Indigo: storeEntrypointOpsDeeper :: forall store (nameInStore :: Symbol) substore (epName :: Symbol) epParam epStore. (HasFieldOfType store nameInStore substore, StoreHasEntrypoint substore epName epParam epStore, HasDupableGetters store, Dupable substore) => FieldRef nameInStore -> StoreEntrypointOps store epName epParam epStore
- Indigo: storeFieldOpsDeeper :: forall storage (fieldsPartName :: Symbol) fields (fname :: Symbol) ftype. (HasFieldOfType storage fieldsPartName fields, StoreHasField fields fname ftype) => Label fieldsPartName -> StoreFieldOps storage fname ftype
+ Indigo: storeFieldOpsDeeper :: forall {k} storage (fieldsPartName :: Symbol) fields (fname :: k) ftype. (HasFieldOfType storage fieldsPartName fields, StoreHasField fields fname ftype, HasDupableGetters fields) => FieldRef fieldsPartName -> StoreFieldOps storage fname ftype
- Indigo: storeFieldOpsReferTo :: forall (name :: Symbol) storage field (desiredName :: Symbol). Label name -> StoreFieldOps storage name field -> StoreFieldOps storage desiredName field
+ Indigo: storeFieldOpsReferTo :: forall {k1} {k2} (name :: k1) storage field (desiredName :: k2). FieldRef name -> StoreFieldOps storage name field -> StoreFieldOps storage desiredName field
- Indigo: storeSubmapOpsDeeper :: forall storage (bigMapPartName :: Symbol) fields (mname :: Symbol) key value. (HasFieldOfType storage bigMapPartName fields, StoreHasSubmap fields mname key value) => Label bigMapPartName -> StoreSubmapOps storage mname key value
+ Indigo: storeSubmapOpsDeeper :: forall {k} storage (bigMapPartName :: Symbol) fields key value (mname :: k). (HasFieldOfType storage bigMapPartName fields, StoreHasSubmap fields SelfRef key value, HasDupableGetters storage, Dupable fields) => FieldRef bigMapPartName -> StoreSubmapOps storage mname key value
- Indigo: storeSubmapOpsReferTo :: forall (name :: Symbol) storage key value (desiredName :: Symbol). Label name -> StoreSubmapOps storage name key value -> StoreSubmapOps storage desiredName key value
+ Indigo: storeSubmapOpsReferTo :: forall {k1} {k2} (name :: k1) storage key value (desiredName :: k2). FieldRef name -> StoreSubmapOps storage name key value -> StoreSubmapOps storage desiredName key value
- Indigo: sub :: IsArithExpr exN exM Sub n m => exN -> exM -> Expr (ArithResHs Sub n m)
+ Indigo: sub :: IsArithExpr exN exM Sub n m r => exN -> exM -> Expr r
- Indigo: testAssert :: forall (out :: [Type]) (inp :: [Type]). (Typeable (ToTs out), HasCallStack) => Text -> PrintComment (ToTs inp) -> (inp :-> (Bool : out)) -> inp :-> inp
+ Indigo: testAssert :: forall (inp :: [Type]) (out :: [Type]). HasCallStack => Text -> PrintComment (ToTs inp) -> (inp :-> (Bool : out)) -> inp :-> inp
- Indigo: toMutez :: Word32 -> Mutez
+ Indigo: toMutez :: (Integral a, CheckIntSubType a Word63) => a -> Mutez
- Indigo: toNamed :: forall (name :: Symbol) a (s :: [Type]). Label name -> (a : s) :-> (NamedF Identity a name : s)
+ Indigo: toNamed :: forall (name :: Symbol) a (s :: [Type]). Label name -> (a : s) :-> ((name :! a) : s)
- Indigo: toTAddress :: ToTAddress cp a => a -> TAddress cp
+ Indigo: toTAddress :: ToTAddress cp vd a => a -> TAddress cp vd
- Indigo: transferTokens :: (IsExpr exp p, IsExpr exm Mutez, IsExpr exc (ContractRef p), NiceParameter p, HasSideEffects, HasCallStack) => exp -> exm -> exc -> IndigoM ()
+ Indigo: transferTokens :: (IsExpr exp p, IsExpr exm Mutez, IsExpr exc (ContractRef p), NiceParameter p, HasSideEffects, HasCallStack, IsNotInView) => exp -> exm -> exc -> IndigoM ()
- Indigo: type ConstructorFieldTypes dt = GFieldTypes Rep dt
+ Indigo: type ConstructorFieldTypes dt = GFieldTypes Rep dt '[] :: [Type]
- Indigo: type DocumentEntrypoints kind a = (Generic a, GDocumentEntrypoints kind Rep a)
+ Indigo: type DocumentEntrypoints kind a = (Generic a, GDocumentEntrypoints BuildEPTree' a kind Rep a '[] :: [CaseClauseParam])
- Indigo: type ErrorScope (t :: T) = (Typeable t, ConstantScope t)
+ Indigo: type ErrorScope (t :: T) = ConstantScope t
- Indigo: type InstrConstructC dt = (GenericIsoValue dt, GInstrConstruct Rep dt)
+ Indigo: type InstrConstructC dt = (GenericIsoValue dt, GInstrConstruct Rep dt '[] :: [Type])
- Indigo: type IsArithExpr exN exM a n m = (exN :~> n, exM :~> m, ArithOpHs a n m, KnownValue (ArithResHs a n m))
+ Indigo: type IsArithExpr exN exM a n m r = (exN :~> n, exM :~> m, ArithOpHs a n m r, KnownValue r)
- Indigo: type IsDivExpr exN exM n m = (exN :~> n, exM :~> m, EDivOpHs n m, KnownValue (EDivOpResHs n m))
+ Indigo: type IsDivExpr exN exM n m ratio reminder = (exN :~> n, exM :~> m, KnownValue ratio, ArithOpHs EDiv n m (Maybe (ratio, reminder)))
- Indigo: type IsModExpr exN exM n m = (exN :~> n, exM :~> m, EDivOpHs n m, KnownValue (EModOpResHs n m))
+ Indigo: type IsModExpr exN exM n m ratio reminder = (exN :~> n, exM :~> m, KnownValue reminder, ArithOpHs EDiv n m (Maybe (ratio, reminder)))
- Indigo: type Lambda i o = '[i] :-> '[o]
+ Indigo: type Lambda i o = WrappedLambda '[i] '[o]
- Indigo: type NiceComparable n = (KnownValue n, Comparable ToT n)
+ Indigo: type NiceComparable n = (ProperNonComparableValBetterErrors ToT n, KnownValue n, Comparable ToT n)
- Indigo: type NiceConstant a = (KnownValue a, ProperConstantBetterErrors ToT a)
+ Indigo: type NiceConstant a = (ProperConstantBetterErrors ToT a, KnownValue a)
- Indigo: type NicePackedValue a = (KnownValue a, ProperPackedValBetterErrors ToT a)
+ Indigo: type NicePackedValue a = (ProperPackedValBetterErrors ToT a, KnownValue a)
- Indigo: type NiceParameter a = (KnownValue a, ProperParameterBetterErrors ToT a)
+ Indigo: type NiceParameter a = (ProperParameterBetterErrors ToT a, KnownValue a)
- Indigo: type NiceStorage a = (HasAnnotation a, KnownValue a, ProperStorageBetterErrors ToT a)
+ Indigo: type NiceStorage a = (ProperStorageBetterErrors ToT a, KnownValue a)
- Indigo: type NiceUnpackedValue a = (KnownValue a, ProperUnpackedValBetterErrors ToT a)
+ Indigo: type NiceUnpackedValue a = (ProperUnpackedValBetterErrors ToT a, KnownValue a)
- Indigo: type IndigoContract param st = (HasStorage st, HasSideEffects) => Var param -> IndigoM ()
+ Indigo: type IndigoContract param st = (HasStorage st, HasSideEffects, IsNotInView) => Var param -> IndigoM ()
- Indigo: type Traversal s t a b = forall (f :: Type -> Type). Applicative f => a -> f b -> s -> f t
+ Indigo: type a & (b :: [Type]) = a : b
- Indigo: type family Element t
+ Indigo: type family FromListC l
- Indigo: view_ :: forall arg r viewExpr exr. (KnownValue arg, NiceParameter r, viewExpr :~> View arg r, exr :~> r, HasSideEffects) => (Expr arg -> IndigoM exr) -> viewExpr -> IndigoM ()
+ Indigo: view_ :: forall arg r viewExpr exr. (KnownValue arg, NiceParameter r, viewExpr :~> View_ arg r, exr :~> r, HasSideEffects, IsNotInView) => (Expr arg -> IndigoM exr) -> viewExpr -> IndigoM ()
- Indigo: xor :: IsArithExpr exN exM Xor n m => exN -> exM -> Expr (ArithResHs Xor n m)
+ Indigo: xor :: IsArithExpr exN exM Xor n m r => exN -> exM -> Expr r
- Indigo: zoomStoreSubmapOps :: forall store (submapName :: Symbol) (nameInSubmap :: Symbol) key value subvalue. (NiceConstant value, NiceConstant subvalue) => Label submapName -> LIso (Maybe value) value -> LIso (Maybe subvalue) subvalue -> StoreSubmapOps store submapName key value -> StoreFieldOps value nameInSubmap subvalue -> StoreSubmapOps store nameInSubmap key subvalue
+ Indigo: zoomStoreSubmapOps :: forall {k1} {k2} store (submapName :: k1) (nameInSubmap :: k2) key value subvalue. (NiceConstant value, NiceConstant subvalue, Dupable key, Dupable store) => FieldRef submapName -> LIso (Maybe value) value -> LIso (Maybe subvalue) subvalue -> StoreSubmapOps store submapName key value -> StoreFieldOps value nameInSubmap subvalue -> StoreSubmapOps store nameInSubmap key subvalue
- Indigo.Backend: contractCalling :: forall cp inp epRef epArg addr. (HasEntrypointArg cp epRef epArg, ToTAddress cp addr, ToT addr ~ ToT Address, KnownValue epArg) => epRef -> Expr addr -> Var (Maybe (ContractRef epArg)) -> IndigoState inp (Maybe (ContractRef epArg) : inp)
+ Indigo.Backend: contractCalling :: forall cp vd inp epRef epArg addr. (HasEntrypointArg cp epRef epArg, ToTAddress cp vd addr, ToT addr ~ ToT Address, HasNoOp (ToT epArg), HasNoNestedBigMaps (ToT epArg), KnownValue epArg) => epRef -> Expr addr -> Var (Maybe (ContractRef epArg)) -> IndigoState inp (Maybe (ContractRef epArg) : inp)
- Indigo.Backend: createContract :: (HasSideEffects, NiceStorage s, NiceParameterFull p) => Contract p s -> Expr (Maybe KeyHash) -> Expr Mutez -> Expr s -> Var Address -> IndigoState inp (Address : inp)
+ Indigo.Backend: createContract :: (HasSideEffects, NiceStorage s, NiceParameterFull p, NiceViewsDescriptor vd, Typeable vd, IsNotInView) => Contract p s vd -> Expr (Maybe KeyHash) -> Expr Mutez -> Expr s -> Var Address -> IndigoState inp (Address : inp)
- Indigo.Backend: selfCalling :: forall p inp mname. (NiceParameterFull p, KnownValue (GetEntrypointArgCustom p mname)) => EntrypointRef mname -> Var (ContractRef (GetEntrypointArgCustom p mname)) -> IndigoState inp (ContractRef (GetEntrypointArgCustom p mname) : inp)
+ Indigo.Backend: selfCalling :: forall p inp mname. (NiceParameterFull p, KnownValue (GetEntrypointArgCustom p mname), IsoValue (ContractRef (GetEntrypointArgCustom p mname)), IsNotInView) => EntrypointRef mname -> Var (ContractRef (GetEntrypointArgCustom p mname)) -> IndigoState inp (ContractRef (GetEntrypointArgCustom p mname) : inp)
- Indigo.Backend: setDelegate :: HasSideEffects => Expr (Maybe KeyHash) -> IndigoState inp inp
+ Indigo.Backend: setDelegate :: (HasSideEffects, IsNotInView) => Expr (Maybe KeyHash) -> IndigoState inp inp
- Indigo.Backend: transferTokens :: (NiceParameter p, HasSideEffects) => Expr p -> Expr Mutez -> Expr (ContractRef p) -> IndigoState inp inp
+ Indigo.Backend: transferTokens :: (NiceParameter p, HasSideEffects, IsNotInView) => Expr p -> Expr Mutez -> Expr (ContractRef p) -> IndigoState inp inp
- Indigo.Backend.Error: failCustom :: forall tag err s t. (err ~ ErrorArg tag, CustomErrorHasDoc tag, NiceConstant err) => Label tag -> Expr err -> IndigoState s t
+ Indigo.Backend.Error: failCustom :: forall tag err s t. (MustHaveErrorArg tag (MText, err), CustomErrorHasDoc tag, NiceConstant err) => Label tag -> Expr err -> IndigoState s t
- Indigo.Backend.Error: failCustom_ :: forall tag s t notVoidErrorMsg. (RequireNoArgError tag notVoidErrorMsg, CustomErrorHasDoc tag) => Label tag -> IndigoState s t
+ Indigo.Backend.Error: failCustom_ :: forall tag s t. (MustHaveErrorArg tag (MText, ()), CustomErrorHasDoc tag) => Label tag -> IndigoState s t
- Indigo.Backend.Error: failWith :: KnownValue a => Expr a -> IndigoState s t
+ Indigo.Backend.Error: failWith :: NiceConstant a => Expr a -> IndigoState s t
- Indigo.Backend.Lambda: type CreateLambda1CGeneric extra arg res = (ScopeCodeGen res, KnownValue arg, Typeable extra, ZipInstr (arg : extra), KnownValue (ZippedStack (arg : extra)), KnownValue (ZippedStack (RetOutStack res ++ extra)), ZipInstr (RetOutStack res ++ extra), Typeable (RetOutStack res ++ extra))
+ Indigo.Backend.Lambda: type CreateLambda1CGeneric extra arg res = (ScopeCodeGen res, KnownValue arg, Typeable extra, KnownList extra, ZipInstr (arg : extra), KnownValue (ZippedStack (arg : extra)), KnownValue (ZippedStack (RetOutStack res ++ extra)), ZipInstr (RetOutStack res ++ extra), Typeable (RetOutStack res ++ extra))
- Indigo.Backend.Lambda: type Lambda1Generic extra arg res = (arg : extra) :-> (RetOutStack res ++ extra)
+ Indigo.Backend.Lambda: type Lambda1Generic extra arg res = WrappedLambda (arg : extra) (RetOutStack res ++ extra)
- Indigo.Backend.Prelude: (&&) :: Bool -> Bool -> Bool
+ Indigo.Backend.Prelude: (&&) :: Boolean a => a -> a -> a
- Indigo.Backend.Prelude: (||) :: Bool -> Bool -> Bool
+ Indigo.Backend.Prelude: (||) :: Boolean a => a -> a -> a
- Indigo.Backend.Prelude: All :: Bool -> All
+ Indigo.Backend.Prelude: All :: a -> All a
- Indigo.Backend.Prelude: Any :: Bool -> Any
+ Indigo.Backend.Prelude: Any :: a -> Any a
- Indigo.Backend.Prelude: [getAll] :: All -> Bool
+ Indigo.Backend.Prelude: [getAll] :: All a -> a
- Indigo.Backend.Prelude: [getAny] :: Any -> Bool
+ Indigo.Backend.Prelude: [getAny] :: Any a -> a
- Indigo.Backend.Prelude: all :: Container t => (Element t -> Bool) -> t -> Bool
+ Indigo.Backend.Prelude: all :: (Container c, BooleanMonoid b) => (Element c -> b) -> c -> b
- Indigo.Backend.Prelude: and :: Container t => t -> Bool
+ Indigo.Backend.Prelude: and :: (Container c, BooleanMonoid (Element c)) => c -> Element c
- Indigo.Backend.Prelude: any :: Container t => (Element t -> Bool) -> t -> Bool
+ Indigo.Backend.Prelude: any :: (Container c, BooleanMonoid b) => (Element c -> b) -> c -> b
- Indigo.Backend.Prelude: foldl1 :: Container t => (Element t -> Element t -> Element t) -> t -> Element t
+ Indigo.Backend.Prelude: foldl1 :: (a -> a -> a) -> NonEmpty a -> a
- Indigo.Backend.Prelude: foldr1 :: Container t => (Element t -> Element t -> Element t) -> t -> Element t
+ Indigo.Backend.Prelude: foldr1 :: (a -> a -> a) -> NonEmpty a -> a
- Indigo.Backend.Prelude: fromInteger :: Num a => Integer -> a
+ Indigo.Backend.Prelude: fromInteger :: (HasCallStack, Integral a) => Integer -> a
- Indigo.Backend.Prelude: fromIntegral :: (Integral a, Num b) => a -> b
+ Indigo.Backend.Prelude: fromIntegral :: (Integral a, Integral b, CheckIntSubType a b) => a -> b
- Indigo.Backend.Prelude: infixl 0 `on`
+ Indigo.Backend.Prelude: infixl 0 `hashWithSalt`
- Indigo.Backend.Prelude: infixr 1 =<<
+ Indigo.Backend.Prelude: infixr 1 >=>
- Indigo.Backend.Prelude: infixr 2 $
+ Indigo.Backend.Prelude: infixr 2 ||
- Indigo.Backend.Prelude: infixr 8 ^
+ Indigo.Backend.Prelude: infixr 8 ^^
- Indigo.Backend.Prelude: mapAccumL :: Traversable t => (a -> b -> (a, c)) -> a -> t b -> (a, t c)
+ Indigo.Backend.Prelude: mapAccumL :: Traversable t => (s -> a -> (s, b)) -> s -> t a -> (s, t b)
- Indigo.Backend.Prelude: mapAccumR :: Traversable t => (a -> b -> (a, c)) -> a -> t b -> (a, t c)
+ Indigo.Backend.Prelude: mapAccumR :: Traversable t => (s -> a -> (s, b)) -> s -> t a -> (s, t b)
- Indigo.Backend.Prelude: maximum :: Container t => t -> Element t
+ Indigo.Backend.Prelude: maximum :: Ord a => NonEmpty a -> a
- Indigo.Backend.Prelude: maximumBy :: Foldable t => (a -> a -> Ordering) -> t a -> a
+ Indigo.Backend.Prelude: maximumBy :: (a -> a -> Ordering) -> NonEmpty a -> a
- Indigo.Backend.Prelude: minimum :: Container t => t -> Element t
+ Indigo.Backend.Prelude: minimum :: Ord a => NonEmpty a -> a
- Indigo.Backend.Prelude: minimumBy :: Foldable t => (a -> a -> Ordering) -> t a -> a
+ Indigo.Backend.Prelude: minimumBy :: (a -> a -> Ordering) -> NonEmpty a -> a
- Indigo.Backend.Prelude: newtype All
+ Indigo.Backend.Prelude: newtype All a
- Indigo.Backend.Prelude: newtype Any
+ Indigo.Backend.Prelude: newtype Any a
- Indigo.Backend.Prelude: not :: Bool -> Bool
+ Indigo.Backend.Prelude: not :: Boolean a => a -> a
- Indigo.Backend.Prelude: or :: Container t => t -> Bool
+ Indigo.Backend.Prelude: or :: (Container c, BooleanMonoid (Element c)) => c -> Element c
- Indigo.Backend.Prelude: seq :: a -> b -> b
+ Indigo.Backend.Prelude: seq :: forall {r :: RuntimeRep} a (b :: TYPE r). a -> b -> b
- Indigo.Backend.Prelude: show :: forall b a. (Show a, IsString b) => a -> b
+ Indigo.Backend.Prelude: show :: forall b a. (PrettyShow a, Show a, IsString b) => a -> b
- Indigo.Backend.Prelude: type family Element t
+ Indigo.Backend.Prelude: type family FromListC l
- Indigo.Compilation.Sequential: [ContractCalling] :: (HasEntrypointArg cp epRef epArg, ToTAddress cp addr, ToT addr ~ ToT Address, KnownValue epArg) => Proxy cp -> epRef -> Expr addr -> Var (Maybe (ContractRef epArg)) -> Instruction
+ Indigo.Compilation.Sequential: [ContractCalling] :: (HasEntrypointArg cp epRef epArg, ToTAddress cp vd addr, ToT addr ~ ToT Address, KnownValue epArg, IsoValue (ContractRef epArg)) => Proxy (cp, vd) -> epRef -> Expr addr -> Var (Maybe (ContractRef epArg)) -> Instruction
- Indigo.Compilation.Sequential: [CreateContract] :: (HasSideEffects, NiceStorage s, NiceParameterFull p) => Contract p s -> Expr (Maybe KeyHash) -> Expr Mutez -> Expr s -> Var Address -> Instruction
+ Indigo.Compilation.Sequential: [CreateContract] :: (HasSideEffects, NiceStorage s, NiceParameterFull p, NiceViewsDescriptor vd, Typeable vd, IsNotInView) => Contract p s vd -> Expr (Maybe KeyHash) -> Expr Mutez -> Expr s -> Var Address -> Instruction
- Indigo.Compilation.Sequential: [SelfCalling] :: (NiceParameterFull p, KnownValue (GetEntrypointArgCustom p mname)) => Proxy p -> EntrypointRef mname -> Var (ContractRef (GetEntrypointArgCustom p mname)) -> Instruction
+ Indigo.Compilation.Sequential: [SelfCalling] :: (NiceParameterFull p, KnownValue (GetEntrypointArgCustom p mname), IsoValue (ContractRef (GetEntrypointArgCustom p mname)), IsNotInView) => Proxy p -> EntrypointRef mname -> Var (ContractRef (GetEntrypointArgCustom p mname)) -> Instruction
- Indigo.Compilation.Sequential: [SetDelegate] :: HasSideEffects => Expr (Maybe KeyHash) -> Instruction
+ Indigo.Compilation.Sequential: [SetDelegate] :: (HasSideEffects, IsNotInView) => Expr (Maybe KeyHash) -> Instruction
- Indigo.Compilation.Sequential: [TransferTokens] :: (NiceParameter p, HasSideEffects) => Expr p -> Expr Mutez -> Expr (ContractRef p) -> Instruction
+ Indigo.Compilation.Sequential: [TransferTokens] :: (NiceParameter p, HasSideEffects, IsNotInView) => Expr p -> Expr Mutez -> Expr (ContractRef p) -> Instruction
- Indigo.Frontend.Language: (&&=) :: (IsExpr ex1 n, IsObject m, ArithOpHs And n m, ArithResHs And n m ~ m, HasCallStack) => Var m -> ex1 -> IndigoM ()
+ Indigo.Frontend.Language: (&&=) :: (IsExpr ex1 n, IsObject m, ArithOpHs And n m m, HasCallStack) => Var m -> ex1 -> IndigoM ()
- Indigo.Frontend.Language: (*=) :: (IsExpr ex1 n, IsObject m, ArithOpHs Mul n m, ArithResHs Mul n m ~ m, HasCallStack) => Var m -> ex1 -> IndigoM ()
+ Indigo.Frontend.Language: (*=) :: (IsExpr ex1 n, IsObject m, ArithOpHs Mul n m m, HasCallStack) => Var m -> ex1 -> IndigoM ()
- Indigo.Frontend.Language: (+=) :: (IsExpr ex1 n, IsObject m, ArithOpHs Add n m, ArithResHs Add n m ~ m, HasCallStack) => Var m -> ex1 -> IndigoM ()
+ Indigo.Frontend.Language: (+=) :: (IsExpr ex1 n, IsObject m, ArithOpHs Add n m m, HasCallStack) => Var m -> ex1 -> IndigoM ()
- Indigo.Frontend.Language: (-=) :: (IsExpr ex1 n, IsObject m, ArithOpHs Sub n m, ArithResHs Sub n m ~ m, HasCallStack) => Var m -> ex1 -> IndigoM ()
+ Indigo.Frontend.Language: (-=) :: (IsExpr ex1 n, IsObject m, ArithOpHs Sub n m m, HasCallStack) => Var m -> ex1 -> IndigoM ()
- Indigo.Frontend.Language: (<<<=) :: (IsExpr ex1 n, IsObject m, ArithOpHs Lsl n m, ArithResHs Lsl n m ~ m, HasCallStack) => Var m -> ex1 -> IndigoM ()
+ Indigo.Frontend.Language: (<<<=) :: (IsExpr ex1 n, IsObject m, ArithOpHs Lsl n m m, HasCallStack) => Var m -> ex1 -> IndigoM ()
- Indigo.Frontend.Language: (>>>=) :: (IsExpr ex1 n, IsObject m, ArithOpHs Lsr n m, ArithResHs Lsr n m ~ m, HasCallStack) => Var m -> ex1 -> IndigoM ()
+ Indigo.Frontend.Language: (>>>=) :: (IsExpr ex1 n, IsObject m, ArithOpHs Lsr n m m, HasCallStack) => Var m -> ex1 -> IndigoM ()
- Indigo.Frontend.Language: (^=) :: (IsExpr ex1 n, IsObject m, ArithOpHs Xor n m, ArithResHs Xor n m ~ m, HasCallStack) => Var m -> ex1 -> IndigoM ()
+ Indigo.Frontend.Language: (^=) :: (IsExpr ex1 n, IsObject m, ArithOpHs Xor n m m, HasCallStack) => Var m -> ex1 -> IndigoM ()
- Indigo.Frontend.Language: (||=) :: (IsExpr ex1 n, IsObject m, ArithOpHs Or n m, ArithResHs Or n m ~ m, HasCallStack) => Var m -> ex1 -> IndigoM ()
+ Indigo.Frontend.Language: (||=) :: (IsExpr ex1 n, IsObject m, ArithOpHs Or n m m, HasCallStack) => Var m -> ex1 -> IndigoM ()
- Indigo.Frontend.Language: assertCustom :: forall tag err errEx ex. (err ~ ErrorArg tag, CustomErrorHasDoc tag, NiceConstant err, IsExpr errEx err, IsExpr ex Bool, HasCallStack) => Label tag -> errEx -> ex -> IndigoM ()
+ Indigo.Frontend.Language: assertCustom :: forall tag err errEx ex. (MustHaveErrorArg tag (MText, err), CustomErrorHasDoc tag, NiceConstant err, IsExpr errEx err, IsExpr ex Bool, HasCallStack) => Label tag -> errEx -> ex -> IndigoM ()
- Indigo.Frontend.Language: assertCustom_ :: forall tag notVoidErrorMsg ex. (RequireNoArgError tag notVoidErrorMsg, CustomErrorHasDoc tag, IsExpr ex Bool, HasCallStack) => Label tag -> ex -> IndigoM ()
+ Indigo.Frontend.Language: assertCustom_ :: forall tag ex. (MustHaveErrorArg tag (MText, ()), CustomErrorHasDoc tag, IsExpr ex Bool, HasCallStack) => Label tag -> ex -> IndigoM ()
- Indigo.Frontend.Language: contractCalling :: forall cp epRef epArg addr exAddr. (HasEntrypointArg cp epRef epArg, ToTAddress cp addr, ToT addr ~ ToT Address, exAddr :~> addr, KnownValue epArg, HasCallStack) => epRef -> exAddr -> IndigoM (Var (Maybe (ContractRef epArg)))
+ Indigo.Frontend.Language: contractCalling :: forall cp vd epRef epArg addr exAddr. (HasEntrypointArg cp epRef epArg, ToTAddress cp vd addr, ToT addr ~ ToT Address, exAddr :~> addr, KnownValue epArg, IsoValue (ContractRef epArg), HasCallStack) => epRef -> exAddr -> IndigoM (Var (Maybe (ContractRef epArg)))
- Indigo.Frontend.Language: createContract :: (IsObject st, IsExpr exk (Maybe KeyHash), IsExpr exm Mutez, IsExpr exs st, NiceStorage st, NiceParameterFull param, HasSideEffects, HasCallStack) => (HasStorage st => Var param -> IndigoM ()) -> exk -> exm -> exs -> IndigoM (Var Address)
+ Indigo.Frontend.Language: createContract :: forall st exk exm exs param. (IsObject st, IsExpr exk (Maybe KeyHash), IsExpr exm Mutez, IsExpr exs st, NiceStorageFull st, NiceParameterFull param, HasSideEffects, HasCallStack, IsNotInView) => (HasStorage st => Var param -> IndigoM ()) -> exk -> exm -> exs -> IndigoM (Var Address)
- Indigo.Frontend.Language: createLorentzContract :: (IsObject st, IsExpr exk (Maybe KeyHash), IsExpr exm Mutez, IsExpr exs st, NiceStorage st, NiceParameterFull param, HasSideEffects, HasCallStack) => Contract param st -> exk -> exm -> exs -> IndigoM (Var Address)
+ Indigo.Frontend.Language: createLorentzContract :: (IsObject st, IsExpr exk (Maybe KeyHash), IsExpr exm Mutez, IsExpr exs st, NiceStorage st, NiceParameterFull param, NiceViewsDescriptor vd, Typeable vd, HasSideEffects, HasCallStack, IsNotInView) => Contract param st vd -> exk -> exm -> exs -> IndigoM (Var Address)
- Indigo.Frontend.Language: defContract :: HasCallStack => (HasSideEffects => IndigoM ()) -> HasSideEffects => IndigoProcedure
+ Indigo.Frontend.Language: defContract :: HasCallStack => ((HasSideEffects, IsNotInView) => IndigoM ()) -> (HasSideEffects, IsNotInView) => IndigoProcedure
- Indigo.Frontend.Language: failCustom :: forall ret tag err ex. (ReturnableValue ret, err ~ ErrorArg tag, CustomErrorHasDoc tag, NiceConstant err, ex :~> err, HasCallStack) => Label tag -> ex -> IndigoM (RetVars ret)
+ Indigo.Frontend.Language: failCustom :: forall ret tag err ex. (ReturnableValue ret, MustHaveErrorArg tag (MText, err), CustomErrorHasDoc tag, NiceConstant err, ex :~> err, HasCallStack) => Label tag -> ex -> IndigoM (RetVars ret)
- Indigo.Frontend.Language: failCustom_ :: forall ret tag notVoidErrorMsg. (ReturnableValue ret, RequireNoArgError tag notVoidErrorMsg, CustomErrorHasDoc tag, HasCallStack) => Label tag -> IndigoM (RetVars ret)
+ Indigo.Frontend.Language: failCustom_ :: forall ret tag. (ReturnableValue ret, MustHaveErrorArg tag (MText, ()), CustomErrorHasDoc tag, HasCallStack) => Label tag -> IndigoM (RetVars ret)
- Indigo.Frontend.Language: failWith :: forall ret a ex. (IsExpr ex a, ReturnableValue ret, HasCallStack) => ex -> IndigoM (RetVars ret)
+ Indigo.Frontend.Language: failWith :: forall ret a ex. (NiceConstant a, IsExpr ex a, ReturnableValue ret, HasCallStack) => ex -> IndigoM (RetVars ret)
- Indigo.Frontend.Language: selfCalling :: forall p mname. (NiceParameterFull p, KnownValue (GetEntrypointArgCustom p mname), HasCallStack) => EntrypointRef mname -> IndigoM (Var (ContractRef (GetEntrypointArgCustom p mname)))
+ Indigo.Frontend.Language: selfCalling :: forall p mname. (NiceParameterFull p, KnownValue (GetEntrypointArgCustom p mname), IsoValue (ContractRef (GetEntrypointArgCustom p mname)), HasCallStack, IsNotInView) => EntrypointRef mname -> IndigoM (Var (ContractRef (GetEntrypointArgCustom p mname)))
- Indigo.Frontend.Language: setDelegate :: (HasSideEffects, IsExpr ex (Maybe KeyHash), HasCallStack) => ex -> IndigoM ()
+ Indigo.Frontend.Language: setDelegate :: (HasSideEffects, IsExpr ex (Maybe KeyHash), HasCallStack, IsNotInView) => ex -> IndigoM ()
- Indigo.Frontend.Language: transferTokens :: (IsExpr exp p, IsExpr exm Mutez, IsExpr exc (ContractRef p), NiceParameter p, HasSideEffects, HasCallStack) => exp -> exm -> exc -> IndigoM ()
+ Indigo.Frontend.Language: transferTokens :: (IsExpr exp p, IsExpr exm Mutez, IsExpr exc (ContractRef p), NiceParameter p, HasSideEffects, HasCallStack, IsNotInView) => exp -> exm -> exc -> IndigoM ()
- Indigo.Frontend.Program: type IndigoContract param st = (HasStorage st, HasSideEffects) => Var param -> IndigoM ()
+ Indigo.Frontend.Program: type IndigoContract param st = (HasStorage st, HasSideEffects, IsNotInView) => Var param -> IndigoM ()
- Indigo.Lib: project :: forall arg r viewExpr exr. (KnownValue arg, NiceParameter r, viewExpr :~> View arg r, exr :~> r, HasSideEffects) => viewExpr -> (Expr arg -> IndigoM exr) -> IndigoM ()
+ Indigo.Lib: project :: forall arg r viewExpr exr. (KnownValue arg, NiceParameter r, viewExpr :~> View_ arg r, exr :~> r, HasSideEffects, IsNotInView) => viewExpr -> (Expr arg -> IndigoM exr) -> IndigoM ()
- Indigo.Lib: view_ :: forall arg r viewExpr exr. (KnownValue arg, NiceParameter r, viewExpr :~> View arg r, exr :~> r, HasSideEffects) => (Expr arg -> IndigoM exr) -> viewExpr -> IndigoM ()
+ Indigo.Lib: view_ :: forall arg r viewExpr exr. (KnownValue arg, NiceParameter r, viewExpr :~> View_ arg r, exr :~> r, HasSideEffects, IsNotInView) => (Expr arg -> IndigoM exr) -> viewExpr -> IndigoM ()
- Indigo.Lorentz: (#) :: forall (a :: [Type]) (b :: [Type]) (c :: [Type]). (a :-> b) -> (b :-> c) -> a :-> c
+ Indigo.Lorentz: (#) :: (a :-> b) -> (b :-> c) -> a :-> c
- Indigo.Lorentz: CustomError :: Label tag -> ErrorArg tag -> CustomError (tag :: Symbol)
+ Indigo.Lorentz: CustomError :: Label tag -> CustomErrorRep tag -> CustomError (tag :: Symbol)
- Indigo.Lorentz: DEntrypointArg :: Maybe DType -> [ParamBuildingStep] -> Type -> DEntrypointArg
+ Indigo.Lorentz: DEntrypointArg :: Maybe SomeEntrypointArg -> [ParamBuildingStep] -> DEntrypointArg
- Indigo.Lorentz: StoreEntrypointOps :: (forall (s :: [Type]). () => Label epName -> (store : s) :-> (EntrypointLambda epParam epStore : s)) -> (forall (s :: [Type]). () => Label epName -> (EntrypointLambda epParam epStore : (store : s)) :-> (store : s)) -> (forall (s :: [Type]). () => Label epName -> (store : s) :-> (epStore : s)) -> (forall (s :: [Type]). () => Label epName -> (epStore : (store : s)) :-> (store : s)) -> StoreEntrypointOps store (epName :: Symbol) epParam epStore
+ Indigo.Lorentz: StoreEntrypointOps :: (forall (s :: [Type]). () => Label epName -> (store : s) :-> (EntrypointLambda epParam epStore : s)) -> (forall (s :: [Type]). HasDupableGetters store => Label epName -> (EntrypointLambda epParam epStore : (store : s)) :-> (store : s)) -> (forall (s :: [Type]). () => Label epName -> (store : s) :-> (epStore : s)) -> (forall (s :: [Type]). () => Label epName -> (epStore : (store : s)) :-> (store : s)) -> StoreEntrypointOps store (epName :: Symbol) epParam epStore
- Indigo.Lorentz: StoreFieldOps :: (forall (s :: [Type]). () => Label fname -> (store : s) :-> (ftype : s)) -> (forall (s :: [Type]). () => Label fname -> (ftype : (store : s)) :-> (store : s)) -> StoreFieldOps store (fname :: Symbol) ftype
+ Indigo.Lorentz: StoreFieldOps :: (forall (s :: [Type]). () => FieldRef fname -> (store : s) :-> (ftype : s)) -> (forall res (s :: [Type]). HasDupableGetters store => ('[ftype] :-> '[res, ftype]) -> ('[ftype] :-> '[res]) -> FieldRef fname -> (store : s) :-> (res : (store : s))) -> (forall new (s :: [Type]). () => ('[new, ftype] :-> '[ftype]) -> FieldRef fname -> (new : (store : s)) :-> (store : s)) -> StoreFieldOps store (fname :: k) ftype
- Indigo.Lorentz: StoreSubmapOps :: (forall (s :: [Type]). () => Label mname -> (key : (store : s)) :-> (Bool : s)) -> (forall (s :: [Type]). KnownValue value => Label mname -> (key : (store : s)) :-> (Maybe value : s)) -> (forall (s :: [Type]). () => Label mname -> (key : (Maybe value : (store : s))) :-> (store : s)) -> (forall (s :: [Type]). () => Label mname -> (key : (store : s)) :-> (store : s)) -> (forall (s :: [Type]). () => Label mname -> (key : (value : (store : s))) :-> (store : s)) -> StoreSubmapOps store (mname :: Symbol) key value
+ Indigo.Lorentz: StoreSubmapOps :: (forall (s :: [Type]). () => FieldRef mname -> (key : (store : s)) :-> (Bool : s)) -> (forall (s :: [Type]). KnownValue value => FieldRef mname -> (key : (store : s)) :-> (Maybe value : s)) -> (forall (s :: [Type]). () => FieldRef mname -> (key : (Maybe value : (store : s))) :-> (store : s)) -> (forall (s :: [Type]). () => FieldRef mname -> (key : (Maybe value : (store : s))) :-> (Maybe value : (store : s))) -> (forall (s :: [Type]). () => FieldRef mname -> (key : (store : s)) :-> (store : s)) -> (forall (s :: [Type]). () => FieldRef mname -> (key : (value : (store : s))) :-> (store : s)) -> StoreSubmapOps store (mname :: k) key value
- Indigo.Lorentz: TAddress :: Address -> TAddress (p :: k)
+ Indigo.Lorentz: TAddress :: Address -> TAddress p vd
- Indigo.Lorentz: [:&] :: forall u (a :: u -> Type) (r :: u) (rs :: [u]). !a r -> !Rec a rs -> Rec a (r : rs)
+ Indigo.Lorentz: [:&] :: forall {u} (a :: u -> Type) (r :: u) (rs :: [u]). !a r -> !Rec a rs -> Rec a (r : rs)
- Indigo.Lorentz: [RNil] :: forall u (a :: u -> Type). Rec a ('[] :: [u])
+ Indigo.Lorentz: [RNil] :: forall {u} (a :: u -> Type). Rec a ('[] :: [u])
- Indigo.Lorentz: [SomeContractCode] :: forall cp st. (NiceParameterFull cp, NiceStorage st) => ContractCode cp st -> SomeContractCode
+ Indigo.Lorentz: [SomeContractCode] :: forall cp st. (NiceParameter cp, NiceStorage st) => ContractCode cp st -> SomeContractCode
- Indigo.Lorentz: [ceArg] :: CustomError (tag :: Symbol) -> ErrorArg tag
+ Indigo.Lorentz: [ceArg] :: CustomError (tag :: Symbol) -> CustomErrorRep tag
- Indigo.Lorentz: [epaArg] :: DEntrypointArg -> Maybe DType
+ Indigo.Lorentz: [epaArg] :: DEntrypointArg -> Maybe SomeEntrypointArg
- Indigo.Lorentz: [sopDelete] :: StoreSubmapOps store (mname :: Symbol) key value -> forall (s :: [Type]). () => Label mname -> (key : (store : s)) :-> (store : s)
+ Indigo.Lorentz: [sopDelete] :: StoreSubmapOps store (mname :: k) key value -> forall (s :: [Type]). () => FieldRef mname -> (key : (store : s)) :-> (store : s)
- Indigo.Lorentz: [sopGet] :: StoreSubmapOps store (mname :: Symbol) key value -> forall (s :: [Type]). KnownValue value => Label mname -> (key : (store : s)) :-> (Maybe value : s)
+ Indigo.Lorentz: [sopGet] :: StoreSubmapOps store (mname :: k) key value -> forall (s :: [Type]). KnownValue value => FieldRef mname -> (key : (store : s)) :-> (Maybe value : s)
- Indigo.Lorentz: [sopInsert] :: StoreSubmapOps store (mname :: Symbol) key value -> forall (s :: [Type]). () => Label mname -> (key : (value : (store : s))) :-> (store : s)
+ Indigo.Lorentz: [sopInsert] :: StoreSubmapOps store (mname :: k) key value -> forall (s :: [Type]). () => FieldRef mname -> (key : (value : (store : s))) :-> (store : s)
- Indigo.Lorentz: [sopMem] :: StoreSubmapOps store (mname :: Symbol) key value -> forall (s :: [Type]). () => Label mname -> (key : (store : s)) :-> (Bool : s)
+ Indigo.Lorentz: [sopMem] :: StoreSubmapOps store (mname :: k) key value -> forall (s :: [Type]). () => FieldRef mname -> (key : (store : s)) :-> (Bool : s)
- Indigo.Lorentz: [sopSetEpLambda] :: StoreEntrypointOps store (epName :: Symbol) epParam epStore -> forall (s :: [Type]). () => Label epName -> (EntrypointLambda epParam epStore : (store : s)) :-> (store : s)
+ Indigo.Lorentz: [sopSetEpLambda] :: StoreEntrypointOps store (epName :: Symbol) epParam epStore -> forall (s :: [Type]). HasDupableGetters store => Label epName -> (EntrypointLambda epParam epStore : (store : s)) :-> (store : s)
- Indigo.Lorentz: [sopToField] :: StoreFieldOps store (fname :: Symbol) ftype -> forall (s :: [Type]). () => Label fname -> (store : s) :-> (ftype : s)
+ Indigo.Lorentz: [sopToField] :: StoreFieldOps store (fname :: k) ftype -> forall (s :: [Type]). () => FieldRef fname -> (store : s) :-> (ftype : s)
- Indigo.Lorentz: [sopUpdate] :: StoreSubmapOps store (mname :: Symbol) key value -> forall (s :: [Type]). () => Label mname -> (key : (Maybe value : (store : s))) :-> (store : s)
+ Indigo.Lorentz: [sopUpdate] :: StoreSubmapOps store (mname :: k) key value -> forall (s :: [Type]). () => FieldRef mname -> (key : (Maybe value : (store : s))) :-> (store : s)
- Indigo.Lorentz: [unTAddress] :: TAddress (p :: k) -> Address
+ Indigo.Lorentz: [unTAddress] :: TAddress p vd -> Address
- Indigo.Lorentz: allowCheckedCoerce :: forall k1 k2 (a :: k1) (b :: k2). Dict (CanCastTo a b, CanCastTo b a)
+ Indigo.Lorentz: allowCheckedCoerce :: forall {k1} {k2} (a :: k1) (b :: k2). Dict (CanCastTo a b, CanCastTo b a)
- Indigo.Lorentz: allowCheckedCoerceTo :: forall k1 k2 (b :: k1) (a :: k2). Dict (CanCastTo a b)
+ Indigo.Lorentz: allowCheckedCoerceTo :: forall {k1} {k2} (b :: k1) (a :: k2). Dict (CanCastTo a b)
- Indigo.Lorentz: class (ArithOp aop ToT n ToT m, NiceComparable n, NiceComparable m, ToT ArithResHs aop n m ~ ArithRes aop ToT n ToT m) => ArithOpHs aop n m where {
+ Indigo.Lorentz: class ArithOpHs aop n m r
- Indigo.Lorentz: class (IsoValue a, HasNoNestedBigMaps ToT a) => CanHaveBigMap a
+ Indigo.Lorentz: class (HasNoNestedBigMaps ToT a, IsoValue a) => CanHaveBigMap a
- Indigo.Lorentz: class (KnownSymbol tag, TypeHasDoc ErrorArg tag, IsError CustomError tag) => CustomErrorHasDoc (tag :: Symbol)
+ Indigo.Lorentz: class (KnownSymbol tag, TypeHasDoc CustomErrorRep tag, IsError CustomError tag) => CustomErrorHasDoc (tag :: Symbol)
- Indigo.Lorentz: class Typeable ep => EntrypointKindHasDoc ep
+ Indigo.Lorentz: class Typeable ep => EntrypointKindHasDoc ep where {
- Indigo.Lorentz: class (Typeable e, ErrorHasDoc e) => IsError e
+ Indigo.Lorentz: class ErrorHasDoc e => IsError e
- Indigo.Lorentz: class (IsoValue a, ForbidBigMap ToT a) => NoBigMap a
+ Indigo.Lorentz: class (ForbidBigMap ToT a, IsoValue a) => NoBigMap a
- Indigo.Lorentz: class (IsoValue a, ForbidContract ToT a) => NoContractType a
+ Indigo.Lorentz: class (ForbidContract ToT a, IsoValue a) => NoContractType a
- Indigo.Lorentz: class (IsoValue a, ForbidOp ToT a) => NoOperation a
+ Indigo.Lorentz: class (ForbidOp ToT a, IsoValue a) => NoOperation a
- Indigo.Lorentz: class StoreHasField store (fname :: Symbol) ftype | store fname -> ftype
+ Indigo.Lorentz: class StoreHasField store (fname :: k) ftype | store fname -> ftype
- Indigo.Lorentz: class StoreHasSubmap store (mname :: Symbol) key value | store mname -> key value
+ Indigo.Lorentz: class StoreHasSubmap store (mname :: k) key value | store mname -> key value
- Indigo.Lorentz: class ToTAddress cp a
+ Indigo.Lorentz: class ToTAddress cp vd a
- Indigo.Lorentz: class (UnaryArithOp aop ToT n, NiceComparable n, ToT UnaryArithResHs aop n ~ UnaryArithRes aop ToT n) => UnaryArithOpHs aop n where {
+ Indigo.Lorentz: class UnaryArithOpHs aop n where {
- Indigo.Lorentz: class ToT s ~ ToT Unwrappable s => Wrappable s where {
+ Indigo.Lorentz: class Unwrappable s => Wrappable s
- Indigo.Lorentz: coerceUnwrap :: forall a (s :: [Type]). Wrappable a => (a : s) :-> (Unwrappable a : s)
+ Indigo.Lorentz: coerceUnwrap :: forall a (s :: [Type]). Unwrappable a => (a : s) :-> (Unwrappabled a : s)
- Indigo.Lorentz: coerceWrap :: forall a (s :: [Type]). Wrappable a => (Unwrappable a : s) :-> (a : s)
+ Indigo.Lorentz: coerceWrap :: forall a (s :: [Type]). Wrappable a => (Unwrappabled a : s) :-> (a : s)
- Indigo.Lorentz: compileLorentzContract :: (NiceParameterFull cp, NiceStorage st) => Contract cp st -> Contract (ToT cp) (ToT st)
+ Indigo.Lorentz: compileLorentzContract :: ContractData cp st vd -> Contract cp st vd
- Indigo.Lorentz: composeStoreEntrypointOps :: forall (nameInStore :: Symbol) store substore (epName :: Symbol) epParam epStore. Label nameInStore -> StoreFieldOps store nameInStore substore -> StoreEntrypointOps substore epName epParam epStore -> StoreEntrypointOps store epName epParam epStore
+ Indigo.Lorentz: composeStoreEntrypointOps :: forall {k} store substore (nameInStore :: k) (epName :: Symbol) epParam epStore. (HasDupableGetters store, Dupable substore) => FieldRef nameInStore -> StoreFieldOps store nameInStore substore -> StoreEntrypointOps substore epName epParam epStore -> StoreEntrypointOps store epName epParam epStore
- Indigo.Lorentz: composeStoreFieldOps :: forall (nameInStore :: Symbol) store substore (nameInSubstore :: Symbol) field. Label nameInStore -> StoreFieldOps store nameInStore substore -> StoreFieldOps substore nameInSubstore field -> StoreFieldOps store nameInSubstore field
+ Indigo.Lorentz: composeStoreFieldOps :: forall {k1} {k2} substore (nameInStore :: k1) store (nameInSubstore :: k2) field. HasDupableGetters substore => FieldRef nameInStore -> StoreFieldOps store nameInStore substore -> StoreFieldOps substore nameInSubstore field -> StoreFieldOps store nameInSubstore field
- Indigo.Lorentz: composeStoreSubmapOps :: forall (nameInStore :: Symbol) store substore (mname :: Symbol) key value. Label nameInStore -> StoreFieldOps store nameInStore substore -> StoreSubmapOps substore mname key value -> StoreSubmapOps store mname key value
+ Indigo.Lorentz: composeStoreSubmapOps :: forall {k1} {k2} store substore (nameInStore :: k1) (mname :: k2) key value. (HasDupableGetters store, Dupable substore) => FieldRef nameInStore -> StoreFieldOps store nameInStore substore -> StoreSubmapOps substore mname key value -> StoreSubmapOps store mname key value
- Indigo.Lorentz: concreteTypeDocMichelsonRep :: forall k a (b :: k). (Typeable a, SingI (ToT a), HaveCommonTypeCtor b a) => TypeDocMichelsonRep b
+ Indigo.Lorentz: concreteTypeDocMichelsonRep :: forall {k} a (b :: k). (Typeable a, KnownIsoT a, HaveCommonTypeCtor b a) => TypeDocMichelsonRep b
- Indigo.Lorentz: constructStack :: forall dt (fields :: [Type]) (st :: [Type]). (InstrConstructC dt, ToTs fields ~ ToTs (ConstructorFieldTypes dt), KnownList fields) => (fields ++ st) :-> (dt : st)
+ Indigo.Lorentz: constructStack :: forall dt (fields :: [Type]) (st :: [Type]). (InstrConstructC dt, fields ~ ConstructorFieldTypes dt, (ToTs fields ++ ToTs st) ~ ToTs (fields ++ st)) => (fields ++ st) :-> (dt : st)
- Indigo.Lorentz: data StoreFieldOps store (fname :: Symbol) ftype
+ Indigo.Lorentz: data StoreFieldOps store (fname :: k) ftype
- Indigo.Lorentz: data StoreSubmapOps store (mname :: Symbol) key value
+ Indigo.Lorentz: data StoreSubmapOps store (mname :: k) key value
- Indigo.Lorentz: deconstruct :: forall dt (fields :: [Type]) (st :: [Type]). (InstrDeconstructC dt, KnownList fields, ToTs fields ~ ToTs (ConstructorFieldTypes dt)) => (dt : st) :-> (fields ++ st)
+ Indigo.Lorentz: deconstruct :: forall dt (fields :: [Type]) (st :: [Type]). (InstrDeconstructC dt (ToTs st), fields ~ GFieldTypes (Rep dt) ('[] :: [Type]), (ToTs fields ++ ToTs st) ~ ToTs (fields ++ st)) => (dt : st) :-> (fields ++ st)
- Indigo.Lorentz: defaultContract :: (NiceParameterFull cp, HasCallStack) => ContractCode cp st -> Contract cp st
+ Indigo.Lorentz: defaultContract :: (NiceParameterFull cp, NiceStorageFull st) => (IsNotInView => '[(cp, st)] :-> ContractOut st) -> Contract cp st ()
- Indigo.Lorentz: dipT :: forall a (inp :: [Type]) (dinp :: [Type]) (dout :: [Type]) (out :: [Type]). DipT inp a inp dinp dout out => (dinp :-> dout) -> inp :-> out
+ Indigo.Lorentz: dipT :: DipT a inp dipInp dipOut out => (dipInp :-> dipOut) -> inp :-> out
- Indigo.Lorentz: documentEntrypoint :: forall kind (epName :: Symbol) param (s :: [Type]) (out :: [Type]). (KnownSymbol epName, DocItem (DEntrypoint kind), TypeHasDoc param, HasAnnotation param, KnownValue param) => ((param : s) :-> out) -> (param : s) :-> out
+ Indigo.Lorentz: documentEntrypoint :: forall kind (epName :: Symbol) param (s :: [Type]) (out :: [Type]). (KnownSymbol epName, DocItem (DEntrypoint kind), NiceParameter param, TypeHasDoc param) => ((param : s) :-> out) -> (param : s) :-> out
- Indigo.Lorentz: dropT :: forall a (inp :: [Type]) (dinp :: [Type]) (dout :: [Type]) (out :: [Type]). (DipT inp a inp dinp dout out, dinp ~ (a : dout)) => inp :-> out
+ Indigo.Lorentz: dropT :: forall a (inp :: [Type]) (dinp :: [Type]) (dout :: [Type]) (out :: [Type]). (DipT a inp dinp dout out, dinp ~ (a : dout)) => inp :-> out
- Indigo.Lorentz: dupT :: forall a (st :: [Type]). DupT st a st => st :-> (a : st)
+ Indigo.Lorentz: dupT :: DupT a st => st :-> (a : st)
- Indigo.Lorentz: errorFromVal :: forall (t :: T). (IsError e, KnownT t) => Value t -> Either Text e
+ Indigo.Lorentz: errorFromVal :: forall (t :: T). (IsError e, SingI t) => Value t -> Either Text e
- Indigo.Lorentz: errorFromValNumeric :: forall (t :: T) e. (KnownT t, IsError e) => ErrorTagMap -> Value t -> Either Text e
+ Indigo.Lorentz: errorFromValNumeric :: forall (t :: T) e. (SingI t, IsError e) => ErrorTagMap -> Value t -> Either Text e
- Indigo.Lorentz: errorToValNumeric :: IsError e => ErrorTagMap -> e -> (forall (t :: T). ErrorScope t => Value t -> r) -> r
+ Indigo.Lorentz: errorToValNumeric :: IsError e => ErrorTagMap -> e -> (forall (t :: T). ConstantScope t => Value t -> r) -> r
- Indigo.Lorentz: failUsing :: forall e (s :: [Type]) (t :: [Type]). IsError e => e -> s :-> t
+ Indigo.Lorentz: failUsing :: forall (s :: [Type]) (t :: [Type]). (IsError e, IsError e) => e -> s :-> t
- Indigo.Lorentz: fromNamed :: forall (name :: Symbol) a (s :: [Type]). Label name -> (NamedF Identity a name : s) :-> (a : s)
+ Indigo.Lorentz: fromNamed :: forall (name :: Symbol) a (s :: [Type]). Label name -> ((name :! a) : s) :-> (a : s)
- Indigo.Lorentz: gForcedCoerce_ :: forall k t (a :: k) (b :: k) (s :: [Type]). MichelsonCoercible (t a) (t b) => (t a : s) :-> (t b : s)
+ Indigo.Lorentz: gForcedCoerce_ :: forall {k} t (a :: k) (b :: k) (s :: [Type]). MichelsonCoercible (t a) (t b) => (t a : s) :-> (t b : s)
- Indigo.Lorentz: getField :: forall dt (name :: Symbol) (st :: [Type]). InstrGetFieldC dt name => Label name -> (dt : st) :-> (GetFieldType dt name : (dt : st))
+ Indigo.Lorentz: getField :: forall dt (name :: Symbol) (st :: [Type]). (InstrGetFieldC dt name, Dupable (GetFieldType dt name), HasDupableGetters dt) => Label name -> (dt : st) :-> (GetFieldType dt name : (dt : st))
- Indigo.Lorentz: getFieldNamed :: forall dt (name :: Symbol) (st :: [Type]). InstrGetFieldC dt name => Label name -> (dt : st) :-> ((name :! GetFieldType dt name) : (dt : st))
+ Indigo.Lorentz: getFieldNamed :: forall dt (name :: Symbol) (st :: [Type]). (InstrGetFieldC dt name, Dupable (GetFieldType dt name), HasDupableGetters dt) => Label name -> (dt : st) :-> ((name :! GetFieldType dt name) : (dt : st))
- Indigo.Lorentz: haskellRepStripFieldPrefix :: HasCallStack => TypeDocHaskellRep a -> TypeDocHaskellRep a
+ Indigo.Lorentz: haskellRepStripFieldPrefix :: TypeDocHaskellRep a -> TypeDocHaskellRep a
- Indigo.Lorentz: homomorphicTypeDocMichelsonRep :: SingI (ToT a) => TypeDocMichelsonRep a
+ Indigo.Lorentz: homomorphicTypeDocMichelsonRep :: KnownIsoT a => TypeDocMichelsonRep a
- Indigo.Lorentz: interpretLorentzInstr :: forall (inp :: [Type]) (out :: [Type]). (IsoValuesStack inp, IsoValuesStack out) => ContractEnv -> (inp :-> out) -> Rec Identity inp -> Either MichelsonFailed (Rec Identity out)
+ Indigo.Lorentz: interpretLorentzInstr :: forall (inp :: [Type]) (out :: [Type]). (IsoValuesStack inp, IsoValuesStack out) => ContractEnv -> (IsNotInView => inp :-> out) -> Rec Identity inp -> Either (MichelsonFailureWithStack Void) (Rec Identity out)
- Indigo.Lorentz: interpretLorentzLambda :: (IsoValue inp, IsoValue out) => ContractEnv -> Lambda inp out -> inp -> Either MichelsonFailed out
+ Indigo.Lorentz: interpretLorentzLambda :: (IsoValue inp, IsoValue out) => ContractEnv -> (IsNotInView => Fn inp out) -> inp -> Either (MichelsonFailureWithStack Void) out
- Indigo.Lorentz: isoErrorFromVal :: forall (t :: T) e. (Typeable t, Typeable (ToT e), IsoValue e) => Value t -> Either Text e
+ Indigo.Lorentz: isoErrorFromVal :: forall (t :: T) e. (SingI t, KnownIsoT e, IsoValue e) => Value t -> Either Text e
- Indigo.Lorentz: lEncodeValue :: NicePrintedValue a => a -> ByteString
+ Indigo.Lorentz: lEncodeValue :: NiceUntypedValue a => a -> ByteString
- Indigo.Lorentz: mapStoreFieldOps :: forall field1 field2 store (name :: Symbol). LIso field1 field2 -> StoreFieldOps store name field1 -> StoreFieldOps store name field2
+ Indigo.Lorentz: mapStoreFieldOps :: forall {k} field1 field2 store (name :: k). KnownValue field1 => LIso field1 field2 -> StoreFieldOps store name field1 -> StoreFieldOps store name field2
- Indigo.Lorentz: mapStoreSubmapOpsKey :: forall key2 key1 store (name :: Symbol) value. Lambda key2 key1 -> StoreSubmapOps store name key1 value -> StoreSubmapOps store name key2 value
+ Indigo.Lorentz: mapStoreSubmapOpsKey :: forall {k} key2 key1 store (name :: k) value. Fn key2 key1 -> StoreSubmapOps store name key1 value -> StoreSubmapOps store name key2 value
- Indigo.Lorentz: mapStoreSubmapOpsValue :: forall value1 value2 store (name :: Symbol) key. KnownValue value1 => LIso value1 value2 -> StoreSubmapOps store name key value1 -> StoreSubmapOps store name key value2
+ Indigo.Lorentz: mapStoreSubmapOpsValue :: forall {k} value1 value2 store (name :: k) key. (KnownValue value1, KnownValue value2) => LIso value1 value2 -> StoreSubmapOps store name key value1 -> StoreSubmapOps store name key value2
- Indigo.Lorentz: mkDEntrypointArgSimple :: (KnownValue t, HasAnnotation t, TypeHasDoc t) => DEntrypointArg
+ Indigo.Lorentz: mkDEntrypointArgSimple :: (NiceParameter t, TypeHasDoc t) => DEntrypointArg
- Indigo.Lorentz: mkDEpUType :: (KnownValue t, HasAnnotation t) => Type
+ Indigo.Lorentz: mkDEpUType :: HasAnnotation t => Ty
- Indigo.Lorentz: mkUType :: forall (x :: T). SingI x => Notes x -> Type
+ Indigo.Lorentz: mkUType :: forall (x :: T). Notes x -> Ty
- Indigo.Lorentz: modifyField :: forall dt (name :: Symbol) (st :: [Type]). (InstrGetFieldC dt name, InstrSetFieldC dt name) => Label name -> (forall (st0 :: [Type]). () => (GetFieldType dt name : st0) :-> (GetFieldType dt name : st0)) -> (dt : st) :-> (dt : st)
+ Indigo.Lorentz: modifyField :: forall dt (name :: Symbol) (st :: [Type]). (InstrGetFieldC dt name, InstrSetFieldC dt name, Dupable (GetFieldType dt name), HasDupableGetters dt) => Label name -> (forall (st0 :: [Type]). () => (GetFieldType dt name : st0) :-> (GetFieldType dt name : st0)) -> (dt : st) :-> (dt : st)
- Indigo.Lorentz: newtype TAddress (p :: k)
+ Indigo.Lorentz: newtype TAddress p vd
- Indigo.Lorentz: parseLorentzValue :: KnownValue v => Text -> Either ParseLorentzError v
+ Indigo.Lorentz: parseLorentzValue :: KnownValue v => MichelsonSource -> Text -> Either ParseLorentzError v
- Indigo.Lorentz: printLorentzContract :: (NiceParameterFull cp, NiceStorage st) => Bool -> Contract cp st -> LText
+ Indigo.Lorentz: printLorentzContract :: Bool -> Contract cp st vd -> LText
- Indigo.Lorentz: printLorentzValue :: NicePrintedValue v => Bool -> v -> LText
+ Indigo.Lorentz: printLorentzValue :: NiceUntypedValue v => Bool -> v -> LText
- Indigo.Lorentz: sequenceStoreSubmapOps :: forall store substore value (name :: Symbol) (subName :: Symbol) key1 key2. (NiceConstant substore, KnownValue value) => Label name -> LIso (Maybe substore) substore -> StoreSubmapOps store name key1 substore -> StoreSubmapOps substore subName key2 value -> StoreSubmapOps store subName (key1, key2) value
+ Indigo.Lorentz: sequenceStoreSubmapOps :: forall {k1} {k2} store substore value (name :: k1) (subName :: k2) key1 key2. (NiceConstant substore, KnownValue value, Dupable (key1, key2), Dupable store) => FieldRef name -> LIso (Maybe substore) substore -> StoreSubmapOps store name key1 substore -> StoreSubmapOps substore subName key2 value -> StoreSubmapOps store subName (key1, key2) value
- Indigo.Lorentz: stEntrypoint :: forall store (epName :: Symbol) epParam epStore (s :: [Type]). StoreHasEntrypoint store epName epParam epStore => Label epName -> (epParam : (store : s)) :-> (([Operation], store) : s)
+ Indigo.Lorentz: stEntrypoint :: forall store (epName :: Symbol) epParam epStore (s :: [Type]). (StoreHasEntrypoint store epName epParam epStore, Dupable store) => Label epName -> (epParam : (store : s)) :-> (([Operation], store) : s)
- Indigo.Lorentz: stGetEpLambda :: forall store (epName :: Symbol) epParam epStore (s :: [Type]). StoreHasEntrypoint store epName epParam epStore => Label epName -> (store : s) :-> (EntrypointLambda epParam epStore : (store : s))
+ Indigo.Lorentz: stGetEpLambda :: forall store (epName :: Symbol) epParam epStore (s :: [Type]). (StoreHasEntrypoint store epName epParam epStore, Dupable store) => Label epName -> (store : s) :-> (EntrypointLambda epParam epStore : (store : s))
- Indigo.Lorentz: stGetEpStore :: forall store (epName :: Symbol) epParam epStore (s :: [Type]). StoreHasEntrypoint store epName epParam epStore => Label epName -> (store : s) :-> (epStore : (store : s))
+ Indigo.Lorentz: stGetEpStore :: forall store (epName :: Symbol) epParam epStore (s :: [Type]). (StoreHasEntrypoint store epName epParam epStore, Dupable store) => Label epName -> (store : s) :-> (epStore : (store : s))
- Indigo.Lorentz: stGetField :: forall store (fname :: Symbol) ftype (s :: [Type]). StoreHasField store fname ftype => Label fname -> (store : s) :-> (ftype : (store : s))
+ Indigo.Lorentz: stGetField :: forall {k} store (fname :: k) ftype (s :: [Type]). (StoreHasField store fname ftype, Dupable ftype, HasDupableGetters store) => FieldRef fname -> (store : s) :-> (ftype : (store : s))
- Indigo.Lorentz: stSetEpLambda :: forall store (epName :: Symbol) epParam epStore (s :: [Type]). StoreHasEntrypoint store epName epParam epStore => Label epName -> (EntrypointLambda epParam epStore : (store : s)) :-> (store : s)
+ Indigo.Lorentz: stSetEpLambda :: forall store (epName :: Symbol) epParam epStore (s :: [Type]). (StoreHasEntrypoint store epName epParam epStore, HasDupableGetters store) => Label epName -> (EntrypointLambda epParam epStore : (store : s)) :-> (store : s)
- Indigo.Lorentz: stSetField :: forall store (fname :: Symbol) ftype (s :: [Type]). StoreHasField store fname ftype => Label fname -> (ftype : (store : s)) :-> (store : s)
+ Indigo.Lorentz: stSetField :: forall {k} store (fname :: k) ftype (s :: [Type]). StoreHasField store fname ftype => FieldRef fname -> (ftype : (store : s)) :-> (store : s)
- Indigo.Lorentz: stToField :: forall store (fname :: Symbol) ftype (s :: [Type]). StoreHasField store fname ftype => Label fname -> (store : s) :-> (ftype : s)
+ Indigo.Lorentz: stToField :: forall {k} store (fname :: k) ftype (s :: [Type]). StoreHasField store fname ftype => FieldRef fname -> (store : s) :-> (ftype : s)
- Indigo.Lorentz: stackRef :: forall (gn :: Nat) (st :: [T]) (n :: Peano). (n ~ ToPeano gn, SingI n, KnownPeano n, RequireLongerThan st n) => PrintComment st
+ Indigo.Lorentz: stackRef :: forall (gn :: Nat) (st :: [T]) (n :: Peano). (n ~ ToPeano gn, SingI n, RequireLongerThan st n) => PrintComment st
- Indigo.Lorentz: storeEntrypointOpsDeeper :: forall store (nameInStore :: Symbol) substore (epName :: Symbol) epParam epStore. (HasFieldOfType store nameInStore substore, StoreHasEntrypoint substore epName epParam epStore) => Label nameInStore -> StoreEntrypointOps store epName epParam epStore
+ Indigo.Lorentz: storeEntrypointOpsDeeper :: forall store (nameInStore :: Symbol) substore (epName :: Symbol) epParam epStore. (HasFieldOfType store nameInStore substore, StoreHasEntrypoint substore epName epParam epStore, HasDupableGetters store, Dupable substore) => FieldRef nameInStore -> StoreEntrypointOps store epName epParam epStore
- Indigo.Lorentz: storeFieldOpsDeeper :: forall storage (fieldsPartName :: Symbol) fields (fname :: Symbol) ftype. (HasFieldOfType storage fieldsPartName fields, StoreHasField fields fname ftype) => Label fieldsPartName -> StoreFieldOps storage fname ftype
+ Indigo.Lorentz: storeFieldOpsDeeper :: forall {k} storage (fieldsPartName :: Symbol) fields (fname :: k) ftype. (HasFieldOfType storage fieldsPartName fields, StoreHasField fields fname ftype, HasDupableGetters fields) => FieldRef fieldsPartName -> StoreFieldOps storage fname ftype
- Indigo.Lorentz: storeFieldOpsReferTo :: forall (name :: Symbol) storage field (desiredName :: Symbol). Label name -> StoreFieldOps storage name field -> StoreFieldOps storage desiredName field
+ Indigo.Lorentz: storeFieldOpsReferTo :: forall {k1} {k2} (name :: k1) storage field (desiredName :: k2). FieldRef name -> StoreFieldOps storage name field -> StoreFieldOps storage desiredName field
- Indigo.Lorentz: storeSubmapOpsDeeper :: forall storage (bigMapPartName :: Symbol) fields (mname :: Symbol) key value. (HasFieldOfType storage bigMapPartName fields, StoreHasSubmap fields mname key value) => Label bigMapPartName -> StoreSubmapOps storage mname key value
+ Indigo.Lorentz: storeSubmapOpsDeeper :: forall {k} storage (bigMapPartName :: Symbol) fields key value (mname :: k). (HasFieldOfType storage bigMapPartName fields, StoreHasSubmap fields SelfRef key value, HasDupableGetters storage, Dupable fields) => FieldRef bigMapPartName -> StoreSubmapOps storage mname key value
- Indigo.Lorentz: storeSubmapOpsReferTo :: forall (name :: Symbol) storage key value (desiredName :: Symbol). Label name -> StoreSubmapOps storage name key value -> StoreSubmapOps storage desiredName key value
+ Indigo.Lorentz: storeSubmapOpsReferTo :: forall {k1} {k2} (name :: k1) storage key value (desiredName :: k2). FieldRef name -> StoreSubmapOps storage name key value -> StoreSubmapOps storage desiredName key value
- Indigo.Lorentz: testAssert :: forall (out :: [Type]) (inp :: [Type]). (Typeable (ToTs out), HasCallStack) => Text -> PrintComment (ToTs inp) -> (inp :-> (Bool : out)) -> inp :-> inp
+ Indigo.Lorentz: testAssert :: forall (inp :: [Type]) (out :: [Type]). HasCallStack => Text -> PrintComment (ToTs inp) -> (inp :-> (Bool : out)) -> inp :-> inp
- Indigo.Lorentz: toMutez :: Word32 -> Mutez
+ Indigo.Lorentz: toMutez :: (Integral a, CheckIntSubType a Word63) => a -> Mutez
- Indigo.Lorentz: toNamed :: forall (name :: Symbol) a (s :: [Type]). Label name -> (a : s) :-> (NamedF Identity a name : s)
+ Indigo.Lorentz: toNamed :: forall (name :: Symbol) a (s :: [Type]). Label name -> (a : s) :-> ((name :! a) : s)
- Indigo.Lorentz: toTAddress :: ToTAddress cp a => a -> TAddress cp
+ Indigo.Lorentz: toTAddress :: ToTAddress cp vd a => a -> TAddress cp vd
- Indigo.Lorentz: type ConstructorFieldTypes dt = GFieldTypes Rep dt
+ Indigo.Lorentz: type ConstructorFieldTypes dt = GFieldTypes Rep dt '[] :: [Type]
- Indigo.Lorentz: type DocumentEntrypoints kind a = (Generic a, GDocumentEntrypoints kind Rep a)
+ Indigo.Lorentz: type DocumentEntrypoints kind a = (Generic a, GDocumentEntrypoints BuildEPTree' a kind Rep a '[] :: [CaseClauseParam])
- Indigo.Lorentz: type ErrorScope (t :: T) = (Typeable t, ConstantScope t)
+ Indigo.Lorentz: type ErrorScope (t :: T) = ConstantScope t
- Indigo.Lorentz: type InstrConstructC dt = (GenericIsoValue dt, GInstrConstruct Rep dt)
+ Indigo.Lorentz: type InstrConstructC dt = (GenericIsoValue dt, GInstrConstruct Rep dt '[] :: [Type])
- Indigo.Lorentz: type Lambda i o = '[i] :-> '[o]
+ Indigo.Lorentz: type Lambda i o = WrappedLambda '[i] '[o]
- Indigo.Lorentz: type NiceComparable n = (KnownValue n, Comparable ToT n)
+ Indigo.Lorentz: type NiceComparable n = (ProperNonComparableValBetterErrors ToT n, KnownValue n, Comparable ToT n)
- Indigo.Lorentz: type NiceConstant a = (KnownValue a, ProperConstantBetterErrors ToT a)
+ Indigo.Lorentz: type NiceConstant a = (ProperConstantBetterErrors ToT a, KnownValue a)
- Indigo.Lorentz: type NicePackedValue a = (KnownValue a, ProperPackedValBetterErrors ToT a)
+ Indigo.Lorentz: type NicePackedValue a = (ProperPackedValBetterErrors ToT a, KnownValue a)
- Indigo.Lorentz: type NiceParameter a = (KnownValue a, ProperParameterBetterErrors ToT a)
+ Indigo.Lorentz: type NiceParameter a = (ProperParameterBetterErrors ToT a, KnownValue a)
- Indigo.Lorentz: type NiceStorage a = (HasAnnotation a, KnownValue a, ProperStorageBetterErrors ToT a)
+ Indigo.Lorentz: type NiceStorage a = (ProperStorageBetterErrors ToT a, KnownValue a)
- Indigo.Lorentz: type NiceUnpackedValue a = (KnownValue a, ProperUnpackedValBetterErrors ToT a)
+ Indigo.Lorentz: type NiceUnpackedValue a = (ProperUnpackedValBetterErrors ToT a, KnownValue a)
- Indigo.Lorentz: zoomStoreSubmapOps :: forall store (submapName :: Symbol) (nameInSubmap :: Symbol) key value subvalue. (NiceConstant value, NiceConstant subvalue) => Label submapName -> LIso (Maybe value) value -> LIso (Maybe subvalue) subvalue -> StoreSubmapOps store submapName key value -> StoreFieldOps value nameInSubmap subvalue -> StoreSubmapOps store nameInSubmap key subvalue
+ Indigo.Lorentz: zoomStoreSubmapOps :: forall {k1} {k2} store (submapName :: k1) (nameInSubmap :: k2) key value subvalue. (NiceConstant value, NiceConstant subvalue, Dupable key, Dupable store) => FieldRef submapName -> LIso (Maybe value) value -> LIso (Maybe subvalue) subvalue -> StoreSubmapOps store submapName key value -> StoreFieldOps value nameInSubmap subvalue -> StoreSubmapOps store nameInSubmap key subvalue
- Indigo.Prelude: All :: Bool -> All
+ Indigo.Prelude: All :: a -> All a
- Indigo.Prelude: Any :: Bool -> Any
+ Indigo.Prelude: Any :: a -> Any a
- Indigo.Prelude: [getAll] :: All -> Bool
+ Indigo.Prelude: [getAll] :: All a -> a
- Indigo.Prelude: [getAny] :: Any -> Bool
+ Indigo.Prelude: [getAny] :: Any a -> a
- Indigo.Prelude: all :: Container t => (Element t -> Bool) -> t -> Bool
+ Indigo.Prelude: all :: (Container c, BooleanMonoid b) => (Element c -> b) -> c -> b
- Indigo.Prelude: any :: Container t => (Element t -> Bool) -> t -> Bool
+ Indigo.Prelude: any :: (Container c, BooleanMonoid b) => (Element c -> b) -> c -> b
- Indigo.Prelude: foldl1 :: Container t => (Element t -> Element t -> Element t) -> t -> Element t
+ Indigo.Prelude: foldl1 :: (a -> a -> a) -> NonEmpty a -> a
- Indigo.Prelude: foldr1 :: Container t => (Element t -> Element t -> Element t) -> t -> Element t
+ Indigo.Prelude: foldr1 :: (a -> a -> a) -> NonEmpty a -> a
- Indigo.Prelude: fromIntegral :: (Integral a, Num b) => a -> b
+ Indigo.Prelude: fromIntegral :: (Integral a, Integral b, CheckIntSubType a b) => a -> b
- Indigo.Prelude: infixl 0 `on`
+ Indigo.Prelude: infixl 0 `hashWithSalt`
- Indigo.Prelude: infixr 1 =<<
+ Indigo.Prelude: infixr 1 >=>
- Indigo.Prelude: mapAccumL :: Traversable t => (a -> b -> (a, c)) -> a -> t b -> (a, t c)
+ Indigo.Prelude: mapAccumL :: Traversable t => (s -> a -> (s, b)) -> s -> t a -> (s, t b)
- Indigo.Prelude: mapAccumR :: Traversable t => (a -> b -> (a, c)) -> a -> t b -> (a, t c)
+ Indigo.Prelude: mapAccumR :: Traversable t => (s -> a -> (s, b)) -> s -> t a -> (s, t b)
- Indigo.Prelude: maximum :: Container t => t -> Element t
+ Indigo.Prelude: maximum :: Ord a => NonEmpty a -> a
- Indigo.Prelude: maximumBy :: Foldable t => (a -> a -> Ordering) -> t a -> a
+ Indigo.Prelude: maximumBy :: (a -> a -> Ordering) -> NonEmpty a -> a
- Indigo.Prelude: minimum :: Container t => t -> Element t
+ Indigo.Prelude: minimum :: Ord a => NonEmpty a -> a
- Indigo.Prelude: minimumBy :: Foldable t => (a -> a -> Ordering) -> t a -> a
+ Indigo.Prelude: minimumBy :: (a -> a -> Ordering) -> NonEmpty a -> a
- Indigo.Prelude: newtype All
+ Indigo.Prelude: newtype All a
- Indigo.Prelude: newtype Any
+ Indigo.Prelude: newtype Any a
- Indigo.Prelude: seq :: a -> b -> b
+ Indigo.Prelude: seq :: forall {r :: RuntimeRep} a (b :: TYPE r). a -> b -> b
- Indigo.Prelude: show :: forall b a. (Show a, IsString b) => a -> b
+ Indigo.Prelude: show :: forall b a. (PrettyShow a, Show a, IsString b) => a -> b
- Indigo.Prelude: type family Element t
+ Indigo.Prelude: type family FromListC l
- Indigo.Print: printAsMichelson :: forall param st m. (IsObject st, NiceParameterFull param, NiceStorage st, MonadIO m) => CommentSettings -> IndigoContract param st -> m ()
+ Indigo.Print: printAsMichelson :: forall param st m. (IsObject st, NiceParameterFull param, NiceStorageFull st, MonadIO m) => CommentSettings -> IndigoContract param st -> m ()
- Indigo.Print: printDocumentation :: forall param st m. (IsObject st, NiceParameterFull param, MonadIO m) => IndigoContract param st -> m ()
+ Indigo.Print: printDocumentation :: forall param st m. (IsObject st, NiceParameterFull param, NiceStorageFull st, MonadIO m) => IndigoContract param st -> m ()
- Indigo.Print: printIndigoContract :: forall param st. (IsObject st, NiceParameterFull param, NiceStorage st) => Bool -> CommentSettings -> IndigoContract param st -> LText
+ Indigo.Print: printIndigoContract :: forall param st. (IsObject st, NiceParameterFull param, NiceStorageFull st) => Bool -> CommentSettings -> IndigoContract param st -> LText
- Indigo.Print: renderIndigoDoc :: forall param st. (IsObject st, NiceParameterFull param) => IndigoContract param st -> LText
+ Indigo.Print: renderIndigoDoc :: forall param st. (IsObject st, NiceParameterFull param, NiceStorageFull st) => IndigoContract param st -> LText
- Indigo.Print: saveAsMichelson :: forall param st m. (IsObject st, NiceParameterFull param, NiceStorage st, MonadIO m, MonadMask m) => CommentSettings -> IndigoContract param st -> FilePath -> m ()
+ Indigo.Print: saveAsMichelson :: forall param st m. (IsObject st, NiceParameterFull param, NiceStorageFull st, MonadIO m, MonadMask m) => CommentSettings -> IndigoContract param st -> FilePath -> m ()
- Indigo.Print: saveDocumentation :: forall param st m. (IsObject st, NiceParameterFull param, MonadIO m, MonadMask m) => IndigoContract param st -> FilePath -> m ()
+ Indigo.Print: saveDocumentation :: forall param st m. (IsObject st, NiceParameterFull param, NiceStorageFull st, MonadIO m, MonadMask m) => IndigoContract param st -> FilePath -> m ()

Files

CHANGES.md view
@@ -1,3 +1,49 @@+Unreleased+==========+<!-- Append new entries here -->+* [!43](https://gitlab.com/morley-framework/indigo/-/merge_requests/43)+  Add emit instruction+  + New user-facing function `Indigo.Frontend.Language.emit` to emit contract+    events.+  + `annQ` and `FieldAnn` are re-exported from `Indigo.Frontend.Language` and+    consequently `Indigo`.+* [!42](https://gitlab.com/morley-framework/indigo/-/merge_requests/42)+  Updates for kathmandu+  + Bump dependencies+  + Fix typo in "division by zero" error text (was "devision by zero") in the+    expression code generator.+* [!41](https://gitlab.com/morley-framework/indigo/-/merge_requests/41)+  Updates for jakarta and GHC-9+  + Bump dependencies+  + Bump compiler/stack resolver+  + Bump docker base image+  + Note that due to Jakarta changes, some functions may need `IsNotInView`+    constraint now, exported from `Indigo.Lorentz` and `Indigo`.+* [!35](https://gitlab.com/morley-framework/indigo/-/merge_requests/35)+  Add upgrade command; generate indigo-dependency-snapshot.yaml on demand+  + Add an `indigo upgrade` command, building the latest indigo version+  + Also update project generator for latest indigo/morley+* [!36](https://gitlab.com/morley-framework/indigo/-/merge_requests/36)+  Reorganize Indigo modules+  - Get rid of `Indigo.Internal` and `Indigo.Internal.Expr` "god modules"+  - Several moves:+      - `Indigo.Internal.Lookup`, `Indigo.Internal.Expr.Compilation`, `Indigo.Internal.Expr.Decompose` to `Indigo.Backend.*`+      - `Indigo.Internal.Expr.Symbolic` to `Indigo.Frontend.Expr`+      - `Indigo.Frontend.Statement` to `Indigo.Frontend.Internal.Statement` (it's not reexported)+      - `Indigo.Common.Expr.Types` to `Indigo.Common.Expr`+  - Do not re-export backend parts from `Indigo`, specifically, `Indigo.Backend.Expr.*` and `Indigo.Backend.Lookup`+  - Rename `Indigo.Internal.*` to `Indigo.Common.*` (not really internal, since it's exported from `Indigo`)+  - Rename `Indigo.Rebinded` to `Indigo.Rebound`+  - Split type definitions from `Indigo.Compilation.Sequential` into `Indigo.Compilation.Sequential.Types`+* [!34](https://gitlab.com/morley-framework/indigo/-/merge_requests/34)+  Replace `dip dip` with `dip 2` in the code generator+* [!24](https://gitlab.com/morley-framework/indigo/-/merge_requests/24)+  Bump Morley/Lorentz and comply with the changes in them.+* [!15](https://gitlab.com/morley-framework/indigo/-/merge_requests/15)+  Add `failCustomNoArg` which allows failing with just a string instead of `pair string <arg>`.+* [!18](https://gitlab.com/morley-framework/indigo/-/merge_requests/18)+  Bump over Morley/Lorentz with all the edo functionality (but tickets are not yet supported).+ 0.5.0 ========== * [!12](https://gitlab.com/morley-framework/indigo/-/merge_requests/12)
LICENSE view
@@ -1,4 +1,6 @@-MIT License Copyright (c) 2020 Tocqueville Group+MIT License+Copyright (c) 2021-2022 Oxhead Alpha+Copyright (c) 2019-2021 Tocqueville Group  Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal
README.md view
@@ -1,3 +1,7 @@+> :warning: **Note: this project is being deprecated.**+>+> It will no longer be maintained after the activation of protocol "N" on the Tezos mainnet.+ # Indigo eDSL  [![Hackage](https://img.shields.io/hackage/v/indigo.svg)](https://hackage.haskell.org/package/indigo)
app/FileGen.hs view
@@ -1,37 +1,37 @@--- SPDX-FileCopyrightText: 2020 Tocqueville Group------ SPDX-License-Identifier: LicenseRef-MIT-TQ+-- SPDX-FileCopyrightText: 2021 Oxhead Alpha+-- SPDX-License-Identifier: LicenseRef-MIT-OA  -- | File Generation machinery that resembles @summoner@ library. module FileGen   ( run   ) where +import FileGen.Tree (FsTree(..), drawFsTree, makeFS) import System.Directory (setCurrentDirectory)-import Summoner.Tree (TreeFs(..), showBoldTree, traverseTree) -import qualified FileGen.Files as F+import FileGen.Files qualified as F+import Paths_indigo (version) -run :: Text -> IO ()-run projectName =-  createProjectDirectoryCustom (CustomSettings projectName)+run :: Text -> Maybe Text -> IO ()+run projectName gitRev =+  createProjectDirectoryCustom (CustomSettings projectName gitRev)  -- | From the given 'CustomSettings' creates the project. createProjectDirectoryCustom :: CustomSettings -> IO () createProjectDirectoryCustom settings@CustomSettings{..} = do   let tree = createProjectTemplateCustom settings-  traverseTree tree+  makeFS "." tree   putTextLn "The project with the following structure has been created:"-  putTextLn $ showBoldTree tree+  drawFsTree tree   setCurrentDirectory (toString sProjectName)  -- | Creating tree structure of the project.-createProjectTemplateCustom :: CustomSettings -> TreeFs+createProjectTemplateCustom :: CustomSettings -> FsTree createProjectTemplateCustom settings@CustomSettings{..} =   Dir (toString sProjectName) $ generateFiles settings  -- | Files Template-generateFiles :: CustomSettings -> [TreeFs]+generateFiles :: CustomSettings -> [FsTree] generateFiles CustomSettings{..} =   [ Dir "app"       [ File "Main.hs" F.main ]@@ -41,6 +41,7 @@       [ Dir "Test"           [ File "Basic.hs" F.basicTest ]       , File "Main.hs" F.mainTest+      , File "Tree.hs" F.treeTest       ]   , File "ChangeLog.md" (F.changelog sProjectName)   , File "README.md" (F.readme sProjectName)@@ -48,9 +49,12 @@   , File "package.yaml" (F.packageYaml sProjectName)   , File "stack.yaml" F.stackYaml   , File "indigo-snapshot.yaml" F.indigoSnapshotYaml-  , File "indigo-dependence-snapshot.yaml" F.indigoDependenceSnapshotYaml+  , File "indigo-dependence-snapshot.yaml" $+      F.indigoDependenceSnapshotYaml $+        maybe (F.DSVPublishedVersion version) F.DSVGitCommitSha sGitRev   ]  data CustomSettings = CustomSettings   { sProjectName :: Text+  , sGitRev :: Maybe Text   }
app/FileGen/Files.hs view
@@ -1,12 +1,12 @@--- SPDX-FileCopyrightText: 2020 Tocqueville Group------ SPDX-License-Identifier: LicenseRef-MIT-TQ+-- SPDX-FileCopyrightText: 2021 Oxhead Alpha+-- SPDX-License-Identifier: LicenseRef-MIT-OA  -- | List of functions that generate the files for 'FileGen'. module FileGen.Files   ( main   , basic   , mainTest+  , treeTest   , basicTest   , changelog   , readme@@ -15,10 +15,15 @@   , stackYaml   , indigoSnapshotYaml   , indigoDependenceSnapshotYaml+  , DependenceSnapshotVersion(..)   ) where  import Data.FileEmbed (embedStringFile) import Data.String.Interpolate (i)+import Data.Time.Clock (getCurrentTime)+import Data.Time.Format (defaultTimeLocale, formatTime)+import Data.Version (Version, showVersion)+import System.IO.Unsafe (unsafePerformIO)  import Helper @@ -79,8 +84,8 @@ import Indigo import Lorentz.Run (Contract) -basicContractLorentz :: Contract Integer Integer-basicContractLorentz = defaultContract $ compileIndigoContract basicContract+basicContractLorentz :: Contract Integer Integer ()+basicContractLorentz = mkContract $ compileIndigoContract basicContract  basicContract :: IndigoContract Integer Integer basicContract param = defContract do@@ -95,47 +100,48 @@  basicTest :: Text basicTest = [i|module Test.Basic-  ( unit_updates_storage_properly+  ( test_updates_storage_properly   ) where  import Basic (basicContractLorentz) -import Lorentz-import Lorentz.Test-import Michelson.Test.Integrational-import Michelson.Typed.Convert-import Test.Tasty.HUnit (Assertion)+import Test.Tasty (TestTree) -unit_updates_storage_properly :: Assertion-unit_updates_storage_properly = integrationalTestExpectation $ do-  contractAddr <- originate (convertContract $ compileLorentzContract basicContractLorentz) "basic"-          (untypeValue $ toVal (10 :: Integer)) (zeroMutez)+import Test.Cleveland -  let-    txData = TxData-      { tdSenderAddress = genesisAddress-      , tdParameter = TxTypedParam $ toVal (90 :: Integer)-      , tdEntrypoint = DefEpName-      , tdAmount = zeroMutez-      }+test_updates_storage_properly :: TestTree+test_updates_storage_properly = testScenario "Basic test" $ scenario do+  contractAddr <- originate "basic" (10 :: Integer) basicContractLorentz -  transfer txData contractAddr+  transfer contractAddr $ calling def 90 -  expectStorageConst contractAddr-    $ untypeValue $ toVal (100 :: Integer)+  getStorage contractAddr @@== 100+ |] +treeTest :: Text+treeTest =+  "{-# OPTIONS_GHC -F -pgmF tasty-discover -optF --tree-display -optF \+  \--generated-module -optF Tree #-}\n"+ mainTest :: Text-mainTest = "{-# OPTIONS_GHC -F -pgmF tasty-discover #-}\n"+mainTest = [i|module Main (main) where +import Test.Cleveland.Tasty+import Tree (tests)++main :: IO ()+main = tests >>= clevelandMain+|]+ changelog :: Text -> Text-changelog projectName = [i|# Changelog for #{projectName}+changelog projectName = [i|\# Changelog for #{projectName} -## Unreleased changes+\#\# Unreleased changes |]  readme :: Text -> Text-readme projectName = [i|# #{projectName}+readme projectName = [i|\# #{projectName} |]  gitignore :: Text@@ -156,7 +162,7 @@ - README.md - ChangeLog.md -description:         Please see the README on GitHub at <https://github.com/githubuser/#{projectName}#readme>+description:         Please see the README on GitHub at <https://github.com/githubuser/#{projectName}\#readme>  verbatim:   cabal-version: 2.2@@ -222,6 +228,8 @@   - -Wno-missing-local-signatures   - -Wno-monomorphism-restriction   - -Wno-implicit-prelude+  - -Wno-missing-safe-haskell-mode+  - -Wno-prepositive-qualified-module  library:   source-dirs: src@@ -232,11 +240,8 @@     - Paths_#{useUnderscore projectName}    dependencies:-    - containers-    - fmt     - indigo     - lorentz-    - morley     - text  executables:@@ -249,7 +254,6 @@       - containers       - morley       - lorentz-      - indigo       - optparse-applicative       - universum       - with-utf8@@ -267,16 +271,8 @@     dependencies:       - #{projectName}       - cleveland-      - containers-      - fmt-      - hspec-      - hspec-expectations-      - HUnit       - lorentz-      - morley       - tasty-      - tasty-hspec-      - tasty-hunit-compat |]  stackYaml :: Text@@ -293,5 +289,33 @@ indigoSnapshotYaml :: Text indigoSnapshotYaml = $(embedStringFile "./snapshots/indigo-snapshot.yaml") -indigoDependenceSnapshotYaml :: Text-indigoDependenceSnapshotYaml = $(embedStringFile "./snapshots/indigo-dependence-snapshot.yaml")+data DependenceSnapshotVersion+  = DSVGitCommitSha Text+  | DSVPublishedVersion Version++indigoDependenceSnapshotYaml :: DependenceSnapshotVersion -> Text+indigoDependenceSnapshotYaml dsv = [i|+\# SPDX-FileCopyrightText: #{year} Oxhead Alpha+\# SPDX-License-Identifier: LicenseRef-MIT-OA++name: indigo-dependence-snapshot++\# See more extra-deps in 'indigo-snapshot.yaml'.+resolver: indigo-snapshot.yaml++\# The 'packages' here act as 'extra-deps'.+packages:#{package}|]+  where+    package :: Text+    package = case dsv of+      DSVGitCommitSha rev -> [i|+- git: https://gitlab.com/morley-framework/indigo.git+  commit: #{rev}+|]+      DSVPublishedVersion ver -> [i|+- indigo-#{showVersion ver}+|]+    -- we're just reading system clock here, this is pretty safe;+    -- besides, we're only calling this once per run, so sharing caveats+    -- don't apply;+    year = unsafePerformIO $ formatTime defaultTimeLocale "%Y" <$> getCurrentTime
+ app/FileGen/Tree.hs view
@@ -0,0 +1,46 @@+-- SPDX-FileCopyrightText: 2022 Oxhead Alpha+-- SPDX-License-Identifier: LicenseRef-MIT-OA++{-# LANGUAGE ViewPatterns #-}++module FileGen.Tree+       ( FsTree (..)+       , makeFS+       , drawFsTree+       ) where++import Data.Tree (Tree(..))+import Data.Tree.View (drawTree)+import System.Directory (createDirectoryIfMissing)+import System.FilePath ((</>))+import Universum.Lifted.File (writeFile)++-- | Represents a filesystem directory tree description, with 'Text' files.+data FsTree+  = Dir -- ^ A directory+      String -- ^ The name of the directory+      [FsTree] -- ^ The forest of directory contents+  | File -- ^ A text file+      String -- ^ The name of the file+      Text -- ^ File content++-- | Create files and directories from 'FsTree' description.+makeFS+  :: FilePath -- ^ Path to the root directory of the tree+  -> FsTree -- ^ The tree description+  -> IO ()+makeFS root = \case+  File name content -> do+    writeFile (root </> name) content+  Dir name sub -> do+    let path = root </> name+    createDirectoryIfMissing True path+    mapM_ (makeFS path) sub++-- | Output the unicode-art representation of 'FsTree' to stdout.+drawFsTree :: FsTree -> IO ()+drawFsTree = drawTree . toStringTree+  where+    toStringTree = \case+      File name _ -> Node name []+      Dir name sub -> Node name $ toStringTree <$> sub
app/Helper.hs view
@@ -11,10 +11,15 @@   , indigoTitle   , indigoDesc   , indigoRunCommand+  , repo+  , doesExistProjectName   ) where +import Data.Text qualified as T+import Network.HTTP.Req (Scheme(Https), Url, https, (/:)) import Prelude hiding (many)-import qualified Data.Text as T+import System.Directory (doesPathExist, getCurrentDirectory)+import System.FilePath ((</>)) import Text.Megaparsec (Parsec, eof, many, runParser, sepBy1) import Text.Megaparsec.Char (char, digitChar, letterChar) @@ -61,3 +66,12 @@ -- Mainly use to manipulate package name. useUnderscore :: Text -> Text useUnderscore = T.replace "-" "_"++repo :: Text -> Url 'Https+repo revision = https "gitlab.com" /: "morley-framework" /: "indigo" /: "-"+  /: "raw" /: revision++doesExistProjectName :: Text -> IO Bool+doesExistProjectName projectName = do+  curPath <- getCurrentDirectory+  doesPathExist $ curPath </> toString projectName
app/Main.hs view
@@ -1,162 +1,93 @@--- SPDX-FileCopyrightText: 2020 Tocqueville Group------ SPDX-License-Identifier: LicenseRef-MIT-TQ+-- SPDX-FileCopyrightText: 2021 Oxhead Alpha+-- SPDX-License-Identifier: LicenseRef-MIT-OA  module Main   ( main   ) where  import Data.Text (dropWhileEnd)-import qualified Data.Text.IO.Utf8 as Utf8+import Data.Text.IO.Utf8 qualified as Utf8 import Data.Version (showVersion) import Options.Applicative-  (command, execParser, fullDesc, header, help, helper, info, infoOption, long, progDesc,-  subparser)-import qualified Options.Applicative as Opt+  (command, execParser, fullDesc, header, help, helper, info, infoOption, long, progDesc, subparser)+import Options.Applicative qualified as Opt import Paths_indigo (version)-import qualified Shelly as S-import Summoner.Question (doesExistProjectName)-import qualified System.Environment as SE+import Shelly qualified as S+import System.Environment qualified as SE import System.Process -import Util.Main (wrapMain)+import Morley.Util.Main (wrapMain) -import qualified FileGen+import FileGen qualified import Helper--data CmdLnArgs-  = New Text-  | Build-  | Run-  | Repl-  | Test+import Upgrade qualified -argParser :: Opt.Parser CmdLnArgs-argParser = subparser $-  newSubCmd <>-  buildSubCmd <>-  runSubCmd <>-  replSubCmd <>-  testSubCmd+argParser :: Opt.Parser (IO ())+argParser =+  subparser $+    newSubCmd <>+    buildSubCmd <>+    runSubCmd <>+    replSubCmd <>+    upgradeSubCmd <>+    testSubCmd    where-    mkCommandParser commandName parser desc =+    mkCommandParser commandName desc parser =       command commandName $       info (helper <*> parser) $       progDesc desc -    newSubCmd =-      mkCommandParser "new"-      (New <$> newArgOption)-      "Create a new project"--    buildSubCmd =-      mkCommandParser "build"-      (pure Build)-      "Build the current project"--    runSubCmd =-      mkCommandParser "run"-      (pure Run)-      "Run the current project"--    replSubCmd =-      mkCommandParser "repl"-      (pure Repl)-      "Access Indigo REPL"--    testSubCmd =-      mkCommandParser "test"-      (pure Test)-      "Run contract tests"--    newArgOption :: Opt.Parser Text-    newArgOption = Opt.strArgument (Opt.metavar "PROJECT NAME")--main :: IO ()-main = wrapMain $ do-  r <- isRunCommand-  case r of-    Just input -> do-      handleRunCommand input--    Nothing -> do-      cmdLnArgs <- execParser programInfo-      run cmdLnArgs--  where-    isRunCommand :: IO (Maybe [String])-    isRunCommand = do-      args <- SE.getArgs-      case args of-        "run":input -> pure $ Just input-        _ -> pure Nothing--    -- | Special case for handling @run@ command-    -- Since we want to pass the whole raw input to @ContractRegistry@-    -- it is easy to do it this way, because optparse seems to be not able to-    -- parse raw input.-    handleRunCommand :: [String] -> IO ()-    handleRunCommand input = do-      result <- Utf8.readFile "package.yaml"-      S.shelly . S.escaping False $ case getExecName (words result) of-        Just execName ->-          -- If we don't catch the exception here, 2 errors message will be print-          -- one by 'runStackWithArgs' and another by shelly itself.-          -- We still treat it as a fail command when the exception occurs by-          -- exit with error code 1.-          S.catch_sh @(S.ReThrownException SomeException)-            (runStackWithArgs (["run", execName, "--"] <> (toText <$> input)))-            (\_ -> S.quietExit 1)-        Nothing ->-          die "Could not find executable name in package.yaml"--    programInfo = info (helper <*> versionOption <*> argParser) $-      mconcat-      [ fullDesc-      , progDesc (toString indigoDesc)-      , header (toString indigoTitle)-      ]--    versionOption = infoOption ("indigo-" <> showVersion version)-      (long "version" <> help "Show version.")--    getExecName :: [Text] -> Maybe Text-    getExecName = \case-      "executables:":a:_ -> Just $ dropWhileEnd (==':') a-      _:xs -> getExecName xs-      _ -> Nothing+    projectName = Opt.strArgument (Opt.metavar "PROJECT_NAME") -    getLibName :: [Text] -> Maybe Text-    getLibName = \case-      "name:":a:_ -> Just a-      _ -> Nothing+    revisionArg = optional $ Opt.strOption $+         long "revision"+      <> Opt.metavar "REVISION"+      <> help "Git commit to pull from"+      <> Opt.internal -    run :: CmdLnArgs -> IO ()-    run = \case+    newArgs = (,) <$> projectName <*> revisionArg -      New projName ->+    newSubCmd =+      mkCommandParser "new"+      "Create a new project" $+      newArgs <&> \(projName, gitRev) -> do         case parsePackageName projName of           Right _ -> do             isNonUnique <- doesExistProjectName projName             if isNonUnique then               die "A project with this name already exists. Please choose another one."             else-              FileGen.run projName+              FileGen.run projName gitRev            Left err ->             die $ toString err -      Build -> do+    buildSubCmd =+      mkCommandParser "build"+      "Build the current project" $ pure $         S.shelly . S.escaping False $ runStackWithArgs ["build", "--fast"] -      -- | Placeholder command-      ---      -- @run@ will be handle by @handleRunCommand@-      -- This is defined only to show the description in @help@ command-      Run -> pure ()+    runSubCmd =+      command "run" $+      flip info (progDesc "Run the current project" <> Opt.noIntersperse <> Opt.forwardOptions) $+      many (Opt.strArgument $ Opt.metavar "ARGUMENTS") <&> \input -> do+        result <- Utf8.readFile "package.yaml"+        S.shelly . S.escaping False $ case getExecName (words result) of+          Just execName ->+            -- If we don't catch the exception here, 2 errors message will be print+            -- one by 'runStackWithArgs' and another by shelly itself.+            -- We still treat it as a fail command when the exception occurs by+            -- exit with error code 1.+            S.catch_sh @(S.ReThrownException SomeException)+              (runStackWithArgs (["run", execName, "--"] <> input))+              (\_ -> S.quietExit 1)+          Nothing ->+            die "Could not find executable name in package.yaml" -      Repl -> do+    replSubCmd =+      mkCommandParser "repl"+      "Access Indigo REPL" $ pure $ do         mbIndigoInDocker <- SE.lookupEnv "INDIGO_IN_DOCKER"         let dockerFlag = (maybe [] (const ["--allow-different-user"]) mbIndigoInDocker)         result <- Utf8.readFile "package.yaml"@@ -174,11 +105,41 @@          S.shelly $ S.liftIO $ callProcess "stack" $ dockerFlag <> ["repl", toString target] -      Test -> do+    testSubCmd =+      mkCommandParser "test"+      "Run contract tests" $ pure $         S.shelly . S.escaping False $ runStackWithArgs ["test", "--fast"] +    upgradeSubCmd =+      mkCommandParser "upgrade"+      "Upgrade indigo binary to the latest version" $+        Upgrade.run <$> revisionArg <*> Opt.switch (long "force" <> Opt.internal)+     runStackWithArgs :: [Text] -> S.Sh ()     runStackWithArgs args = do       mbIndigoInDocker <- liftIO $ SE.lookupEnv "INDIGO_IN_DOCKER"       let dockerFlag = (maybe [] (const ["--allow-different-user"]) mbIndigoInDocker)       S.shelly $ S.escaping False $ S.run_ "stack" $ dockerFlag <> args++    getExecName :: [Text] -> Maybe Text+    getExecName = \case+      "executables:":a:_ -> Just $ dropWhileEnd (==':') a+      _:xs -> getExecName xs+      _ -> Nothing++    getLibName :: [Text] -> Maybe Text+    getLibName = \case+      "name:":a:_ -> Just a+      _ -> Nothing++main :: IO ()+main = wrapMain $ do+  join $ execParser $ info (helper <*> versionOption <*> argParser) $+    mconcat+    [ fullDesc+    , progDesc (toString indigoDesc)+    , header (toString indigoTitle)+    ]+  where+    versionOption = infoOption ("indigo-" <> showVersion version)+      (long "version" <> help "Show version.")
+ app/Upgrade.hs view
@@ -0,0 +1,75 @@+-- SPDX-FileCopyrightText: 2022 Oxhead Alpha+-- SPDX-License-Identifier: LicenseRef-MIT-OA++-- | Upgrade command implementation+module Upgrade+  ( run+  ) where++import Data.Text qualified as T+import Data.Version+import Network.HTTP.Req+  (GET(GET), HttpException, MonadHttp, NoReqBody(..), Scheme(Https), Url, bsResponse,+  defaultHttpConfig, queryParam, req, responseBody, runReq, (/:))+import Shelly qualified as S+import System.Directory (createDirectoryIfMissing)+import System.FilePath ((</>))+import Text.ParserCombinators.ReadP (eof, readP_to_S)+import Universum.Lifted.File (writeFile)++import FileGen.Files (DependenceSnapshotVersion(..), indigoDependenceSnapshotYaml)+import Helper (repo)+import Paths_indigo (version)++run :: Maybe Text -> Bool -> IO ()+run mrevision bforce = do+  S.shelly $ S.escaping False $ S.withTmpDir $ \tempDir -> do+    let revision = fromMaybe "production" mrevision+    remoteVer <- runReq defaultHttpConfig $ do+      eresp <- try @_ @HttpException $ req GET+        (repo revision /: "package.yaml")+        NoReqBody+        bsResponse+        (queryParam @_ @Text "inline" (Just "false"))+      liftIO $ case eresp of+        Left err -> do+          putTextLn "Failed get new indigo version:"+          putStrLn $ displayException err+          exitFailure+        Right resp -> maybe (fail "Invalid package.yaml") (pure . fst) $+          responseBody resp+            & decodeUtf8+            & lines+            & find ("version:" `T.isPrefixOf`)+            >>= listToMaybe . drop 1 . words+            >>= listToMaybe . readP_to_S (parseVersion <* eof) . toString+    if remoteVer <= version && not bforce+    then putStrLn $ "Executable version " <> showVersion version <> " already up to date"+    else do+      runReq defaultHttpConfig $ getFile revision tempDir "indigo-snapshot.yaml"+      writeFile (tempDir </> "indigo-dependence-snapshot.yaml") $+        indigoDependenceSnapshotYaml $+          maybe (DSVPublishedVersion remoteVer) DSVGitCommitSha mrevision+      S.run_ "stack"+        ["install", "indigo", "--resolver"+        , toText $ tempDir </> "indigo-dependence-snapshot.yaml"]++getFile :: (MonadCatch m, MonadHttp m) => Text -> FilePath -> Text -> m ()+getFile revision configDir fn = do+  eresp <- try @_ @HttpException $ req GET+    (url revision fn)+    NoReqBody+    bsResponse+    (queryParam @_ @Text "inline" (Just "false"))+  case eresp of+    Left err -> do+      putStrLn $ "Failed to get " <> fn <> ":"+      putStrLn $ displayException err+    Right resp -> do+      let fp = configDir </> toString fn+          dep = decodeUtf8 $ responseBody resp+      liftIO $ createDirectoryIfMissing True configDir+      writeFile fp dep++url :: Text -> Text -> Url 'Https+url revision fn = repo revision /: "snapshots" /: fn
indigo.cabal view
@@ -1,11 +1,11 @@ cabal-version: 2.2 --- This file has been generated from package.yaml by hpack version 0.34.2.+-- This file has been generated from package.yaml by hpack version 0.34.4. -- -- see: https://github.com/sol/hpack  name:           indigo-version:        0.5.0+version:        0.6.0 synopsis:       Convenient imperative eDSL over Lorentz. description:    Syntax and implementation of Indigo eDSL. category:       Language@@ -13,14 +13,13 @@ bug-reports:    https://gitlab.com/morley-framework/indigo/-/issues author:         Serokell, Tocqueville Group maintainer:     Serokell <hi@serokell.io>-copyright:      2019-2020 Tocqueville Group+copyright:      2019-2021 Tocqueville Group, 2021-2022 Oxhead Alpha license:        MIT license-file:   LICENSE build-type:     Simple extra-source-files:     README.md     CHANGES.md-    snapshots/indigo-dependence-snapshot.yaml     snapshots/indigo-snapshot.yaml  source-repository head@@ -34,46 +33,95 @@       Indigo.Backend.Case       Indigo.Backend.Conditional       Indigo.Backend.Error+      Indigo.Backend.Expr.Compilation+      Indigo.Backend.Expr.Decompose       Indigo.Backend.Lambda+      Indigo.Backend.Lookup       Indigo.Backend.Prelude       Indigo.Backend.Scope       Indigo.Backend.Var+      Indigo.Common.Expr+      Indigo.Common.Expr.TH+      Indigo.Common.Field+      Indigo.Common.Object+      Indigo.Common.SIS+      Indigo.Common.State+      Indigo.Common.Var       Indigo.Compilation       Indigo.Compilation.Field       Indigo.Compilation.Hooks       Indigo.Compilation.Lambda       Indigo.Compilation.Params       Indigo.Compilation.Sequential+      Indigo.Compilation.Sequential.Types       Indigo.Frontend+      Indigo.Frontend.Expr+      Indigo.Frontend.Internal.Statement       Indigo.Frontend.Language       Indigo.Frontend.Program-      Indigo.Frontend.Statement-      Indigo.Internal-      Indigo.Internal.Expr-      Indigo.Internal.Expr.Compilation-      Indigo.Internal.Expr.Decompose-      Indigo.Internal.Expr.Symbolic-      Indigo.Internal.Expr.TH-      Indigo.Internal.Expr.Types-      Indigo.Internal.Field-      Indigo.Internal.Lookup-      Indigo.Internal.Object-      Indigo.Internal.SIS-      Indigo.Internal.State-      Indigo.Internal.Var       Indigo.Lib       Indigo.Lorentz       Indigo.Prelude       Indigo.Print-      Indigo.Rebinded+      Indigo.Rebound   other-modules:       Paths_indigo   autogen-modules:       Paths_indigo   hs-source-dirs:       src-  default-extensions: AllowAmbiguousTypes ApplicativeDo BangPatterns BlockArguments ConstraintKinds DataKinds DefaultSignatures DeriveAnyClass DeriveDataTypeable DeriveFoldable DeriveFunctor DeriveGeneric DeriveTraversable DerivingStrategies DerivingVia EmptyCase FlexibleContexts FlexibleInstances GADTs GeneralizedNewtypeDeriving LambdaCase MultiParamTypeClasses MultiWayIf NamedFieldPuns NegativeLiterals NumericUnderscores NumDecimals OverloadedLabels OverloadedStrings PatternSynonyms PolyKinds QuasiQuotes RankNTypes RecordWildCards RecursiveDo ScopedTypeVariables StandaloneDeriving StrictData TemplateHaskell TupleSections TypeApplications TypeFamilies TypeOperators UndecidableInstances UndecidableSuperClasses ViewPatterns NoApplicativeDo RebindableSyntax FunctionalDependencies-  ghc-options: -Weverything -Wno-missing-exported-signatures -Wno-missing-import-lists -Wno-missed-specialisations -Wno-all-missed-specialisations -Wno-unsafe -Wno-safe -Wno-missing-local-signatures -Wno-monomorphism-restriction -Wno-implicit-prelude -Wno-unused-do-bind -Wno-unticked-promoted-constructors+  default-extensions:+      AllowAmbiguousTypes+      ApplicativeDo+      BangPatterns+      BlockArguments+      ConstraintKinds+      DataKinds+      DefaultSignatures+      DeriveAnyClass+      DeriveDataTypeable+      DeriveFoldable+      DeriveFunctor+      DeriveGeneric+      DeriveTraversable+      DerivingStrategies+      DerivingVia+      EmptyCase+      FlexibleContexts+      FlexibleInstances+      GADTs+      GeneralizedNewtypeDeriving+      ImportQualifiedPost+      LambdaCase+      MultiParamTypeClasses+      MultiWayIf+      NamedFieldPuns+      NegativeLiterals+      NumDecimals+      NumericUnderscores+      OverloadedLabels+      OverloadedStrings+      PatternSynonyms+      PolyKinds+      QuasiQuotes+      RankNTypes+      RecordWildCards+      RecursiveDo+      ScopedTypeVariables+      StandaloneDeriving+      StrictData+      TemplateHaskell+      TupleSections+      TypeApplications+      TypeFamilies+      TypeOperators+      UndecidableInstances+      UndecidableSuperClasses+      ViewPatterns+      NoApplicativeDo+      RebindableSyntax+      FunctionalDependencies+  ghc-options: -Weverything -Wno-missing-exported-signatures -Wno-missing-import-lists -Wno-missed-specialisations -Wno-all-missed-specialisations -Wno-unsafe -Wno-safe -Wno-missing-local-signatures -Wno-monomorphism-restriction -Wno-implicit-prelude -Wno-prepositive-qualified-module -Wno-missing-safe-haskell-mode -Wno-unused-packages -Wno-unused-do-bind -Wno-unticked-promoted-constructors   build-depends:       base >=4.7 && <5     , casing@@ -98,27 +146,81 @@   other-modules:       FileGen       FileGen.Files+      FileGen.Tree       Helper+      Upgrade       Paths_indigo   autogen-modules:       Paths_indigo   hs-source-dirs:       app-  default-extensions: AllowAmbiguousTypes ApplicativeDo BangPatterns BlockArguments ConstraintKinds DataKinds DefaultSignatures DeriveAnyClass DeriveDataTypeable DeriveFoldable DeriveFunctor DeriveGeneric DeriveTraversable DerivingStrategies DerivingVia EmptyCase FlexibleContexts FlexibleInstances GADTs GeneralizedNewtypeDeriving LambdaCase MultiParamTypeClasses MultiWayIf NamedFieldPuns NegativeLiterals NumericUnderscores NumDecimals OverloadedLabels OverloadedStrings PatternSynonyms PolyKinds QuasiQuotes RankNTypes RecordWildCards RecursiveDo ScopedTypeVariables StandaloneDeriving StrictData TemplateHaskell TupleSections TypeApplications TypeFamilies TypeOperators UndecidableInstances UndecidableSuperClasses ViewPatterns-  ghc-options: -Weverything -Wno-missing-exported-signatures -Wno-missing-import-lists -Wno-missed-specialisations -Wno-all-missed-specialisations -Wno-unsafe -Wno-safe -Wno-missing-local-signatures -Wno-monomorphism-restriction -Wno-implicit-prelude+  default-extensions:+      AllowAmbiguousTypes+      ApplicativeDo+      BangPatterns+      BlockArguments+      ConstraintKinds+      DataKinds+      DefaultSignatures+      DeriveAnyClass+      DeriveDataTypeable+      DeriveFoldable+      DeriveFunctor+      DeriveGeneric+      DeriveTraversable+      DerivingStrategies+      DerivingVia+      EmptyCase+      FlexibleContexts+      FlexibleInstances+      GADTs+      GeneralizedNewtypeDeriving+      ImportQualifiedPost+      LambdaCase+      MultiParamTypeClasses+      MultiWayIf+      NamedFieldPuns+      NegativeLiterals+      NumDecimals+      NumericUnderscores+      OverloadedLabels+      OverloadedStrings+      PatternSynonyms+      PolyKinds+      QuasiQuotes+      RankNTypes+      RecordWildCards+      RecursiveDo+      ScopedTypeVariables+      StandaloneDeriving+      StrictData+      TemplateHaskell+      TupleSections+      TypeApplications+      TypeFamilies+      TypeOperators+      UndecidableInstances+      UndecidableSuperClasses+      ViewPatterns+  ghc-options: -Weverything -Wno-missing-exported-signatures -Wno-missing-import-lists -Wno-missed-specialisations -Wno-all-missed-specialisations -Wno-unsafe -Wno-safe -Wno-missing-local-signatures -Wno-monomorphism-restriction -Wno-implicit-prelude -Wno-prepositive-qualified-module -Wno-missing-safe-haskell-mode -Wno-unused-packages   build-depends:       base >=4.7 && <5+    , containers     , directory     , file-embed+    , filepath     , megaparsec >=7.0.0     , morley     , morley-prelude     , optparse-applicative     , process+    , req     , shelly     , string-interpolate-    , summoner     , text+    , time+    , tree-view+    , universum     , with-utf8   mixins:       base hiding (Prelude)@@ -144,8 +246,58 @@       Paths_indigo   hs-source-dirs:       test-  default-extensions: AllowAmbiguousTypes ApplicativeDo BangPatterns BlockArguments ConstraintKinds DataKinds DefaultSignatures DeriveAnyClass DeriveDataTypeable DeriveFoldable DeriveFunctor DeriveGeneric DeriveTraversable DerivingStrategies DerivingVia EmptyCase FlexibleContexts FlexibleInstances GADTs GeneralizedNewtypeDeriving LambdaCase MultiParamTypeClasses MultiWayIf NamedFieldPuns NegativeLiterals NumericUnderscores NumDecimals OverloadedLabels OverloadedStrings PatternSynonyms PolyKinds QuasiQuotes RankNTypes RecordWildCards RecursiveDo ScopedTypeVariables StandaloneDeriving StrictData TemplateHaskell TupleSections TypeApplications TypeFamilies TypeOperators UndecidableInstances UndecidableSuperClasses ViewPatterns NoApplicativeDo RebindableSyntax FunctionalDependencies-  ghc-options: -Weverything -Wno-missing-exported-signatures -Wno-missing-import-lists -Wno-missed-specialisations -Wno-all-missed-specialisations -Wno-unsafe -Wno-safe -Wno-missing-local-signatures -Wno-monomorphism-restriction -Wno-implicit-prelude -threaded -eventlog -rtsopts "-with-rtsopts=-N -A64m -AL256m"+  default-extensions:+      AllowAmbiguousTypes+      ApplicativeDo+      BangPatterns+      BlockArguments+      ConstraintKinds+      DataKinds+      DefaultSignatures+      DeriveAnyClass+      DeriveDataTypeable+      DeriveFoldable+      DeriveFunctor+      DeriveGeneric+      DeriveTraversable+      DerivingStrategies+      DerivingVia+      EmptyCase+      FlexibleContexts+      FlexibleInstances+      GADTs+      GeneralizedNewtypeDeriving+      ImportQualifiedPost+      LambdaCase+      MultiParamTypeClasses+      MultiWayIf+      NamedFieldPuns+      NegativeLiterals+      NumDecimals+      NumericUnderscores+      OverloadedLabels+      OverloadedStrings+      PatternSynonyms+      PolyKinds+      QuasiQuotes+      RankNTypes+      RecordWildCards+      RecursiveDo+      ScopedTypeVariables+      StandaloneDeriving+      StrictData+      TemplateHaskell+      TupleSections+      TypeApplications+      TypeFamilies+      TypeOperators+      UndecidableInstances+      UndecidableSuperClasses+      ViewPatterns+      NoApplicativeDo+      RebindableSyntax+      FunctionalDependencies+  ghc-options: -Weverything -Wno-missing-exported-signatures -Wno-missing-import-lists -Wno-missed-specialisations -Wno-all-missed-specialisations -Wno-unsafe -Wno-safe -Wno-missing-local-signatures -Wno-monomorphism-restriction -Wno-implicit-prelude -Wno-prepositive-qualified-module -Wno-missing-safe-haskell-mode -Wno-unused-packages -threaded -eventlog -rtsopts "-with-rtsopts=-N -A64m -AL256m"   build-tool-depends:       tasty-discover:tasty-discover   build-depends:@@ -153,6 +305,7 @@     , base >=4.7 && <5     , cleveland     , containers+    , data-default     , fmt     , hedgehog     , hspec-expectations
− snapshots/indigo-dependence-snapshot.yaml
@@ -1,11 +0,0 @@-# SPDX-FileCopyrightText: 2020 Tocqueville Group-# SPDX-License-Identifier: LicenseRef-MIT-TQ--name: indigo-dependence-snapshot--# See more extra-deps in 'indigo-snapshot.yaml'.-resolver: indigo-snapshot.yaml--# The 'packages' here act as 'extra-deps'.-packages:-  - indigo-0.5.0
snapshots/indigo-snapshot.yaml view
@@ -1,5 +1,5 @@-# SPDX-FileCopyrightText: 2020 Tocqueville Group-# SPDX-License-Identifier: LicenseRef-MIT-TQ+# SPDX-FileCopyrightText: 2021 Oxhead Alpha+# SPDX-License-Identifier: LicenseRef-MIT-OA  name: indigo-snapshot @@ -8,30 +8,58 @@ # contain the latest snapshots and packages. To update them, you need # to have 'nix' and 'niv' installed and run the commands # 'niv update hackage.nix' and 'niv update stackage.nix'-resolver: lts-16.5+resolver: lts-19.3  # You might have to update hackage index used by CI when you update # packages in this list, see the comment at the top of the file # The 'packages' here act as 'extra-deps'. packages:-  - morley-1.11.0-  - morley-prelude-0.3.0-  - lorentz-0.9.0-  - tasty-hunit-compat-0.2-  - git:-      https://gitlab.com/morley-framework/morley.git # CI can't use SSH-    commit:-      fd1f796e970ed370285b4ca184a5d63c04483d19 # morley-1.11.0-    subdirs:-      - code/cleveland-      - code/morley-client+- morley-prelude-0.5.2+- morley-1.19.1+- lorentz-0.15.1+- morley-client-0.3.1+- cleveland-0.3.1 -  - base58-bytestring-0.1.0-  - hex-text-0.1.0.0-  - show-type-0.1.1-  - git: https://github.com/int-index/caps.git-    commit: c5d61837eb358989b581ed82b1e79158c4823b1b-  - named-0.3.0.1@sha256:69b9722301201f8ed8abc89c4595e22c746e944bf4cdfafa8b21b14d336b26d1,2233-  - vinyl-0.12.1@sha256:43456d4b3009646eee63953cbe539f1f4d0caf8bc3c25e841117e712836508f3,3790-  - cryptonite-0.27-  - uncaught-exception-0.1.0+- git: https://github.com/serokell/base-noprelude.git+  commit: c8b06c4c8a271fce0c2f41ab18e88d58e64bac52 # 4.15.1.0+- OddWord-1.0.2.0+- bitvec-1.0.3.0@sha256:f69ed0e463045cb497a7cf1bc808a2e84ea0ce286cf9507983bb6ed8b4bd3993,3977+- colourista-0.1.0.1@sha256:98353ee0e2f5d97d2148513f084c1cd37dfda03e48aa9dd7a017c9d9c0ba710e,3307+- named-0.3.0.1@sha256:418543272f0c844a77639b05276ee3906d5f305cd4cab46fafcb4f15b7f1e60d,2312+- show-type-0.1.1+- hsblst-0.0.1++- co-log-0.5.0.0+# Required by co-log+- chronos-1.1.5+- co-log-core-0.3.2.0+- typerep-map-0.5.0.0+# Required by chronos+- bytebuild-0.3.11.0+- byteslice-0.2.7.0+- bytesmith-0.3.9.0+# Required by byte*+- run-st-0.1.1.0+- zigzag-0.0.1.0+- contiguous-0.6.2.0++# Packages by Adjoint (somewhat unmaintained, hence they require constraints on their deps)+- galois-field-1.0.2+- elliptic-curve-0.3.0+- pairing-1.1.0+# Required by galois-field.+- protolude-0.2.4+- poly-0.4.0.0+# Required by pairing.+- groups-0.4.1.0+# For keyed BLAKE2b and NaCl secret box+- crypto-sodium-0.0.5.0+# Dependencies of crypto-sodium+- NaCl-0.0.5.0+- libsodium-1.0.18.2++flags:+  # Disable 'terminfo' haskell package, because it cannot be linked statically+  # https://github.com/purescript/purescript/issues/3696+  haskeline:+    terminfo: false
src/Indigo.hs view
@@ -1,16 +1,21 @@--- SPDX-FileCopyrightText: 2020 Tocqueville Group------ SPDX-License-Identifier: LicenseRef-MIT-TQ+-- SPDX-FileCopyrightText: 2021 Oxhead Alpha+-- SPDX-License-Identifier: LicenseRef-MIT-OA  module Indigo   ( module Exports   ) where +import Indigo.Common.Expr as Exports+import Indigo.Common.Field as Exports+import Indigo.Common.Object as Exports+import Indigo.Common.SIS as Exports+import Indigo.Common.State as Exports hiding ((>>))+import Indigo.Common.Var as Exports import Indigo.Compilation as Exports import Indigo.Frontend as Exports-import Indigo.Internal as Exports hiding ((>>)) import Indigo.Lib as Exports-import Indigo.Lorentz as Exports hiding (forcedCoerce)+import Indigo.Lorentz as Exports hiding+  (comment, commentAroundFun, commentAroundStmt, forcedCoerce, justComment) import Indigo.Prelude as Exports import Indigo.Print as Exports-import Indigo.Rebinded as Exports+import Indigo.Rebound as Exports
src/Indigo/Backend.hs view
@@ -1,11 +1,16 @@--- SPDX-FileCopyrightText: 2020 Tocqueville Group------ SPDX-License-Identifier: LicenseRef-MIT-TQ+-- SPDX-FileCopyrightText: 2021 Oxhead Alpha+-- SPDX-License-Identifier: LicenseRef-MIT-OA  {-# OPTIONS_GHC -Wno-redundant-constraints #-} --- | Strictly typed statements of Indigo language.-+-- | Indigo compiler back-end helpers.+--+-- For reference, "back-end" refers to the part of the compiler pipeline+-- that comes after the intermediate representation. In our case, intermediate+-- representation is defined in "Indigo.Frontend.Internal.Statement".+--+-- Essentially these definitions simplify target code generation.+-- This is not intended to be exported from "Indigo". module Indigo.Backend   ( module ReExports @@ -31,6 +36,7 @@   , transferTokens   , setDelegate   , createContract+  , emit    -- * Functions, Procedures and Scopes   , scope@@ -42,22 +48,31 @@ import Indigo.Backend.Case as ReExports import Indigo.Backend.Conditional as ReExports import Indigo.Backend.Error as ReExports+import Indigo.Backend.Expr.Compilation as ReExports+import Indigo.Backend.Expr.Decompose as ReExports import Indigo.Backend.Lambda as ReExports+import Indigo.Backend.Lookup as ReExports import Indigo.Backend.Scope as ReExports import Indigo.Backend.Var as ReExports  import Fmt (build, fmt, pretty, (+|), (|+))  import Indigo.Backend.Prelude-import Indigo.Internal hiding ((<>))-import Indigo.Lorentz-import qualified Lorentz.Doc as L-import qualified Lorentz.Entrypoints.Doc as L (finalizeParamCallingDoc)+import Indigo.Common.Expr (Expr)+import Indigo.Common.SIS+  (SomeGenCode(SomeGenCode), SomeIndigoState(SomeIndigoState), overSIS, runSIS)+import Indigo.Common.State+import Indigo.Common.Var (HasSideEffects, Var, pushNoRef, pushRef)+import Indigo.Lorentz hiding (comment)+import Lorentz.Doc qualified as L+import Lorentz.Entrypoints.Doc qualified as L (finalizeParamCallingDoc) import Lorentz.Entrypoints.Helpers (RequireSumType)-import qualified Lorentz.Instr as L-import qualified Lorentz.Run as L-import qualified Michelson.Typed as MT-import Util.Type (type (++))+import Lorentz.Ext qualified as L+import Lorentz.Instr qualified as L+import Lorentz.Run qualified as L+import Morley.Michelson.Typed qualified as MT+import Morley.Michelson.Untyped.Annotation (FieldAnn)+import Morley.Util.Type (type (++))  ---------------------------------------------------------------------------- -- Loop@@ -181,6 +196,8 @@   :: forall p inp mname.      ( NiceParameterFull p      , KnownValue (GetEntrypointArgCustom p mname)+     , IsoValue (ContractRef (GetEntrypointArgCustom p mname))+     , IsNotInView      )   => EntrypointRef mname   -> Var (ContractRef (GetEntrypointArgCustom p mname))@@ -191,10 +208,12 @@   assignTopVar var  contractCalling-  :: forall cp inp epRef epArg addr.+  :: forall cp vd inp epRef epArg addr.      ( HasEntrypointArg cp epRef epArg-     , ToTAddress cp addr+     , ToTAddress cp vd addr      , ToT addr ~ ToT Address+     , MT.HasNoOp (ToT epArg)+     , MT.HasNoNestedBigMaps (ToT epArg)      , KnownValue epArg      )   => epRef@@ -203,7 +222,7 @@   -- ^ Variable that will be assigned to the resulting 'ContractRef'   -> IndigoState inp (Maybe (ContractRef epArg) : inp) contractCalling epRef addr var = stmtHookState (pretty var <> " := contractCalling " <> pretty addr) $ do-  unaryOp addr (L.contractCalling @cp epRef)+  unaryOp addr (L.contractCalling @cp @_ @_ @_ @vd epRef)   assignTopVar var  ----------------------------------------------------------------------------@@ -211,19 +230,21 @@ ----------------------------------------------------------------------------  transferTokens-  :: (NiceParameter p, HasSideEffects)+  :: (NiceParameter p, HasSideEffects, IsNotInView)   => Expr p -> Expr Mutez -> Expr (ContractRef p)   -> IndigoState inp inp transferTokens ep em ec = withStackVars $ \s ->   ternaryOpFlat ep em ec (L.transferTokens # varActionOperation s) -setDelegate :: HasSideEffects => Expr (Maybe KeyHash) -> IndigoState inp inp+setDelegate :: (HasSideEffects, IsNotInView) => Expr (Maybe KeyHash) -> IndigoState inp inp setDelegate e = withStackVars $ \s ->   unaryOpFlat e (L.setDelegate # varActionOperation s)  createContract-  :: (HasSideEffects, NiceStorage s, NiceParameterFull p)-  => L.Contract p s+  :: ( HasSideEffects, NiceStorage s, NiceParameterFull p+     , NiceViewsDescriptor vd, Typeable vd, IsNotInView+     )+  => L.Contract p s vd   -> Expr (Maybe KeyHash)   -> Expr Mutez   -> Expr s@@ -233,8 +254,14 @@ createContract lCtr ek em es var = stmtHookState   (fmt $ build var +| " := createContract (key_hash = " +| ek |+ ", mutez = " +| em |+ ", storage = " <> build es) $ do     withStackVars $ \s ->-      ternaryOp ek em es $ L.createContract lCtr # varActionOperation (pushNoRef s)+      ternaryOp ek em es $ L.createContract lCtr # varActionOperation (pushNoRef s) # checkedCoerce_     assignTopVar var++emit+  :: (HasSideEffects, NicePackedValue a, HasAnnotation a)+  => FieldAnn -> Expr a -> IndigoState inp inp+emit tag ex = withStackVars $ \s ->+  unaryOpFlat ex $ L.emit tag # varActionOperation s  ---------------------------------------------------------------------------- -- Functions, Procedures and Scopes
src/Indigo/Backend/Case.hs view
@@ -1,6 +1,5 @@--- SPDX-FileCopyrightText: 2020 Tocqueville Group------ SPDX-License-Identifier: LicenseRef-MIT-TQ+-- SPDX-FileCopyrightText: 2021 Oxhead Alpha+-- SPDX-License-Identifier: LicenseRef-MIT-OA  {-# OPTIONS_GHC -Wno-redundant-constraints #-} @@ -18,18 +17,22 @@  import Data.Vinyl.Core (RMap(..)) import Fmt (pretty)-import Util.Type (type (++))-import Util.TypeLits (AppendSymbol) +import Indigo.Backend.Expr.Compilation (compileExpr) import Indigo.Backend.Prelude import Indigo.Backend.Scope-import Indigo.Internal hiding ((<>))+import Indigo.Common.Expr (Expr)+import Indigo.Common.SIS (SomeGenCode(SomeGenCode), SomeIndigoState(SomeIndigoState))+import Indigo.Common.State+import Indigo.Common.Var (Var) import Indigo.Lorentz-import qualified Lorentz.ADT as L-import qualified Lorentz.Entrypoints.Doc as L-import qualified Lorentz.Instr as L-import Michelson.Typed.Haskell.Instr.Sum+import Lorentz.ADT qualified as L+import Lorentz.Entrypoints.Doc qualified as L+import Lorentz.Instr qualified as L+import Morley.Michelson.Typed.Haskell.Instr.Sum   (CaseClauseParam(..), CaseClauses, CtorField(..), InstrCaseC)+import Morley.Util.Type (type (++))+import Morley.Util.TypeLits (AppendSymbol)  -- | This type is analogous to the 'CaseClauseL' type but instead of wrapping a Lorentz -- instruction, this wraps an Indigo value with the same input/output types.
src/Indigo/Backend/Conditional.hs view
@@ -1,6 +1,5 @@--- SPDX-FileCopyrightText: 2020 Tocqueville Group------ SPDX-License-Identifier: LicenseRef-MIT-TQ+-- SPDX-FileCopyrightText: 2021 Oxhead Alpha+-- SPDX-License-Identifier: LicenseRef-MIT-OA  {-# OPTIONS_GHC -Wno-redundant-constraints #-} @@ -14,16 +13,20 @@   , IfConstraint   ) where -import qualified Data.Kind as Kind-import qualified GHC.TypeLits as Lit-import Util.Type (type (++))+import Data.Kind qualified as Kind+import GHC.TypeLits qualified as Lit+import Morley.Util.Type (type (++)) +import Indigo.Backend.Expr.Compilation (compileExpr) import Indigo.Backend.Prelude import Indigo.Backend.Scope-import Indigo.Internal hiding ((<>))+import Indigo.Common.Expr (Expr)+import Indigo.Common.SIS (SomeIndigoState, runSIS)+import Indigo.Common.State+import Indigo.Common.Var (Var) import Indigo.Lorentz-import qualified Lorentz.Instr as L-import qualified Lorentz.Macro as L+import Lorentz.Instr qualified as L+import Lorentz.Macro qualified as L  type family CompareBranchesResults (a :: Kind.Type) (b :: Kind.Type) :: Constraint where   CompareBranchesResults x x = ()
src/Indigo/Backend/Error.hs view
@@ -8,22 +8,24 @@  module Indigo.Backend.Error   ( failWith+  , never   , failUsing_   , failCustom   , failCustom_+  , failCustomNoArg   , failUnexpected_   ) where  import Fmt (Buildable, pretty) +import Indigo.Backend.Expr.Compilation import Indigo.Backend.Prelude-import Indigo.Internal.Expr.Compilation-import Indigo.Internal.Expr.Types-import Indigo.Internal.State-import Indigo.Internal.Var+import Indigo.Common.Expr+import Indigo.Common.State+import Indigo.Common.Var import Indigo.Lorentz-import qualified Lorentz.Errors as L-import qualified Lorentz.Instr as L+import Lorentz.Errors qualified as L+import Lorentz.Instr qualified as L  -- | Generic generator of failing 'IndigoState' from failing Lorentz instructions. failIndigoState :: inp :-> out -> IndigoState inp out@@ -32,33 +34,45 @@     gcStack = FailureStack     gcClear = L.unit # L.failWith -failWith :: KnownValue a => Expr a -> IndigoState s t+failWith :: NiceConstant a => Expr a -> IndigoState s t failWith exa = stmtHookState ("failWith (" <> pretty exa <> ")") $   exprHookState (pretty exa) (compileExpr exa) >>   failIndigoState L.failWith +never :: Expr Never -> IndigoState s t+never exa = stmtHookState ("never (" <> pretty exa <> ")") $+  exprHookState (pretty exa) (compileExpr exa) >>+  failIndigoState L.never+ failUsing_ :: (IsError x, Buildable x) => x -> IndigoState s t failUsing_ x = stmtHookState ("failUsing_ (" <> pretty x <> ")") $ failIndigoState (failUsing x)  failCustom   :: forall tag err s t.-     ( err ~ ErrorArg tag+     ( MustHaveErrorArg tag (MText, err)      , CustomErrorHasDoc tag      , NiceConstant err      )   => Label tag -> Expr err -> IndigoState s t-failCustom l errEx = stmtHookState ("failCustom (" <> pretty errEx <> ")") $-  withDict (niceConstantEvi @err) $ do-    exprHookState (pretty errEx) (compileExpr errEx)-    failIndigoState $ L.failCustom l+failCustom l errEx = stmtHookState ("failCustom (" <> pretty errEx <> ")") do+  exprHookState (pretty errEx) (compileExpr errEx)+  failIndigoState $ L.failCustom l  failCustom_-  :: forall tag s t notVoidErrorMsg.-     ( RequireNoArgError tag notVoidErrorMsg+  :: forall tag s t.+     ( MustHaveErrorArg tag (MText, ())      , CustomErrorHasDoc tag      )   => Label tag -> IndigoState s t failCustom_ = stmtHookState "failCustom_" . failIndigoState . L.failCustom_++failCustomNoArg+  :: forall tag s t.+     ( MustHaveErrorArg tag MText+     , CustomErrorHasDoc tag+     )+  => Label tag -> IndigoState s t+failCustomNoArg = stmtHookState "failCustomNoArg" . failIndigoState . L.failCustomNoArg  failUnexpected_ :: MText -> IndigoState s t failUnexpected_ msg =
+ src/Indigo/Backend/Expr/Compilation.hs view
@@ -0,0 +1,360 @@+-- SPDX-FileCopyrightText: 2021 Oxhead Alpha+-- SPDX-License-Identifier: LicenseRef-MIT-OA++-- | 'Expr' compilation++module Indigo.Backend.Expr.Compilation+  ( compileExpr++  , ObjManipulationRes (..)+  , runObjectManipulation+  , namedToExpr++  , nullaryOp+  , unaryOp+  , binaryOp+  , ternaryOp++  , nullaryOpFlat+  , unaryOpFlat+  , binaryOpFlat+  , ternaryOpFlat+  ) where++import Data.Vinyl.Core (RMap(..))++import Lorentz.ADT qualified as L+import Lorentz.Instr qualified as L+import Lorentz.Macro qualified as L+import Lorentz.StoreClass qualified as L+import Morley.Michelson.Typed.Haskell.Instr.Product (GetFieldType)++import Indigo.Backend.Lookup (varActionGet)+import Indigo.Backend.Prelude+import Indigo.Common.Expr+import Indigo.Common.Field+import Indigo.Common.Object+  (IndigoObjectF(..), NamedFieldObj(..), castFieldConstructors, namedToTypedRec, typedToNamedRec)+import Indigo.Common.State+  (DecomposedObjects, GenCode(..), IndigoState(..), MetaData(..), replStkMd, usingIndigoState,+  withObject, withObjectState)+import Indigo.Common.Var (Var(..), pushNoRef)+import Indigo.Lorentz++compileExpr :: forall a inp . Expr a -> IndigoState inp (a : inp)+compileExpr (C a) = IndigoState $ \md -> GenCode (pushNoRef $ mdStack md) (L.push a) L.drop+compileExpr (V v) = withObjectState v $ compileObjectF namedToExpr+compileExpr (Update m key val) = ternaryOp key val m L.update+compileExpr (Add e1 e2) = binaryOp e1 e2 L.add+compileExpr (Sub e1 e2) = binaryOp e1 e2 L.sub+compileExpr (Mul e1 e2) = binaryOp e1 e2 L.mul+compileExpr (Div (e1 :: Expr e1) (e2 :: Expr e2) (_ :: Proxy reminder)) =+  binaryOp e1 e2 (L.ediv @_ @_ @(Maybe (a, reminder)) # L.ifSome L.car (failUsing [mt|division by zero|]))+compileExpr (Mod (e1 :: Expr e1) (e2 :: Expr e2) (_ :: Proxy ratio)) =+  binaryOp e1 e2 (L.ediv @_ @_ @(Maybe (ratio, a)) # L.ifSome L.cdr (failUsing [mt|division by zero|]))+compileExpr (Abs e) = unaryOp e L.abs+compileExpr (Neg e) = unaryOp e L.neg++compileExpr (Lsl e1 e2) = binaryOp e1 e2 L.lsl+compileExpr (Lsr e1 e2) = binaryOp e1 e2 L.lsr++compileExpr (Eq' e1 e2) = binaryOp e1 e2 L.eq+compileExpr (Neq e1 e2) = binaryOp e1 e2 L.neq+compileExpr (Lt e1 e2) = binaryOp e1 e2 L.lt+compileExpr (Le e1 e2) = binaryOp e1 e2 L.le+compileExpr (Gt e1 e2) = binaryOp e1 e2 L.gt+compileExpr (Ge e1 e2) = binaryOp e1 e2 L.ge+compileExpr (IsNat e) = unaryOp e L.isNat+compileExpr (Int' e) = unaryOp e L.int+compileExpr (Coerce e) = unaryOp e checkedCoerce_+compileExpr (ForcedCoerce e) = unaryOp e forcedCoerce_+compileExpr (And e1 e2) = binaryOp e1 e2 L.and+compileExpr (Or e1 e2) = binaryOp e1 e2 L.or+compileExpr (Xor e1 e2) = binaryOp e1 e2 L.xor+compileExpr (Not e) = unaryOp e L.not++compileExpr (Fst e) = unaryOp e L.car+compileExpr (Snd e) = unaryOp e L.cdr+compileExpr (Pair e1 e2) = binaryOp e1 e2 L.pair++compileExpr (Some e) = unaryOp e L.some+compileExpr None = nullaryOp L.none+compileExpr (Right' e) = unaryOp e L.right+compileExpr (Left' e) = unaryOp e L.left+compileExpr (Pack e) = unaryOp e L.pack+compileExpr (Unpack e) = unaryOp e L.unpack+compileExpr (PackRaw e) = unaryOp e L.packRaw+compileExpr (UnpackRaw e) = unaryOp e L.unpackRaw+compileExpr Nil = nullaryOp L.nil+compileExpr (Cons e1 e2) = binaryOp e1 e2 L.cons+compileExpr (Contract (Proxy :: Proxy vd) e) = unaryOp e (L.contract @_ @vd)+compileExpr Self = nullaryOp L.self+compileExpr SelfAddress = nullaryOp L.selfAddress+compileExpr (ContractAddress ec) = unaryOp ec L.address+compileExpr (ContractCallingUnsafe epName addr) = unaryOp addr (L.unsafeContractCalling epName)+compileExpr (RunFutureContract con) = unaryOp con L.runFutureContract+compileExpr (ConvertEpAddressToContract epAddr) = unaryOp epAddr L.epAddressToContract+compileExpr (MakeView e1 e2) = binaryOp e1 e2 (L.pair # L.wrapView_)+compileExpr (MakeVoid e1 e2) = binaryOp e1 e2 (L.pair # L.wrapVoid)++compileExpr (Mem k c) = binaryOp k c L.mem+compileExpr (Size s) = unaryOp s L.size++compileExpr (StInsertNew l err k v store) =+  ternaryOp k v store $ L.stInsertNew (fieldNameFromLabel l) (failUsing err)+compileExpr (StInsert l k v store) =+  ternaryOp k v store $ L.stInsert (fieldNameFromLabel l)+compileExpr (StGet l ekey estore) =+  binaryOp ekey estore (L.stGet (fieldNameFromLabel l))+compileExpr (StMem l ekey estore) =+  binaryOp ekey estore (L.stMem (fieldNameFromLabel l))+compileExpr (StUpdate l ekey evalue estore) =+  ternaryOp ekey evalue estore (L.stUpdate (fieldNameFromLabel l))+compileExpr (StDelete l ekey estore) =+  binaryOp ekey estore (L.stDelete (fieldNameFromLabel l))++compileExpr (Wrap l exFld) = unaryOp exFld $ L.wrapOne l+compileExpr (Unwrap l exDt) = unaryOp exDt $ L.unsafeUnwrap_ l++compileExpr (ObjMan fldAcc) = compileObjectManipulation fldAcc+compileExpr (Construct _ fields) = IndigoState $ \md ->+  let cd = L.construct $ rmap (\e -> fieldCtor $ gcCode $ runIndigoState (compileExpr e) md) fields in+  GenCode (pushNoRef $ mdStack md) cd L.drop+compileExpr (ConstructWithoutNamed _ fields) = IndigoState $ \md ->+  let fieldCtrs =+          castFieldConstructors @a $+            rmap (fieldCtor . gcCode . usingIndigoState md . compileExpr) fields+  in GenCode (pushNoRef $ mdStack md) (L.construct @a fieldCtrs) L.drop+compileExpr (Name l e) = unaryOp e (toNamed l)+compileExpr (UnName l e) = unaryOp e (fromNamed l)++compileExpr (Slice ex1 ex2 ex3) = ternaryOp ex1 ex2 ex3 L.slice+compileExpr (Cast ex) = unaryOp ex L.cast+compileExpr (Concat ex1 ex2) = binaryOp ex1 ex2 L.concat+compileExpr (Concat' ex) = unaryOp ex L.concat'++compileExpr (ImplicitAccount kh) = unaryOp kh L.implicitAccount+compileExpr Now = nullaryOp L.now+compileExpr Sender = nullaryOp L.sender+compileExpr Amount = nullaryOp L.amount+compileExpr (CheckSignature pk sig bs) = ternaryOp pk sig bs L.checkSignature+compileExpr (Sha256 c) = unaryOp c L.sha256+compileExpr (Sha512 c) = unaryOp c L.sha512+compileExpr (Blake2b c) = unaryOp c L.blake2B+compileExpr (Sha3 c) = unaryOp c L.sha3+compileExpr (Keccak c) = unaryOp c L.keccak+compileExpr (HashKey hk) = unaryOp hk L.hashKey+compileExpr ChainId = nullaryOp L.chainId+compileExpr Balance = nullaryOp L.balance+compileExpr Level = nullaryOp L.level+compileExpr (VotingPower ex) = unaryOp ex L.votingPower+compileExpr TotalVotingPower = nullaryOp L.totalVotingPower++compileExpr EmptySet = nullaryOp L.emptySet++compileExpr (Get k m) = binaryOp k m L.get+compileExpr EmptyMap = nullaryOp L.emptyMap+compileExpr EmptyBigMap = nullaryOp L.emptyBigMap++compileExpr (Exec inp lambda) = binaryOp inp lambda L.exec+compileExpr (NonZero e) = unaryOp e L.nonZero++--------------------------------------------+-- Object manipulation: set, get fields+--------------------------------------------++-- | Compile 'ObjectManipulation' datatype to a cell on the stack.+-- This function leverages 'ObjManipulationRes' to put off actual field compilation.+compileObjectManipulation :: ObjectManipulation a -> IndigoState inp (a : inp)+compileObjectManipulation fa = IndigoState $ \md -> case runObjectManipulation (mdObjects md) fa of+  StillObject composite -> usingIndigoState md $ compileObjectF unNamedFieldExpr composite+  OnStack computation   -> usingIndigoState md computation++namedToExpr :: NamedFieldObj x name -> Expr (GetFieldType x name)+namedToExpr (NamedFieldObj flObj) = objToExpr namedToExpr flObj++-- | Convert arbitrary 'IndigoObjectF' into 'Expr'+-- with respect to given converter for fields.+objToExpr+  :: forall a f .+     (forall name . f name -> Expr (GetFieldType a name))+  -> IndigoObjectF f a+  -> Expr a+objToExpr _ (Cell refId) = V (Var @a refId)+objToExpr convExpr (Decomposed fields) =+  ConstructWithoutNamed (Proxy @a) (namedToTypedRec @a convExpr fields)++-- | Compile 'IndigoObjectF' to a stack cell,+-- with respect to given function that compiles inner fields.+compileObjectF+  :: forall a inp f .+     (forall name . f name -> Expr (GetFieldType a name))+  -> IndigoObjectF f a+  -> IndigoState inp (a : inp)+compileObjectF _ (Cell ref) = IndigoState $ \(mdStack -> s) ->+  GenCode (pushNoRef s) (varActionGet @a ref s) L.drop+compileObjectF conv obj = compileExpr $ objToExpr conv obj++-- | 'ObjManipulationRes' represents a postponed compilation of+-- 'ObjectManipulation' datatype. When 'ObjectManipulation' is being compiled+-- we are trying to put off the generation of code for work with an object+-- because we can just go to a deeper field without its "materialization"+-- onto stack.+data ObjManipulationRes inp a where+  StillObject :: ObjectExpr a -> ObjManipulationRes inp a+  OnStack :: IndigoState inp (a : inp) -> ObjManipulationRes inp a++-- | This function might look cumbersome+-- but basically it either goes deeper to an inner field or generates Lorentz code.+runObjectManipulation :: DecomposedObjects -> ObjectManipulation x -> ObjManipulationRes inp x+runObjectManipulation objs (Object e) = exprToManRes objs e++runObjectManipulation objs (ToField (v :: ObjectManipulation dt) (targetLb :: Label fname)) =+  case runObjectManipulation objs v of+    -- In case of decomposed fields, we just go deeper.+    StillObject (Decomposed fields) ->+      case fieldLens @dt @fname of+        -- If we access direct field, we just fetch it from fields+        TargetField lb _ -> exprToManRes objs $ unNamedFieldExpr (fetchField @dt lb fields)+        -- If we access deeper field, we fetch direct field and goes to the deeper field+        DeeperField lb _ ->+          let fe = unNamedFieldExpr $ fetchField @dt lb fields in+          runObjectManipulation objs (ToField (Object fe) targetLb)+    -- If stored object as cell on the stack, we get its field+    -- using 'sopToField', and since this moment 'ObjManipulationRes becomes+    -- a computation, not object anymore.+    StillObject (Cell refId) ->+      OnStack $ unaryOp (V $ Var refId) (sopToField @dt (flSFO fieldLens) (fieldNameFromLabel targetLb))+    -- If we already got into computation, we use 'sopToField' to fetch field.+    OnStack compLHS -> OnStack $ IndigoState $ \mdI ->+      let cd = gcCode $ usingIndigoState mdI compLHS in+      GenCode (pushNoRef $ mdStack mdI) (cd # sopToField (flSFO fieldLens) (fieldNameFromLabel targetLb)) L.drop++runObjectManipulation objs (SetField (ev :: ObjectManipulation dt) (targetLb :: Label fname) ef) =+  case runObjectManipulation objs ev of+    StillObject lhsObj@(Decomposed fields) ->+      case fieldLens @dt @fname of+        -- If we set direct field, we just reassign its value with new one.+        TargetField lb _ ->+          StillObject $ Decomposed $ assignField @dt lb (NamedFieldExpr ef) fields+        -- If we set deeper field, we need to call recursively+        -- from a direct field, and set a target field of direct field.+        -- Getting a new value of direct field, we set the direct field to this value.+        DeeperField (lb :: Label interm) _ ->+          let fe = unNamedFieldExpr (fetchField @dt lb fields) in+          -- Computing new value of direct field+          case runObjectManipulation objs (SetField (Object fe) targetLb ef) of+            -- If it's still an object, we just reassign direct field with it.+            StillObject updField -> StillObject $ Decomposed $+              assignField @dt lb (NamedFieldExpr $ objToExpr unNamedFieldExpr updField) fields+            -- Otherwise, we use power of 'L.setField' to set a new value.+            OnStack rhs ->+              setFieldOnStack (compileObjectF unNamedFieldExpr lhsObj) rhs (L.setField @dt @interm lb)+    -- If stored object is Cell on stack, we set its field+    -- using 'sopSetField', and since this moment 'ObjManipulationRes' becomes+    -- a computation, not object anymore.+    StillObject (Cell refId) ->+      OnStack $ binaryOp ef (V $ Var refId) $ sopSetField (flSFO fieldLens) (fieldNameFromLabel targetLb)+    -- If we already got into computation, we use 'sopSetField' to set a field.+    OnStack compLHS ->+      setFieldOnStack compLHS (compileExpr ef) (sopSetField (flSFO $ fieldLens @dt) (fieldNameFromLabel targetLb))+  where+    setFieldOnStack+      :: IndigoState inp (dt : inp)+      -> IndigoState (dt : inp) (fld : dt : inp)+      -> fld : dt : inp :-> dt : inp+      -> ObjManipulationRes inp dt+    setFieldOnStack lhs rhs setOp = OnStack $ IndigoState $ \mdI ->+      let GenCode st1 cdObj _cl1 = runIndigoState lhs mdI in+      let GenCode _st2 cdFld _cl2 = runIndigoState rhs (replStkMd mdI st1) in+      GenCode (pushNoRef $ mdStack mdI) (cdObj # cdFld # setOp) L.drop++-- | Convert an expression to 'ObjManipulationRes'.+-- The function pattern matches on some specific cases+-- of expression those compilation into a stack cell may be postponed.+-- They include 'Decomposed' variables and 'ConstructWithoutNamed' expressions.+--+-- This function can't be called for 'ObjMan' constructor, but we+-- take care of it just in case.+exprToManRes :: forall x inp . DecomposedObjects -> Expr x -> ObjManipulationRes inp x+exprToManRes objs (ObjMan objMan) = runObjectManipulation objs objMan+exprToManRes _ (ConstructWithoutNamed _ fields) =+  StillObject $ Decomposed $ typedToNamedRec @x NamedFieldExpr fields+exprToManRes objs (V var) = withObject objs var $ \case+  Cell refId ->+    StillObject $ Cell refId+  Decomposed fields ->+    StillObject $ Decomposed $ rmap (NamedFieldExpr . namedToExpr) fields+exprToManRes _ ex = OnStack $ compileExpr ex++---------------------------------------------------+-- Convenient helpers for operators compilation+---------------------------------------------------++ternaryOp+  :: KnownValue res+  => Expr n+  -> Expr m+  -> Expr l+  -> n : m : l : inp :-> res : inp+  -> IndigoState inp (res : inp)+ternaryOp e1 e2 e3 opCode = IndigoState $ \md ->+  let GenCode st3 cd3 _cl3  = runIndigoState (compileExpr e3) md in+  let GenCode st2 cd2 _cl2  = runIndigoState (compileExpr e2) (replStkMd md st3) in+  let GenCode _st1 cd1 _cl1 = runIndigoState (compileExpr e1) (replStkMd md st2) in+  GenCode (pushNoRef $ mdStack md) (cd3 # cd2 # cd1 # opCode) L.drop++binaryOp+  :: KnownValue res+  => Expr n -> Expr m+  -> n : m : inp :-> res : inp+  -> IndigoState inp (res : inp)+binaryOp e1 e2 opCode = IndigoState $ \md ->+  let GenCode st2 cd2 _cl2  = runIndigoState (compileExpr e2) md in+  let GenCode _st1 cd1 _cl1 = runIndigoState (compileExpr e1) (replStkMd md st2) in+  GenCode (pushNoRef $ mdStack md) (cd2 # cd1 # opCode) L.drop++unaryOp+  :: KnownValue res+  => Expr n+  -> n : inp :-> res : inp+  -> IndigoState inp (res : inp)+unaryOp e opCode = IndigoState $ \md ->+  let cd = gcCode $ runIndigoState (compileExpr e) md in+  GenCode (pushNoRef $ mdStack md) (cd # opCode) L.drop++nullaryOp :: KnownValue res => inp :-> res ': inp -> IndigoState inp (res ': inp)+nullaryOp lorentzInstr = IndigoState $ \md ->+  GenCode (pushNoRef $ mdStack md) lorentzInstr L.drop++ternaryOpFlat+  :: Expr n+  -> Expr m+  -> Expr l+  -> n : m : l : inp :-> inp+  -> IndigoState inp inp+ternaryOpFlat e1 e2 e3 opCode = IndigoState $ \md ->+  let GenCode st3 cd3 _cl3  = runIndigoState (compileExpr e3) md in+  let GenCode st2 cd2 _cl2  = runIndigoState (compileExpr e2) (replStkMd md st3) in+  let GenCode _st1 cd1 _cl1 = runIndigoState (compileExpr e1) (replStkMd md st2) in+  GenCode (mdStack md) (cd3 # cd2 # cd1 # opCode) L.nop++binaryOpFlat+  :: Expr n -> Expr m+  -> n : m : inp :-> inp+  -> IndigoState inp inp+binaryOpFlat e1 e2 opCode = IndigoState $ \md ->+  let GenCode st2 cd2 _cl2  = runIndigoState (compileExpr e2) md in+  let GenCode _st1 cd1 _cl1 = runIndigoState (compileExpr e1) (replStkMd md st2) in+  GenCode (mdStack md) (cd2 # cd1 # opCode) L.nop++unaryOpFlat+  :: Expr n+  -> n : inp :-> inp+  -> IndigoState inp inp+unaryOpFlat e opCode = IndigoState $ \md ->+  let cd = gcCode $ runIndigoState (compileExpr e) md in+  GenCode (mdStack md) (cd # opCode) L.nop++nullaryOpFlat :: inp :-> inp -> IndigoState inp inp+nullaryOpFlat lorentzInstr = IndigoState $ \md -> GenCode (mdStack md) lorentzInstr L.nop
+ src/Indigo/Backend/Expr/Decompose.hs view
@@ -0,0 +1,143 @@+-- SPDX-FileCopyrightText: 2021 Oxhead Alpha+-- SPDX-License-Identifier: LicenseRef-MIT-OA++-- | Decompose a complex value into its fields+-- to be used in 'setVar'.+-- Also functionality to generate code to deconstruct storage+-- into primitive fields the storage consists of+-- and to construct it back.+module Indigo.Backend.Expr.Decompose+  ( decomposeExpr+  , deepDecomposeCompose+  , ExprDecomposition (..)+  , IsObject+  ) where++import Prelude++import Data.Constraint (Dict(..))+import Data.Vinyl.TypeLevel hiding (type (++))++import Indigo.Backend.Expr.Compilation+import Indigo.Backend.Lookup+import Indigo.Common.Expr+import Indigo.Common.Object+import Indigo.Common.SIS+import Indigo.Common.State+import Indigo.Common.Var+import Indigo.Lorentz+import Lorentz.ADT qualified as L+import Lorentz.Instr qualified as L+import Morley.Michelson.Typed.Haskell.Instr.Product (GetFieldType)+import Morley.Util.Type++-----------------------------------------+-- Object decomposition+-----------------------------------------++-- | Alike 'SomeIndigoState' datatype but without objects argument+type SIS' stk a = RefId -> StackVars stk -> (a, RefId, SomeGenCode stk)++-- | For given element on stack, generate code which+-- decomposes it to list of its deep non-decomposable fields.+-- Clean up code of 'SomeIndigoState' composes the value back.+deepDecomposeCompose+  :: forall a inp . IsObject a+  => SIS' (a : inp) (Object a)+deepDecomposeCompose+  | Just Dict <- complexObjectDict @a = \refId st ->+      let decomposedSt = fst (noRefGenCode @(FieldTypes a) $ popNoRef st)+      in withInstrDeconstructC @a @inp $+        withStack refId decomposedSt (decomposeComposeFields @(FieldTypes a)) $+          \(result, newRefId, gc) ->+            ( Decomposed (typedToNamedRec @a typedToNamedFieldObj result)+            , newRefId+            , SomeGenCode $ GenCode+              { gcStack = gcStack gc+              , gcCode = L.deconstruct @a @(FieldTypes a) # gcCode gc+              , gcClear = gcClear gc # L.constructStack @a  @(FieldTypes a)+              }+            )+  | otherwise =+      \refId stk -> (Cell refId, refId + 1, SomeGenCode $+                      usingIndigoState (MetaData stk mempty emptyGenCodeHooks) (assignTopVar $ Var refId) )+  where+    decomposeComposeFields+      :: forall flds . (KnownList flds, AllConstrained IsObject flds)+      => SIS' (flds ++ inp) (Rec TypedFieldObj flds)+    decomposeComposeFields = case klist @flds of+      KNil -> \refId stk -> (RNil, refId, SomeGenCode $ GenCode stk L.nop L.nop)+      KCons (_ :: Proxy r) (_ :: Proxy rest) -> \refId st ->+        withStack refId (popNoRef st) (decomposeComposeFields @rest) $ \(resultRest, refId', restGc) ->+          withStack refId' (pushNoRef $ gcStack restGc) (deepDecomposeCompose @r) $ \(resultCur, newRefId, curGc) ->+            ( TypedFieldObj resultCur :& resultRest+            , newRefId+            , SomeGenCode $ GenCode+              { gcStack = gcStack curGc+              , gcCode = L.dip (gcCode restGc) # gcCode curGc+              , gcClear = gcClear curGc # L.dip (gcClear restGc)+              }+            )++withStack+  :: RefId+  -> StackVars inp+  -> SIS' inp a+  -> (forall out . (a, RefId, GenCode inp out) -> r)+  -> r+withStack refId stk sis f = case sis refId stk of+  (res, newRefId, SomeGenCode genCode) -> f (res, newRefId, genCode)++-----------------------------------------+-- Expr decomposition+-----------------------------------------++-- | Datatype representing decomposition of 'Expr'.+data ExprDecomposition inp a where+  ExprFields :: Rec Expr (FieldTypes a) -> ExprDecomposition inp a+  Deconstructed :: IndigoState inp (FieldTypes a ++ inp) -> ExprDecomposition inp a++-- | Decompose (shallowly) an expression to list of its direct fields.+decomposeExpr :: ComplexObjectC a => DecomposedObjects -> Expr a -> ExprDecomposition inp a+decomposeExpr _ (ConstructWithoutNamed _ fields) = ExprFields fields+decomposeExpr objs (V v) = withObject objs v $ decomposeObjectF namedToExpr+decomposeExpr objs (ObjMan objMan) = case runObjectManipulation objs objMan of+  StillObject obj -> decomposeObjectF unNamedFieldExpr obj+  OnStack comp -> deconstructOnStack comp+decomposeExpr _ ex = deconstructOnStack $ compileExpr ex++-- | Decompose any 'IndigoObjectF' with regards to decomposer for field.+decomposeObjectF+  :: forall a inp f . ComplexObjectC a+  => (forall name . f name -> Expr (GetFieldType a name))+  -> IndigoObjectF f a+  -> ExprDecomposition inp a+decomposeObjectF _ (Cell refId) =+  deconstructOnStack $+    IndigoState $ \md -> GenCode (pushNoRef $ mdStack md) (varActionGet @a refId $ mdStack md) L.drop+decomposeObjectF unF (Decomposed fields) =+  ExprFields $ namedToTypedRec @a unF fields++-- | Deconstruct top element of the stack and return it+-- wrapped into 'Deconstructed' constructor.+deconstructOnStack+  :: forall a inp . ComplexObjectC a+  => IndigoState inp (a : inp)+  -> ExprDecomposition inp a+deconstructOnStack fetchFld =+  Deconstructed $ IndigoState $ \md ->+    let (newSt, clean) = noRefGenCode @(FieldTypes a) (mdStack md) in+    withInstrDeconstructC @a @inp $+      GenCode newSt (gcCode (runIndigoState fetchFld md) # L.deconstruct @a @(FieldTypes a)) clean++-----------------------------------------+-- Helpers+-----------------------------------------++-- | Push the passed stack cells without references to them.+noRefGenCode+  :: forall rs inp . (KnownList rs, AllConstrained KnownValue rs)+  => StackVars inp -> (StackVars (rs ++ inp), (rs ++ inp) :-> inp)+noRefGenCode md = case klist @rs of+  KNil -> (md, L.nop)+  KCons Proxy (_ :: Proxy rest) -> bimap pushNoRef (L.drop #) (noRefGenCode @rest md)
src/Indigo/Backend/Lambda.hs view
@@ -1,7 +1,8 @@--- SPDX-FileCopyrightText: 2020 Tocqueville Group------ SPDX-License-Identifier: LicenseRef-MIT-TQ+-- SPDX-FileCopyrightText: 2021 Oxhead Alpha+-- SPDX-License-Identifier: LicenseRef-MIT-OA +{-# LANGUAGE NoMonomorphismRestriction #-}+ -- | This module implements the ability to put -- Indigo computations on the stack as a lambda and execute them. module Indigo.Backend.Lambda@@ -24,17 +25,24 @@   , Lambda1Generic   ) where -import Data.Constraint (Dict(..))+import Data.Constraint ((\\)) import Fmt (fmt, pretty, (+|), (|+)) +import Indigo.Backend.Expr.Compilation (compileExpr)+import Indigo.Backend.Lookup (varActionGet, varActionSet) import Indigo.Backend.Prelude import Indigo.Backend.Scope import Indigo.Backend.Var-import Indigo.Internal hiding ((+), (<>))+import Indigo.Common.Expr (Expr(V))+import Indigo.Common.Object (IsObject)+import Indigo.Common.SIS (SomeIndigoState, runSIS)+import Indigo.Common.State+import Indigo.Common.Var import Indigo.Lorentz-import qualified Lorentz.Instr as L+import Lorentz.Instr qualified as L import Lorentz.Zip (ZipInstr, ZippedStack)-import Util.Type (type (++), KnownList, listOfTypesConcatAssociativityAxiom)+import Morley.Michelson.Typed.Instr.Internal.Proofs (assocThm)+import Morley.Util.Type (KnownList, type (++))  ---------------------------------------------------------------------------- -- External interface@@ -87,10 +95,10 @@ initLambdaStackVars (StorageLambda _) = initStackVars initLambdaStackVars (EffLambda _) = initStackVarsEff -type Lambda1Generic extra arg res = (arg : extra) :-> (RetOutStack res ++ extra)+type Lambda1Generic extra arg res = WrappedLambda (arg : extra) (RetOutStack res ++ extra)  type CreateLambda1CGeneric extra arg res =-  ( ScopeCodeGen res, KnownValue arg, Typeable extra+  ( ScopeCodeGen res, KnownValue arg, Typeable extra, KnownList extra   , ZipInstr (arg : extra)   , KnownValue (ZippedStack (arg ': extra))   , KnownValue (ZippedStack (RetOutStack res ++ extra))@@ -211,7 +219,8 @@     -- we have to materialise only fields used in the lambda     IndigoState $ \md@MetaData{..} ->       let storage = storageVar @st-          ops@(Var opsRefId) = operationsVar+          ops = operationsVar+          opsRefId = case ops of Var x -> x           gcStack = pushRef storage $ pushRef ops mdStack           fetchCode =             auxiliaryHook md "Fetching operations" (varActionGet opsRefId mdStack) #@@ -241,12 +250,13 @@  type ExecuteLambda1CGeneric extra arg res =   ( ScopeCodeGen res, KnownValue arg-  , KnownValue ((arg : extra) :-> (RetOutStack res ++ extra))+  , KnownValue (WrappedLambda (arg : extra) (RetOutStack res ++ extra))   , KnownList extra   , ZipInstr (arg : extra)   , KnownList (RetOutStack res ++ extra)   , ZipInstr (RetOutStack res ++ extra)   , Typeable (RetOutStack res ++ extra)+  , Typeable extra   , KnownValue (ZippedStack (RetOutStack res ++ extra))   ) @@ -265,16 +275,15 @@   -> Expr arg   -> IndigoState inp (RetOutStack res ++ inp) executeLambda1Generic vars allocateCleanup varF argm = IndigoState $ \md@MetaData{..} ->-  let GenCode allocStk allocate cleanup = usingIndigoState md allocateCleanup in-  let getArgs =+  let GenCode allocStk allocate cleanup = usingIndigoState md allocateCleanup+      getArgs =         auxiliaryHook md "Computing implicit lambda arguments" allocate #         (gcCode $           usingIndigoState (replStkMd md allocStk) $ do               exprHookState ("Computing lambda parameter: " <> pretty argm) (compileExpr argm)-              exprHookState "Fetching lambda" (compileExpr (V varF))) in-  case listOfTypesConcatAssociativityAxiom @(RetOutStack res) @extra @inp of-    Dict ->-      let code = getArgs #-                 L.execute @_ @_ @inp #-                 liftClear @res cleanup-      in finalizeStatement @res mdStack vars code+              exprHookState "Fetching lambda" (compileExpr (V varF)))+      code = getArgs #+              L.execute @_ @_ @inp #+              liftClear @res cleanup+              \\ assocThm @(RetOutStack res) @extra @inp+  in finalizeStatement @res mdStack vars code
+ src/Indigo/Backend/Lookup.hs view
@@ -0,0 +1,359 @@+-- SPDX-FileCopyrightText: 2021 Oxhead Alpha+-- SPDX-License-Identifier: LicenseRef-MIT-OA++{- |+This module contains the logic to lookup 'Var's in a stack and the actions to+manipulate it.++For efficiency, actions are implemented using Lorentz macros.+To do so every necessary constraint is checked at runtime.+-}++module Indigo.Backend.Lookup+  ( -- * Variable Lookup Actions+    varActionGet+  , varActionSet+  , varActionUpdate+  , varActionOperation++  -- * Vinyl manipulation helpers+  , rtake+  , rdrop+  ) where++import Data.Constraint (Dict(..), HasDict)+import Data.Singletons (Sing, SingI, withSingI)+import Data.Type.Equality (TestEquality(..))+import Data.Typeable (eqT, typeRep, (:~:)(..))+import Data.Vinyl ((<+>))+import Data.Vinyl.TypeLevel (type (++))+import Fmt (pretty)+import Prelude hiding (tail)++import Indigo.Common.Var+  (HasSideEffects, Ops, RefId, StackVars(..), StackVars', StkEl(..), Var(..), operationsVar)+import Indigo.Lorentz+import Lorentz.Instr qualified as L+import Lorentz.Macro qualified as L+import Morley.Michelson.Typed (ToTs)+import Morley.Michelson.Typed.Instr.Constraints qualified as MI+import Morley.Michelson.Typed.T qualified as MI+import Morley.Util.Peano+import Morley.Util.Sing++----------------------------------------------------------------------------+-- Variable Lookup Actions+----------------------------------------------------------------------------++-- | Puts a copy of the value for the given 'Var' on top of the stack+varActionGet :: forall a stk . KnownValue a => RefId -> StackVars stk -> stk :-> a : stk+varActionGet _ FailureStack = error "You try to get a cell on failure stack"+varActionGet ref (StkElements stk) = case varDepth @a ref stk of+  VarDepth n -> duupXVar n ref stk++-- | Sets the value for the given 'Var' to the topmost value on the stack+varActionSet :: forall a stk . KnownValue a => RefId -> StackVars stk -> a : stk :-> stk+varActionSet _ FailureStack = error "You try to set a cell on failure stack"+varActionSet ref (StkElements stk) = case varDepth @a ref stk of+  VarDepth n -> replaceNVar (SS n) ref (NoRef :& stk)++-- | Updates the value for the given 'Var' with the topmost value on the stack+-- using the given binary instruction.+varActionUpdate+  :: forall a b stk . (KnownValue a, KnownValue b)+  => RefId+  -> StackVars stk+  -> '[b, a] :-> '[a]+  -> (b ': stk) :-> stk+varActionUpdate _ FailureStack _ = error "You try to update a cell on failure stack"+varActionUpdate v (StkElements stk) instr = case varDepth @a v stk of+  VarDepth n -> updateNVar (SS n) v (NoRef :& stk) instr++-- | Given a stack with a list of 'Operation's on its bottom, updates it by+-- appending the 'Operation' on the top.+varActionOperation+  :: HasSideEffects+  => StackVars stk+  -> (Operation ': stk) :-> stk+varActionOperation s =+  case operationsVar of+    Var refId -> varActionUpdate @Ops refId s L.cons++----------------------------------------------------------------------------+-- Variable-based Macros+----------------------------------------------------------------------------++-- | Like 'varActionGet', but requires the depth of the 'Var' in the input stack+duupXVar+  :: forall inp a (m :: Peano).+     ( HasCallStack+     , KnownValue a+     )+  => Sing m -> RefId -> StackVars' inp -> inp :-> (a ': inp)+duupXVar m v stk =+  withVarMaybeDict (dupNLorentzConstraint n stk a out) $+  withDict (dupableConstraint a) $+    L.dupNPeano @('S m) @a @inp @(a ': inp)+  where+    a = Ref @a v+    n = SS m+    out = a :& stk++-- | Like 'varActionSet', but requires the depth of the 'Var' in the input stack+replaceNVar+  :: forall s a (n :: Peano) mid tail.+     ( HasCallStack+     , KnownValue a+     , mid ~ (Take n (a ': s) ++ Drop n s)+     , tail ~ Drop n s+     )+  => Sing n -> RefId -> StackVars' (a ': s) -> (a ': s) :-> s+replaceNVar n v stk@(_ :& s) =+  withVarMaybeDict (replaceNClassConstraint n s (Ref @a v) mid tail) $+    L.replaceNImpl @n @s @a @mid @tail+  where+    mid = rtake n stk <+> rdrop n s+    tail = rdrop n s++-- | Like 'varActionUpdate', but requires the depth of the 'Var' in the input stack+updateNVar+  :: forall s a b mid tail (n :: Peano).+     ( HasCallStack+     , KnownValue b+     , tail ~ Drop n s+     , mid ~ ((Drop ('S 'Z) (Take n (a ': s))) ++ (a ': Drop n (a ': s)))+     )+  => Sing n -> RefId -> StackVars' (a ': s)+  -> '[a, b] :-> '[b]+  -> (a ': s) :-> s+updateNVar n v stk@(a :& s) instr =+  withVarMaybeDict (updateNClassConstraint n s a (Ref @b v) mid tail) $+    L.updateNImpl @n @s @a @b @mid @tail instr+  where+    mid = rdrop (SS SZ) (rtake n stk) <+> a :& rdrop n stk+    tail = rdrop n s++withVarMaybeDict :: (HasDict c e, HasCallStack) => Maybe e -> (c => r) -> r+withVarMaybeDict mDict = withDict (fromMaybe (error constraintFailure) mDict)+  where+    -- NOTE: provided that the 'VarDepth' is correctly calculated every place+    -- where this is used should never result in a 'Nothing', as this is only+    -- necessary to prove to GHC properties that always hold.+    -- For this reason a failure here is always unexpected+    constraintFailure = "Unexpected failure in Var's constraint checking"++----------------------------------------------------------------------------+-- Variable's Depth+----------------------------------------------------------------------------++-- | Keeps the 0-indexed depth of a variable as a 'Peano' 'Sing'leton+data VarDepth where+  VarDepth :: Sing (idx :: Peano) -> VarDepth++-- | Calculates the 'VarDepth' of the given 'Var' in the stack+varDepth+  :: forall a s. KnownValue a+  => RefId+  -> StackVars' s+  -> VarDepth+varDepth refId = \case+  RNil -> error $+    "You are looking for manually created or leaked variable. " <>+    pretty refId <> " of type " <> show (typeRep (Proxy @a))+  stk@(_ :& _) -> varDepthNonEmpty @a refId stk++varDepthNonEmpty+  :: forall a s x xs. (KnownValue a, s ~ (x : xs))+  => RefId -> StackVars' s -> VarDepth+varDepthNonEmpty ref (x :& xs) = case x of+  Ref topRef | ref == topRef -> case eqT @a @x of+    Just Refl -> VarDepth SZ+    Nothing   -> error $+      "Invalid variable type. " <> pretty ref <>+      ".\nWas looking for a " <> show (typeRep $ Proxy @a) <>+      ", but found a: " <> show (typeRep $ Proxy @x)+  _ -> case varDepth @a ref xs of+    VarDepth idx -> VarDepth (SS idx)++----------------------------------------------------------------------------+-- Macro class constraints+----------------------------------------------------------------------------++replaceNClassConstraint+  :: Sing n -> StackVars' s -> StkEl a -> StackVars' mid -> StackVars' tail+  -> Maybe (Dict (L.ReplaceN n s a mid tail))+replaceNClassConstraint n s a mid tail = case n of+  SZ -> Nothing+  SS SZ -> case s of+    (x :& _xs) -> do+      Refl <- testEquality x a+      return Dict+    _ -> Nothing+  SS (SS m) -> do+    Dict <- replaceNLorentzConstraint (SS m) s a mid tail+    return $ withSingI m $ Dict++updateNClassConstraint+  :: Sing n -> StackVars' s -> StkEl a -> StkEl b -> StackVars' mid -> StackVars' tail+  -> Maybe (Dict (L.UpdateN n s a b mid tail))+updateNClassConstraint n s a b mid tail = case n of+  SZ -> Nothing+  SS SZ -> case s of+    (x :& xs) -> do+      Refl <- testEquality x b+      Refl <- testEquality xs tail+      return Dict+    _ -> Nothing+  SS (SS SZ) -> case s of+    (_x :& y :& xs) -> do+      Refl <- testEquality y b+      Refl <- testEquality xs tail+      return Dict+    _ -> Nothing+  SS (SS (SS m)) -> do+    Dict <- updateNLorentzConstraint (SS (SS m)) s a b mid tail+    return $ withSingI m $ Dict++----------------------------------------------------------------------------+-- Lorentz constraints+----------------------------------------------------------------------------++dupableConstraint+  :: (KnownValue a, HasCallStack)+  => StkEl a+  -> Dict (Dupable a)+dupableConstraint (_ :: StkEl a) =+  case decideOnDupable @a of+    IsDupable -> Dict+    IsNotDupable ->+      error "Non-dupable values (like tickets) are not supported yet"++dupNLorentzConstraint+  :: Sing n -> StackVars' inp -> StkEl a -> StackVars' out+  -> Maybe (Dict (L.ConstraintDUPNLorentz n inp out a))+dupNLorentzConstraint n inp a out = do+  Dict <- dupNConstraint n inp out a+  Dict <- dupNConstraint n (toTVals inp) (toTVals out) (toTVal a)+  return $ withSingI n $ Dict++updateNLorentzConstraint+  :: Sing n -> StackVars' s -> StkEl a -> StkEl b -> StackVars' mid -> StackVars' tail+  -> Maybe (Dict (L.ConstraintUpdateNLorentz n s a b mid tail))+updateNLorentzConstraint n s a b mid tail = do+  Refl <- testEquality tail (rdrop (SS n) s)+  Refl <- testEquality (toTVals tail) (rdrop (SS n) (toTVals s))+  Dict <- dugLorentzConstraint n (a :& s) mid a+  Dict <- dipNLorentzConstraint n mid s (a :& b :& tail) (b :& tail)+  return Dict++replaceNLorentzConstraint+  :: Sing n -> StackVars' s -> StkEl a -> StackVars' mid -> StackVars' tail+  -> Maybe (Dict (L.ConstraintReplaceNLorentz n s a mid tail))+replaceNLorentzConstraint n s a mid tail = do+  Refl <- testEquality tail (rdrop (SS n) s)+  Refl <- testEquality (toTVals tail) (rdrop (SS n) (toTVals s))+  Dict <- dipNLorentzConstraint (SS n) (a :& s) mid (a :& tail) tail+  Dict <- dugLorentzConstraint n mid s a+  return $ Dict++dugLorentzConstraint+  :: Sing n -> StackVars' inp -> StackVars' out -> StkEl a+  -> Maybe (Dict (L.ConstraintDUGLorentz n inp out a))+dugLorentzConstraint n inp out a = do+  Dict <- dugConstraint n inp out a+  Dict <- dugConstraint n (toTVals inp) (toTVals out) (toTVal a)+  return $ withSingI n $ Dict++dipNLorentzConstraint+  :: Sing n -> StackVars' inp -> StackVars' out -> StackVars' s -> StackVars' s'+  -> Maybe (Dict (L.ConstraintDIPNLorentz n inp out s s'))+dipNLorentzConstraint n inp out s s' = do+  Dict <- dipNConstraint n inp out s s'+  Dict <- dipNConstraint n (toTVals inp) (toTVals out) (toTVals s) (toTVals s')+  return $ withSingI n $ Dict++----------------------------------------------------------------------------+-- Morley constraints+----------------------------------------------------------------------------++dupNConstraint+  :: TestEquality any+  => Sing n -> Rec any inp -> Rec any out -> any a+  -> Maybe (Dict (MI.ConstraintDUPN' kind n inp out a))+dupNConstraint n inp out a = do+  Dict <- requireLongerOrSameLength inp n+  Dict <- isGreaterThan n SZ+  decN <- peanoSingDecrement n+  Refl <- testEquality inp ((lazyRtake decN inp) <+> a :& rdrop n inp)+  Refl <- testEquality out (a :& inp)+  return Dict++dugConstraint+  :: TestEquality any+  => Sing n -> Rec any inp -> Rec any out -> any a+  -> Maybe (Dict (MI.ConstraintDUG' kind n inp out a))+dugConstraint n inp out a = do+  Dict <- requireLongerThan out n+  Refl <- testEquality (a :& rdrop (SS SZ) inp) inp+  Refl <- testEquality (lazyRtake n out <+> rdrop (SS n) out) (rdrop (SS SZ) inp)+  Refl <- testEquality (lazyRtake n (rdrop (SS SZ) inp) <+> a :& rdrop n (rdrop (SS SZ) inp)) out+  return Dict++dipNConstraint+  :: TestEquality any+  => Sing n -> Rec any inp -> Rec any out -> Rec any s -> Rec any s'+  -> Maybe (Dict (MI.ConstraintDIPN' kind n inp out s s'))+dipNConstraint n inp out s s' = do+  Dict <- requireLongerOrSameLength inp n+  Refl <- testEquality (lazyRtake n inp <+> s) inp+  Refl <- testEquality (lazyRtake n inp <+> s') out+  Refl <- testEquality (rdrop n inp) s+  Refl <- testEquality (rdrop n out) s'+  return Dict++----------------------------------------------------------------------------+-- Conversion for ToT constraints+----------------------------------------------------------------------------++-- | Stack representation of 'MI.T' used for constraint checking+type TValStack (stk :: [MI.T]) = Rec TVal stk++-- | Simple datatype used to keep a 'MI.T' and its 'SingI' constraint+data TVal (a :: MI.T) where+  TVal :: SingI a => TVal a++instance TestEquality TVal where+  testEquality (TVal :: TVal a) (TVal :: TVal b) = eqI @a @b++toTVal :: forall a. StkEl a -> TVal (ToT a)+toTVal = \case+  NoRef -> TVal @(ToT a)+  Ref _ -> TVal @(ToT a)++toTVals :: StackVars' stk -> TValStack (ToTs stk)+toTVals = \case+  RNil          -> RNil+  (NoRef :& xs) -> TVal :& toTVals xs+  (Ref _ :& xs) -> TVal :& toTVals xs++----------------------------------------------------------------------------+-- Vinyl manipulation helpers+----------------------------------------------------------------------------++rtake :: Sing n -> Rec any s -> Rec any (Take n s)+rtake sn stk = case (sn, stk) of+  (SZ, _)           -> RNil+  (SS n, (x :& xs)) -> x :& rtake n xs+  (SS _, RNil)      -> error "given stack is too small"++lazyRtake :: Sing n -> Rec any s -> Rec any (LazyTake n s)+lazyRtake sn stk = case (sn, stk) of+  (SZ, _)           -> RNil+  (SS n, (x :& xs)) -> x :& lazyRtake n xs+  (SS _, RNil)      -> error "given stack is too small"++rdrop :: Sing n -> Rec any s -> Rec any (Drop n s)+rdrop sn stk = case (sn, stk) of+  (SZ, _)           -> stk+  (SS n, (_ :& xs)) -> rdrop n xs+  (SS _, RNil)      -> error "given stack is too small"
src/Indigo/Backend/Scope.hs view
@@ -1,6 +1,5 @@--- SPDX-FileCopyrightText: 2020 Tocqueville Group------ SPDX-License-Identifier: LicenseRef-MIT-TQ+-- SPDX-FileCopyrightText: 2021 Oxhead Alpha+-- SPDX-License-Identifier: LicenseRef-MIT-OA  {-# OPTIONS_GHC -Wno-redundant-constraints #-} @@ -45,17 +44,18 @@   , prettyRet   ) where -import qualified Data.Kind as Kind+import Data.Kind qualified as Kind import Fmt (Buildable(..), pretty)-import qualified GHC.TypeLits as Lit-import Util.Type (type (++))+import GHC.TypeLits qualified as Lit +import Indigo.Backend.Expr.Compilation (compileExpr) import Indigo.Backend.Prelude-import Indigo.Internal.Expr hiding ((<>))-import Indigo.Internal.State-import Indigo.Internal.Var+import Indigo.Common.Expr (Expr, ExprType, ToExpr, toExpr)+import Indigo.Common.State+import Indigo.Common.Var import Indigo.Lorentz-import qualified Lorentz.Instr as L+import Lorentz.Instr qualified as L+import Morley.Util.Type (type (++))  -- | To avoid overlapping instances we need to somehow distinguish single values -- from tuples, because the instances:@@ -269,8 +269,7 @@          , Buildable (RetVars' 'Tuple (x, y))          ) => ScopeCodeGen' 'Tuple (x, y) where   compileScopeReturn' (e1, e2) = compileToExpr e2 >> compileToExpr e1-  -- TODO is L.dip . L.dip cheaper than L.dipN ?-  liftClear' = L.dip . L.dip+  liftClear' = L.dipN @2   genGcClear' = L.drop # L.drop  instance ( KnownValueExpr x
src/Indigo/Backend/Var.hs view
@@ -1,6 +1,5 @@--- SPDX-FileCopyrightText: 2020 Tocqueville Group------ SPDX-License-Identifier: LicenseRef-MIT-TQ+-- SPDX-FileCopyrightText: 2021 Oxhead Alpha+-- SPDX-License-Identifier: LicenseRef-MIT-OA  -- | Backend statements for variable manipulation: assignment, replacement, update. @@ -13,13 +12,20 @@  import Fmt (pretty) +import Indigo.Backend.Expr.Compilation (binaryOpFlat, compileExpr, unaryOpFlat)+import Indigo.Backend.Expr.Decompose (ExprDecomposition(Deconstructed, ExprFields), decomposeExpr)+import Indigo.Backend.Lookup (varActionSet, varActionUpdate) import Indigo.Backend.Prelude import Indigo.Backend.Scope-import Indigo.Internal hiding ((+), (<>))+import Indigo.Common.Expr (Expr(V))+import Indigo.Common.Field (FieldLens(DeeperField, TargetField), HasField(..), fetchField, flSFO)+import Indigo.Common.Object+import Indigo.Common.State+import Indigo.Common.Var (RefId, Var(..)) import Indigo.Lorentz-import qualified Lorentz.Instr as L-import Michelson.Typed.Haskell.Instr.Product (GetFieldType)-import Util.Type (type (++))+import Lorentz.Instr qualified as L+import Morley.Michelson.Typed.Haskell.Instr.Product (GetFieldType)+import Morley.Util.Type (type (++))  -- | Assign the given variable to the value resulting from the given expression. assignVar :: forall x inp . KnownValue x => Var x -> Expr x -> IndigoState inp (x : inp)@@ -91,7 +97,9 @@     withObjectState v setFieldImpl   where     setFieldImpl :: forall x . (IsObject x, HasField x fname ftype) => Object x -> IndigoState inp inp-    setFieldImpl (Cell refId) = updateVar @x nextRef (sopSetField (flSFO fieldLens) targetLb) (Var refId) e+    setFieldImpl (Cell refId) =+      updateVar @x nextRef (sopSetField (flSFO fieldLens)+        (fieldNameFromLabel targetLb)) (Var refId) e     setFieldImpl (Decomposed fields) = case fieldLens @x @fname @ftype of       TargetField lb _ ->         case fetchField @x lb fields of
+ src/Indigo/Common/Expr.hs view
@@ -0,0 +1,520 @@+-- SPDX-FileCopyrightText: 2021 Oxhead Alpha+-- SPDX-License-Identifier: LicenseRef-MIT-OA++{-# OPTIONS_GHC -Wno-orphans #-}++-- | 'Expr' data type and its generalizations++module Indigo.Common.Expr+  ( -- * The Expr data type+    Expr (..)++  -- * Generalizations of Expr+  , IsExpr+  , ToExpr+  , ExprType+  , (:~>)+  , toExpr++  -- * Arithmetic Expr+  , IsArithExpr+  , IsUnaryArithExpr++  -- * Polymorphic Expr+  , IsConcatExpr+  , IsConcatListExpr+  , IsDivExpr+  , IsModExpr+  , IsGetExpr+  , IsMemExpr+  , IsSizeExpr+  , IsSliceExpr+  , IsUpdExpr++  , ObjectManipulation (..)+  , ObjectExpr+  , NamedFieldExpr (..)+  ) where++import Data.Kind qualified as Kind+import Data.Typeable (typeRep)+import Data.Vinyl.Core (RMap(..), RecordToList(..))+import Data.Vinyl.Functor (Const(..))+import Fmt (Buildable(..), pretty)+import Prelude hiding (Const(..))++import Indigo.Common.Expr.TH (deriveExprBuildable)+import Indigo.Common.Field+import Indigo.Common.Object (ComplexObjectC, FieldTypes, IndigoObjectF(..))+import Indigo.Common.Var (Var(..))+import Indigo.Lorentz+import Morley.Michelson.Typed (CtorOnlyField, GetFieldType, InstrUnwrapC, InstrWrapOneC)+import Morley.Michelson.Typed.Arith qualified as M++----------------------------------------------------------------------------+-- The Expr data type+----------------------------------------------------------------------------++data Expr a where+  C :: NiceConstant a => a -> Expr a++  V :: KnownValue a => Var a -> Expr a++  ObjMan :: ObjectManipulation a -> Expr a++  Cast :: KnownValue a => Expr a -> Expr a++  Size :: SizeOpHs c => Expr c -> Expr Natural++  Update+    :: (UpdOpHs c, KnownValue c)+    => Expr c -> Expr (UpdOpKeyHs c) -> Expr (UpdOpParamsHs c) -> Expr c++  Add+    :: (ArithOpHs M.Add n m r, KnownValue r)+    => Expr n -> Expr m -> Expr r++  Sub+    :: (ArithOpHs M.Sub n m r, KnownValue r)+    => Expr n -> Expr m -> Expr r++  Mul+    :: (ArithOpHs M.Mul n m r, KnownValue r)+    => Expr n -> Expr m -> Expr r++  Div+    :: ( KnownValue ratio+       , ArithOpHs M.EDiv n m (Maybe (ratio, reminder))+       )+    => Expr n -> Expr m -> Proxy reminder -> Expr ratio++  Mod+    :: ( KnownValue reminder+       , ArithOpHs M.EDiv n m (Maybe (ratio, reminder))+       )+    => Expr n -> Expr m -> Proxy ratio -> Expr reminder++  Abs+    :: (UnaryArithOpHs M.Abs n, KnownValue (UnaryArithResHs M.Abs n))+    => Expr n -> Expr (UnaryArithResHs M.Abs n)++  Neg+    :: (UnaryArithOpHs M.Neg n, KnownValue (UnaryArithResHs M.Neg n))+    => Expr n -> Expr (UnaryArithResHs M.Neg n)+++  Lsl+    :: (ArithOpHs M.Lsl n m r, KnownValue r)+    => Expr n -> Expr m -> Expr r++  Lsr+    :: (ArithOpHs M.Lsr n m r, KnownValue r)+    => Expr n -> Expr m -> Expr r+++  Eq' :: NiceComparable n => Expr n -> Expr n -> Expr Bool++  Neq :: NiceComparable n => Expr n -> Expr n -> Expr Bool++  Le :: NiceComparable n => Expr n -> Expr n -> Expr Bool++  Lt :: NiceComparable n => Expr n -> Expr n -> Expr Bool++  Ge :: NiceComparable n => Expr n -> Expr n -> Expr Bool++  Gt :: NiceComparable n => Expr n -> Expr n -> Expr Bool++  Or+    :: (ArithOpHs M.Or n m r, KnownValue r)+    => Expr n -> Expr m -> Expr r++  Xor+    :: (ArithOpHs M.Xor n m r, KnownValue r)+    => Expr n -> Expr m -> Expr r++  And+    :: (ArithOpHs M.And n m r, KnownValue r)+    => Expr n -> Expr m -> Expr r++  Not+    :: (UnaryArithOpHs M.Not n, KnownValue (UnaryArithResHs M.Not n))+    => Expr n -> Expr (UnaryArithResHs M.Not n)++  Int' :: Expr Natural -> Expr Integer++  IsNat :: Expr Integer -> Expr (Maybe Natural)++  Coerce+    :: (Castable_ a b, KnownValue b)+    => Expr a -> Expr b++  ForcedCoerce+    :: (MichelsonCoercible a b, KnownValue b)+    => Expr a -> Expr b++  Fst :: KnownValue n => Expr (n, m) -> Expr n+  Snd :: KnownValue m => Expr (n, m) -> Expr m++  Pair :: KnownValue (n, m) => Expr n -> Expr m -> Expr (n, m)++  Some :: KnownValue (Maybe t) => Expr t -> Expr (Maybe t)+  None :: KnownValue t => Expr (Maybe t)++  Right' :: (KnownValue y, KnownValue (Either y x)) => Expr x -> Expr (Either y x)+  Left' :: (KnownValue x, KnownValue (Either y x)) => Expr y -> Expr (Either y x)++  Mem :: MemOpHs c => Expr (MemOpKeyHs c) -> Expr c -> Expr Bool++  StGet+    :: ( StoreHasSubmap store name key value+       , KnownValue value+       )+    => Label name -> Expr key -> Expr store -> Expr (Maybe value)++  StInsertNew+    :: ( StoreHasSubmap store name key value+       , KnownValue store+       , Dupable key+       , IsError err+       , Buildable err+       )+    => Label name -> err+    -> Expr key -> Expr value -> Expr store -> Expr store++  StInsert+    :: (StoreHasSubmap store name key value, KnownValue store)+    => Label name+    -> Expr key -> Expr value -> Expr store -> Expr store++  StMem+    :: ( StoreHasSubmap store name key val+       , KnownValue val+       )+    => Label name -> Expr key -> Expr store -> Expr Bool++  StUpdate+    :: (StoreHasSubmap store name key val, KnownValue store)+    => Label name -> Expr key -> Expr (Maybe val) -> Expr store -> Expr store++  StDelete+    :: (StoreHasSubmap store name key val, KnownValue store, KnownValue val)+    => Label name -> Expr key -> Expr store -> Expr store++  Wrap+    :: ( InstrWrapOneC dt name+       , KnownValue dt+       )+    => Label name+    -> Expr (CtorOnlyField name dt)+    -> Expr dt+  Unwrap+    :: ( InstrUnwrapC dt name+       , KnownValue (CtorOnlyField name dt)+       )+    => Label name+    -> Expr dt+    -> Expr (CtorOnlyField name dt)++  Construct+    :: ( InstrConstructC dt+       , RMap (ConstructorFieldTypes dt)+       , RecordToList (ConstructorFieldTypes dt)+       , KnownValue dt+       )+    => Proxy dt -> Rec Expr (ConstructorFieldTypes dt) -> Expr dt++  -- TODO remove Construct and rename this one+  ConstructWithoutNamed+    :: ComplexObjectC dt+    => Proxy dt -> Rec Expr (FieldTypes dt) -> Expr dt++  Name+    :: KnownValue (name :! t)+    => Label name -> Expr t -> Expr (name :! t)+  UnName+    :: KnownValue t+    => Label name -> Expr (name :! t) -> Expr t++  EmptySet+    :: (NiceComparable key, KnownValue (Set key))+    => Expr (Set key)++  Get+    :: ( GetOpHs c+       , KnownValue (Maybe (GetOpValHs c))+       , KnownValue (GetOpValHs c)+       )+    => Expr (GetOpKeyHs c) -> Expr c -> Expr (Maybe (GetOpValHs c))++  EmptyMap+    :: (KnownValue value, NiceComparable key, KnownValue (Map key value))+    => Expr (Map key value)++  EmptyBigMap+    :: (KnownValue value, NiceComparable key, KnownValue (BigMap key value))+    => Expr (BigMap key value)++  Pack+    :: NicePackedValue a+    => Expr a -> Expr (Packed a)++  Unpack+    :: NiceUnpackedValue a+    => Expr (Packed a) -> Expr (Maybe a)++  PackRaw+    :: NicePackedValue a+    => Expr a -> Expr ByteString++  UnpackRaw+    :: NiceUnpackedValue a+    => Expr ByteString -> Expr (Maybe a)++  Cons :: KnownValue (List a) => Expr a -> Expr (List a) -> Expr (List a)++  Nil :: KnownValue a => Expr (List a)++  Concat+    :: (ConcatOpHs c, KnownValue c)+    => Expr c -> Expr c -> Expr c++  Concat'+    :: (ConcatOpHs c, KnownValue c)+    => Expr (List c) -> Expr c++  Slice+    :: (SliceOpHs c, KnownValue c)+    => Expr Natural -> Expr Natural -> Expr c -> Expr (Maybe c)++  Contract+    :: ( NiceParameterFull p+       , NoExplicitDefaultEntrypoint p+       , IsoValue (ContractRef p)+       , ToTAddress p vd addr+       , ToT addr ~ ToT Address+       )+    => Proxy vd -> Expr addr -> Expr (Maybe (ContractRef p))++  Self+    :: ( NiceParameterFull p+       , NoExplicitDefaultEntrypoint p+       , IsoValue (ContractRef p)+       , IsNotInView+       )+    => Expr (ContractRef p)++  SelfAddress+    :: Expr Address++  ContractAddress+    :: Expr (ContractRef p) -> Expr Address++  ContractCallingUnsafe+    :: (NiceParameter arg, IsoValue (ContractRef arg))+    => EpName -> Expr Address -> Expr (Maybe (ContractRef arg))++  RunFutureContract+    :: (NiceParameter p, IsoValue (ContractRef p))+    => Expr (FutureContract p) -> Expr (Maybe (ContractRef p))++  ImplicitAccount :: Expr KeyHash -> Expr (ContractRef ())++  ConvertEpAddressToContract+    :: (NiceParameter p, IsoValue (ContractRef p))+    => Expr EpAddress -> Expr (Maybe (ContractRef p))++  MakeView+    :: KnownValue (View_ a r)+    => Expr a -> Expr (ContractRef r) -> Expr (View_ a r)++  MakeVoid+    :: KnownValue (Void_ a b)+    => Expr a -> Expr (Lambda b b) -> Expr (Void_ a b)++  CheckSignature+    :: BytesLike bs => Expr PublicKey -> Expr (TSignature bs) -> Expr bs -> Expr Bool++  Sha256 :: BytesLike bs => Expr bs -> Expr (Hash Sha256 bs)+  Sha512 :: BytesLike bs => Expr bs -> Expr (Hash Sha512 bs)+  Blake2b :: BytesLike bs => Expr bs -> Expr (Hash Blake2b bs)+  Sha3 :: BytesLike bs => Expr bs -> Expr (Hash Sha3 bs)+  Keccak :: BytesLike bs => Expr bs -> Expr (Hash Keccak bs)+  HashKey :: Expr PublicKey -> Expr KeyHash++  ChainId :: Expr ChainId+  Level :: Expr Natural++  Now :: Expr Timestamp+  Amount :: Expr Mutez+  Balance :: Expr Mutez+  Sender :: Expr Address+  VotingPower :: Expr KeyHash -> Expr Natural+  TotalVotingPower :: Expr Natural++  -- TODO [#832]: add 4 ticket instructions++  Exec+    :: KnownValue b+    => Expr a -> Expr (Lambda a b) -> Expr b++  NonZero+    :: (NonZero n, KnownValue (Maybe n))+    => Expr n -> Expr (Maybe n)++----------------------------------------------------------------------------+-- Object manipulation+----------------------------------------------------------------------------++-- | Datatype describing access to an inner fields of object, like+-- @object !. field1 !. field2 ~. (field3, value3) ~. (field4, value4)@+data ObjectManipulation a where+  Object :: Expr a -> ObjectManipulation a++  ToField+    :: HasField dt fname ftype+    => ObjectManipulation dt+    -> Label fname+    -> ObjectManipulation ftype++  -- NB. @SetField (Object expr) field1+  --       (ObjMan $ SetField (ToField (Object expr) field1) field2 targetExpr)@+  -- is a bad representation, which will cause generation of not optimal code+  -- (like expr would be materialized object),+  -- so it would be nice to enforce only+  -- @SetField (Object expr) (field1 . field2) targetExpr@ representation.+  SetField+    :: HasField dt fname ftype+    => ObjectManipulation dt+    -> Label fname+    -> Expr ftype+    -> ObjectManipulation dt++deriveExprBuildable ''Expr++instance Buildable (ObjectManipulation a) where+  build (Object e) = build e+  build (ToField oman lab) = pretty oman <> " #! " <> pretty lab+  build (SetField oman lab fEx) = pretty oman <> " !! (" <> pretty lab <> ", " <> pretty fEx <> ")"++-- | Auxiliary datatype where each field refers to+-- an expression the field equals to. It's not recursive one.+data NamedFieldExpr a name where+  NamedFieldExpr+    :: { unNamedFieldExpr :: Expr (GetFieldType a name) }+    -> NamedFieldExpr a name++type ObjectExpr a = IndigoObjectF (NamedFieldExpr a) a++----------------------------------------------------------------------------+-- Generalizations of Expr+----------------------------------------------------------------------------++type IsExpr op n = (ToExpr op, ExprType op ~ n, KnownValue n)+type (:~>) op n = IsExpr op n++type ExprType a = ExprType' (Decide a) a++toExpr :: forall a . ToExpr a => a -> Expr (ExprType a)+toExpr = toExpr' @(Decide a) @a++class ToExpr' (Decide x) x => ToExpr x+instance ToExpr' (Decide x) x => ToExpr x++-- This type class is needed to cope with overlapping instances.+class ToExpr' decision c where+  type family ExprType' decision c :: Kind.Type+  toExpr' :: c -> Expr (ExprType' decision c)++-- Instance for a var+instance KnownValue (a :: Kind.Type) => ToExpr' 'VarD (Var a) where+  type instance ExprType' 'VarD (Var a) = a+  toExpr' = V++-- Instance for a value+instance NiceConstant a => ToExpr' 'ValD a where+  type instance ExprType' 'ValD a = a+  toExpr' = C++-- Instance for StructManipulation+instance ToExpr' 'ObjManD (ObjectManipulation a) where+  type instance ExprType' 'ObjManD (ObjectManipulation a) = a+  toExpr' = ObjMan++-- Instance for Expr itself+instance ToExpr' 'ExprD (Expr a) where+  type instance ExprType' 'ExprD (Expr a) = a+  toExpr' = id++data Decision = VarD | ValD | ExprD | ObjManD++type family Decide x :: Decision where+  Decide (Var _) = 'VarD+  Decide (Expr _) = 'ExprD+  Decide (ObjectManipulation _) = 'ObjManD+  Decide _ = 'ValD++type IsUnaryArithExpr exN a n =+  ( exN :~> n+  , UnaryArithOpHs a n+  , KnownValue (UnaryArithResHs a n)+  )++type IsArithExpr exN exM a n m r =+  ( exN :~> n, exM :~> m+  , ArithOpHs a n m r+  , KnownValue r+  )++type IsDivExpr exN exM n m ratio reminder =+  ( exN :~> n, exM :~> m+  , KnownValue ratio+  , ArithOpHs M.EDiv n m (Maybe (ratio, reminder))+  )++type IsModExpr exN exM n m ratio reminder =+  ( exN :~> n, exM :~> m+  , KnownValue reminder+  , ArithOpHs M.EDiv n m (Maybe (ratio, reminder))+  )++type IsConcatExpr exN1 exN2 n =+  ( exN1 :~> n+  , exN2 :~> n+  , ConcatOpHs n+  )++type IsConcatListExpr exN n =+  ( exN :~> List n+  , ConcatOpHs n+  , KnownValue n+  )++type IsSliceExpr exN n =+  ( exN :~> n+  , SliceOpHs n+  )++type IsGetExpr exKey exMap map =+  ( exKey :~> GetOpKeyHs map+  , exMap :~> map+  , GetOpHs map+  , KnownValue (GetOpValHs map)+  )++type IsUpdExpr exKey exVal exMap map =+  ( exKey :~> UpdOpKeyHs map+  , exVal :~> UpdOpParamsHs map+  , exMap :~> map+  , UpdOpHs map+  )++type IsMemExpr exKey exN n =+  ( exKey :~> MemOpKeyHs n+  , exN :~> n+  , MemOpHs n+  )++type IsSizeExpr exN n =+  ( exN :~> n+  , SizeOpHs n+  )
+ src/Indigo/Common/Expr/TH.hs view
@@ -0,0 +1,165 @@+-- SPDX-FileCopyrightText: 2021 Oxhead Alpha+-- SPDX-License-Identifier: LicenseRef-MIT-OA++{-# LANGUAGE QuasiQuotes #-}++-- | TH utilities used in "Indigo.Common.Expr"+module Indigo.Common.Expr.TH+       ( deriveExprBuildable+       ) where++import Data.Map qualified as M+import Data.Set qualified as S+import Language.Haskell.TH+import Language.Haskell.TH.Syntax+import Language.Haskell.TH.Syntax qualified as TH+import Prelude hiding (Const)+import Text.Casing qualified as C++pattern CName :: String -> (TH.Name, [BangType])+pattern CName nm <- (TH.Name (OccName nm) _, _)++type UntypedConstr = (Name, [BangType])++-- | Generates an Buildable instance for a Expr GADT. /Note:/ This will not generate+-- additional constraints to the generated instance if those are required.+-- Inspired by 'deriveGADTNFData' from Util.TH.+deriveExprBuildable :: Name -> Q [Dec]+deriveExprBuildable name = do+  TyConI (DataD _ dataName vars _ cons _) <- reify name++  let getNameFromVar (PlainTV n _) = n+      getNameFromVar (KindedTV n _ _) = n+      convertTyVars orig = foldr (\a b -> AppT b . VarT $ getNameFromVar a) orig vars++      -- Unfolds multiple constructors of form "A, B, C :: A -> Stuff"+      -- into a list of tuples of constructor names and their data+      unfoldConstructor (GadtC cs bangs _) = map (,bangs) cs+      unfoldConstructor (ForallC _ _ c) = unfoldConstructor c+      unfoldConstructor _ = fail "Non GADT constructors are not supported."++      (bLeft, bRight, comma) = (LitE (StringL "("), LitE (StringL ")"), LitE (StringL ", "))++      mappendAll :: [Exp] -> Exp+      mappendAll [] = error "impossible empty list"+      mappendAll (hd : rest) = foldl (\res term -> InfixE (Just res) (VarE (mkName "<>")) (Just term)) hd rest++      omitUnaryConstr :: (Exp -> Exp) -> UntypedConstr -> Q Clause+      omitUnaryConstr fun (conName, _) = do+        var <- newName "a"+        return $+          Clause+            [ConP conName [VarP var]]+            (NormalB $ fun (VarE var))+            []++      -- Specific to Expr+      toFunName (CName "Right'") = "right"+      toFunName (CName "Left'")  = "left"+      toFunName (CName "Concat'") = "concatAll"+      toFunName (CName "Int'")  = "toInt"+      toFunName (TH.Name (OccName nm) _, _) = C.toCamel $ C.fromHumps nm++      operators :: Map String String+      operators = M.fromList [ ("Add", "+"), ("Sub", "-"), ("Mul", "*"), ("Div", "/"), ("Mod", "%")+                             , ("Lsl", "<<<"), ("Lsr", ">>>"), ("Eq'", "=="), ("Neq", "/="), ("Le", "=<")+                             , ("Lt", "<"), ("Ge", ">="), ("Gt", ">="), ("Or", "||"), ("Xor", "^"), ("And", "&&")+                             , ("Cons", ".:"), ("Concant", "<>")+                             ]++      braces :: Set String+      braces = S.fromList ["Add", "Sub", "Or", "Xor", "Lsl", "Lsr"]++      makeClause :: UntypedConstr -> Q Clause+      makeClause c@(CName "C") = omitUnaryConstr (AppE (VarE $ mkName "pretty") . AppE (ConE $ mkName "PrintAsValue")) c+      makeClause c@(CName "V") = omitUnaryConstr (AppE (VarE $ mkName "pretty")) c+      makeClause c@(CName "Div") = constructBinaryOperatorWithProxy c+      makeClause c@(CName "Mod") = constructBinaryOperatorWithProxy c+      makeClause c@(CName "Contract") = constructUnaryWithProxy c+      makeClause c@(CName "ObjMan") = omitUnaryConstr (AppE (VarE $ mkName "pretty")) c+      makeClause c@(CName "Construct") = construct c+      makeClause c@(CName "ConstructWithoutNamed") = construct c+      makeClause c@(CName "StInsertNew") =+        generalClauseImpl "pretty" c Nothing+      makeClause c@(TH.Name (OccName nm) _, _) =+        generalClauseImpl "pretty" c $ (, S.member nm braces) <$> M.lookup nm operators++      -- Construct build instance for operators that have several proxy values+      constructBinaryOperatorWithProxy (conName, bangs) = do+        x <- newName "a"+        y <- newName "a"+        let nm = nameBase conName+            op = fromMaybe (error "Unknown operator") $ M.lookup nm operators+            var_x = AppE (VarE $ mkName "pretty") (VarE x)+            var_y = AppE (VarE $ mkName "pretty") (VarE y)+            wilds = map (\_ -> WildP) (drop 2 bangs)+            varList = (map VarP [x, y]) ++ wilds++            pretties = [var_x, LitE (StringL $ " " <> op <> " "), var_y]++        return $+          Clause+            [ConP conName varList]+            (NormalB $ mappendAll pretties)+            []++      -- Construct build instance for constructors with a single argument preceeded+      -- by a single proxy+      constructUnaryWithProxy (conName, _bangs) = do+        x <- newName "a"+        let var_x = AppE (VarE $ mkName "pretty") (VarE x)+        return $+          Clause+            [ConP conName [WildP, VarP x]]+            (NormalB  var_x)+            []+++      construct (conName, _) = do+        proxy <- newName "proxy"+        r <- newName "rec"+        let showTypeRep = AppE (VarE $ mkName "show") . AppE (VarE $ mkName "typeRep")+        mappendRec <- [| \x -> mconcat (intersperse "," (recordToList (rmap (\ex -> Const (pretty ex)) x))) |]+        return $+          Clause+            [ConP conName [VarP proxy, VarP r]]+            (NormalB $+              mappendAll [showTypeRep (VarE proxy), bLeft, (AppE mappendRec (VarE r)), bRight])+            []++      -- Constructs a clause "build (ConName a1 a2) = "CON_NAME" <> "(" <> pretty a1 <> pretty a2 <> ")"+      -- The first argument is a workaround: it returns name of printing function either "pretty" or "show"+      -- by index argument.+      -- This is mainly for 'StInsertNew' constructor to print error with show+      generalClauseImpl :: String -> (Name, [BangType]) -> Maybe (String, Bool) -> Q Clause+      generalClauseImpl funName c@(conName, bangs) isInfix = do+        varNames <- traverse (\_ -> newName "a") bangs++        -- useful constants+        let funStr = LitE (StringL $ toFunName c)+        let pretties =+              case map (\e -> AppE (VarE $ mkName funName) (VarE e)) varNames of+                -- Nullary operator: "function_name"+                []    -> [funStr]+                -- Infix binary operator without braces: pretty x <> " operator " <> pretty y+                [x, y] | Just (op, False) <- isInfix ->+                  [x, LitE (StringL $ " " <> op <> " "), y]+                -- Infix binary operator with braces: "(" <> pretty x <> " operator " <> pretty y <> ")"+                [x, y] | Just (op, True) <- isInfix ->+                  [bLeft, x, LitE (StringL $ " " <> op <> " "), y, bRight]+                -- Infix binary operator with braces: "function_name" <> "(" <> pretty x1 <> "," ... <> pretty xn <> ")"+                xs -> funStr : bLeft : (intersperse comma xs ++ [bRight])+        return $+          Clause+            [ConP conName (map VarP varNames)]+            (NormalB $ mappendAll pretties)+            []++  clauses <- traverse makeClause $ cons >>= unfoldConstructor+  return+    [ InstanceD+        Nothing+        []+        (AppT (ConT $ mkName "Buildable") (convertTyVars $ ConT dataName))+        [FunD (mkName "build") clauses]+    ]
+ src/Indigo/Common/Field.hs view
@@ -0,0 +1,136 @@+-- SPDX-FileCopyrightText: 2021 Oxhead Alpha+-- SPDX-License-Identifier: LicenseRef-MIT-OA++{- | This module contains a datatype representing a lens to a field,+helpers to compose new lens, and type class like StoreHasField returning a lens. -}++module Indigo.Common.Field+       ( AccessFieldC+       , fetchField+       , assignField++       -- * Lens+       , FieldLens (..)+       , flSFO+       -- * HasLens+       , HasField (..)+       , fieldLensDeeper+       , fieldLensADT+       ) where++import Data.Vinyl (RElem)+import Data.Vinyl.Lens (rget, rput)+import Data.Vinyl.TypeLevel (RIndex)+import GHC.TypeLits (KnownSymbol)++import Indigo.Lorentz+import Indigo.Prelude+import Lorentz.ADT qualified as L+import Morley.Michelson.Typed.Haskell.Instr.Product+  (ConstructorFieldNames, GetFieldType, InstrGetFieldC, InstrSetFieldC)++-- | Constraint to access/assign field stored in Rec+type AccessFieldC a name =+  RElem name (ConstructorFieldNames a) (RIndex name (ConstructorFieldNames a))++-- | Get a field from list of fields+fetchField+  :: forall a name f proxy . AccessFieldC a name+  => proxy name -> Rec f (ConstructorFieldNames a) -> f name+fetchField _ = rget @name++-- | Assign a field to a value+assignField+  :: forall a name f proxy . AccessFieldC a name+  => proxy name -> f name -> Rec f (ConstructorFieldNames a) -> Rec f (ConstructorFieldNames a)+assignField _ = rput @_ @name++-- | Lens to a field.+-- @obj.f1.f2.f3@ is represented as list names of @[f1, f2, f3]@.+--+-- @dt@ is a type of source object (type of obj in example above)+-- @fname@ is a name of target field (@"f3"@ in example above)+-- @ftype@ is a type of target field+--+-- However, a lens contains not only name of field+-- but for each field it contains operations to get and set+-- target field.+data FieldLens dt fname ftype where+  -- Direct field of @dt@ (which is target one).+  -- Pay attention that it holds a label of existential type @fname@ but not @targetFName@.+  -- It's made to allow a developer to refer to a field+  -- with a custom name.+  -- The another argument is 'StoreFieldOps'.+  TargetField+    :: ( InstrGetFieldC dt fname+       , InstrSetFieldC dt fname+       , GetFieldType dt fname ~ targetFType+       , AccessFieldC dt fname+       )+    => Label fname+    -> StoreFieldOps dt targetFName targetFType+    -> FieldLens dt targetFName targetFType++  -- Deeper field of @dt@.+  -- It takes a label with name of direct field and+  -- 'HasField' with deeper field as source and+  -- with the same target field,+  -- so it's how this datatype is alike list of fields.+  -- The last argument is Lorentz operations to get and set target field.+  DeeperField+    :: ( AccessFieldC dt fname+       , InstrSetFieldC dt fname+       , HasField (GetFieldType dt fname) targetFName targetFType+       )+    => Label fname+    -> StoreFieldOps dt targetFName targetFType+    -> FieldLens dt targetFName targetFType++-- | Access to 'StoreFieldOps'+flSFO :: FieldLens dt fname ftype -> StoreFieldOps dt fname ftype+flSFO (TargetField _ sfo) = sfo+flSFO (DeeperField _ sfo) = sfo++-- | Class like 'StoreHasField' type class but holding a lens to a field.+class (KnownValue ftype, KnownValue dt) => HasField dt fname ftype | dt fname -> ftype  where+  fieldLens :: FieldLens dt fname ftype++-- | Build a lens to a direct field of an object.+fieldLensADT+  :: forall dt targetFName targetFType fname  .+  ( InstrGetFieldC dt fname+  , InstrSetFieldC dt fname+  , GetFieldType dt fname ~ targetFType+  , AccessFieldC dt fname+  )+ => Label fname -> FieldLens dt targetFName targetFType+fieldLensADT lb =+  let sfo = storeFieldOpsADT @dt @fname in+  TargetField lb $ storeFieldOpsReferTo (fieldNameFromLabel lb) sfo++-- | Build a lens to deeper field of an object.+fieldLensDeeper+  :: forall dt targetName targetType fname .+  ( AccessFieldC dt fname+  , L.HasFieldOfType dt fname (GetFieldType dt fname)+  , HasDupableGetters (GetFieldType dt fname)+  , HasField (GetFieldType dt fname) targetName targetType+  )+  => Label fname+  -> FieldLens dt targetName targetType+fieldLensDeeper lb =+  DeeperField lb $+    composeStoreFieldOps (fieldNameFromLabel lb) (storeFieldOpsADT @dt) (flSFO fieldLens)++-- | Default instance for datatype and its direct field name.+-- It will be useful unless you want to refer to a field using a custom name.+instance {-# OVERLAPPABLE #-}+         ( InstrSetFieldC dt fname+         , InstrGetFieldC dt fname+         , GetFieldType dt fname ~ ftype+         , AccessFieldC dt fname+         , KnownSymbol fname+         , KnownValue ftype, KnownValue dt+         )+         => HasField dt fname ftype where+  fieldLens = TargetField (Label @fname) storeFieldOpsADT
+ src/Indigo/Common/Object.hs view
@@ -0,0 +1,211 @@+-- SPDX-FileCopyrightText: 2021 Oxhead Alpha+-- SPDX-License-Identifier: LicenseRef-MIT-OA++{-# LANGUAGE QuantifiedConstraints #-}++module Indigo.Common.Object+  ( IndigoObjectF (..)+  , NamedFieldObj (..)+  , TypedFieldObj (..)+  , FieldTypes+  , Object+  , SomeObject (..)+  , namedToTypedRec+  , typedToNamedRec+  , namedToTypedFieldObj+  , typedToNamedFieldObj++  , IsObject+  , complexObjectDict+  , ComplexObjectC+  , castFieldConstructors+  , withInstrDeconstructC+  ) where++import Data.Constraint (Dict(..))+import Data.Vinyl (RMap, RecordToList)+import Data.Vinyl.TypeLevel (AllConstrained)+import GHC.Generics qualified as G++import Indigo.Backend.Prelude+import Indigo.Common.Var (RefId)+import Indigo.Lorentz+import Morley.Michelson.Typed (IsPrimitiveValue, ToTs)+import Morley.Michelson.Typed.Haskell.Instr.Product+  (CastFieldConstructors(..), ConstructorFieldNames, FieldConstructor(..), GetFieldType,+  InstrDeconstructC)+import Morley.Util.Type (KList(..), KnownList(..), type (++))++----------------------------------------------------------------------------+-- IndigoObjectF+----------------------------------------------------------------------------++-- | A object that can be either+-- stored in the single stack cell or split into fields.+-- Fields are identified by their names.+--+-- @f@ is a functor to be applied to each of field names.+data IndigoObjectF f a where+  -- | Value stored on the stack, it might be+  -- either complex product type, like @(a, b)@, Storage, etc,+  -- or sum type like 'Either', or primitive like 'Int', 'Operation', etc.+  Cell :: KnownValue a => RefId -> IndigoObjectF f a+  -- | Decomposed product type, which is NOT stored+  -- as one cell on the stack.+  Decomposed :: ComplexObjectC a => Rec f (ConstructorFieldNames a) -> IndigoObjectF f a++-- | Auxiliary type family to convert list of field names+-- to list of field types+type family MapGFT a rs where+  MapGFT _ '[] = '[]+  MapGFT a (name ': xs) = GetFieldType a name ': MapGFT a xs++-- | Convert a list of fields from name-based list to type-based one+namedToTypedRec+  :: forall a f g .+    (forall name . f name -> g (GetFieldType a name))+  -> Rec f (ConstructorFieldNames a)+  -> Rec g (FieldTypes a)+namedToTypedRec fun = namedToTypedRecImpl+  where+    namedToTypedRecImpl :: Rec f rs -> Rec g (MapGFT a rs)+    namedToTypedRecImpl RNil = RNil+    namedToTypedRecImpl (v :& xs) = fun v :& namedToTypedRecImpl xs++-- | Convert a list of fields from type-based list to named-based one+typedToNamedRec :: forall a f g . KnownList (ConstructorFieldNames a)+  => (forall name . f (GetFieldType a name) -> g name)+  -> Rec f (FieldTypes a)+  -> Rec g (ConstructorFieldNames a)+typedToNamedRec fun = typedToNamedRecImpl+  where+    typedToNamedRecImpl :: forall rs . KnownList rs => Rec f (MapGFT a rs) -> Rec g rs+    typedToNamedRecImpl re = case (klist @rs, re) of+      (KNil, RNil)  -> RNil+      (KCons (_ :: Proxy nm) (_ :: Proxy rs'), v :& vs) -> fun v :& typedToNamedRecImpl vs++castFieldConstructors+  :: forall a st . CastFieldConstructors (FieldTypes a) (ConstructorFieldTypes a)+  => Rec (FieldConstructor st) (FieldTypes a) -> Rec (FieldConstructor st) (ConstructorFieldTypes a)+castFieldConstructors = castFieldConstructorsImpl++-- | Auxiliary datatype to define a Objiable.+-- Keeps field name as type param+data NamedFieldObj a name where+  NamedFieldObj+    :: IsObject (GetFieldType a name)+    => { unFieldObj :: Object (GetFieldType a name)+       }+    -> NamedFieldObj a name++type Object a = IndigoObjectF (NamedFieldObj a) a++data SomeObject where+  SomeObject :: IsObject a => Object a -> SomeObject++-- | Like 'NamedFieldObj', but this one doesn't keep name of a field+data TypedFieldObj a where+  TypedFieldObj :: IsObject a => Object a -> TypedFieldObj a++namedToTypedFieldObj :: forall a name . NamedFieldObj a name -> TypedFieldObj (GetFieldType a name)+namedToTypedFieldObj (NamedFieldObj f) = TypedFieldObj f++typedToNamedFieldObj :: forall a name . TypedFieldObj (GetFieldType a name) -> NamedFieldObj a name+typedToNamedFieldObj (TypedFieldObj f) = NamedFieldObj f++----------------------------------------------------------------------------+-- IsObject type class+----------------------------------------------------------------------------++class IsObject' (TypeDecision a) a => IsObject a+instance IsObject' (TypeDecision a) a => IsObject a++type FieldTypes a = MapGFT a (ConstructorFieldNames a)++-- | Simply a synonym for an unwieldy constraint.+type InstrDeconstructCClassConstraint a st =+  ( InstrDeconstructC a (ToTs st)+  , ToTs (ConstructorFieldTypes a) ++ (ToTs st) ~ ToTs (ConstructorFieldTypes a ++ st)+  )++-- | We need this because 'InstrDeconstructC' is a constraint synonym, and parts+-- of it aren't exported from morley. Hence can't declare a quantified+-- constraint over it. And we really don't want to carry input stack everywhere+-- explicitly, hence why we want a quantified constraint.+class InstrDeconstructCClassConstraint a st => InstrDeconstructCClass (a :: Type) (st :: [Type])+instance InstrDeconstructCClassConstraint a st => InstrDeconstructCClass a st++-- | Simply a synonym for a quantified constraint, because we can't use a+-- quantified constraint in a synonym tuple.+class (forall st. InstrDeconstructCClass a st) => InstrDeconstructCGeneral a+instance (forall st. InstrDeconstructCClass a st) => InstrDeconstructCGeneral a++-- | Produce evidence of 'InstrDeconstructC' for a concrete input stack, and run+-- a computation with it.+withInstrDeconstructC+  :: forall a st r. InstrDeconstructCGeneral a+  => (InstrDeconstructCClass a st => r) -> r+withInstrDeconstructC f = f++type ToDeconstructC a =+  ( InstrDeconstructCGeneral a+  , KnownList (FieldTypes a)+  , AllConstrained KnownValue (FieldTypes a)+  , FieldTypes a ~ ConstructorFieldTypes a+  )++type ToConstructC a =+  ( KnownValue a+  , InstrConstructC a+  , RMap (ConstructorFieldNames a)+  , RMap (ConstructorFieldTypes a)+  , RMap (FieldTypes a)+  , KnownList (ConstructorFieldNames a)+  , CastFieldConstructors (FieldTypes a) (ConstructorFieldTypes a)+  )++type ComplexObjectC a =+  ( ToDeconstructC a+  , ToConstructC a+  , AllConstrained IsObject (FieldTypes a)+  , RecordToList (FieldTypes a) -- for Buildable+  )++-- | Type class instantiated for all possible Indigo types+class KnownValue a => IsObject' (decision :: Decision) a where+  complexObjectDict' :: Maybe (Dict (ComplexObjectC a))++instance KnownValue a => IsObject' 'PrimitiveD a where+  complexObjectDict' = Nothing++instance KnownValue a => IsObject' 'SumTypeD a where+  complexObjectDict' = Nothing++instance ComplexObjectC a => IsObject' 'ProductTypeD a where+  complexObjectDict' = Just Dict++complexObjectDict :: forall a . IsObject a => Maybe (Dict (ComplexObjectC a))+complexObjectDict = complexObjectDict' @(TypeDecision a) @a++-- | Decide whether type is either primitive or ADT+type TypeDecision a = Decide (IsPrimitiveValue a) (IsSumType (G.Rep a))++data Decision+  = PrimitiveD+  | SumTypeD+  | ProductTypeD++type family Decide flagPrimitive flagSumType where+  Decide 'True _ = 'PrimitiveD+  Decide 'False 'True = 'SumTypeD+  Decide 'False 'False = 'ProductTypeD++type family IsSumType x where+  IsSumType (G.D1 _ x) = IsSumType x+  IsSumType (G.C1 _ x) = IsSumType x+  IsSumType (G.M1 _ _ x) = IsSumType x+  IsSumType (_ G.:*: _) = 'False+  IsSumType (G.Rec0 _) = 'False+  IsSumType G.V1 = 'False+  IsSumType G.U1 = 'False+  IsSumType (_ G.:+: _) = 'True
+ src/Indigo/Common/SIS.hs view
@@ -0,0 +1,55 @@+-- SPDX-FileCopyrightText: 2020 Tocqueville Group+--+-- SPDX-License-Identifier: LicenseRef-MIT-TQ++-- | 'SomeIndigoState' existential and utilities to work with it.+module Indigo.Common.SIS+  ( SomeIndigoState (..)+  , SomeGenCode (..)+  , toSIS+  , runSIS+  , thenSIS+  , overSIS+  ) where++import Indigo.Prelude++import Indigo.Common.State++-- | 'GenCode' with hidden output stack+data SomeGenCode inp where+  SomeGenCode :: GenCode inp out -> SomeGenCode inp++-- | 'IndigoState' with hidden output stack,+-- necessary to generate typed Lorentz code from untyped Indigo frontend.+newtype SomeIndigoState inp = SomeIndigoState+  { unSIS :: MetaData inp -> SomeGenCode inp+  }++-- | To run 'SomeIndigoState' you need to pass an handler of 'GenCode' with any+-- output stack and initial 'MetaData'.+runSIS :: SomeIndigoState inp -> MetaData inp -> (forall out . GenCode inp out -> r) -> r+runSIS (SomeIndigoState act) md f = case act md of+  SomeGenCode gc -> f gc++-- | Convert 'IndigoState' to 'SomeIndigoState'+toSIS :: IndigoState inp out -> SomeIndigoState inp+toSIS is = SomeIndigoState $ \md -> SomeGenCode $ runIndigoState is md++-- | Similar to a @>>@ for 'SomeIndigoState'.+thenSIS :: SomeIndigoState inp -> (forall out . SomeIndigoState out) -> SomeIndigoState inp+thenSIS m f = SomeIndigoState $ \md ->+  case unSIS m md of+    (SomeGenCode (GenCode st1 cd1 cl1 :: GenCode inp out)) ->+      case unSIS (f @out) (replStkMd md st1) of+        SomeGenCode (GenCode st2 cd2 cl2) ->+          SomeGenCode (GenCode st2 (cd1 ## cd2) (cl2 ## cl1))++-- | Modify the 'GenCode' inside a 'SomeIndigoState' by passing an handler of+-- 'GenCode' that returns a 'SomeGenCode'.+-- Useful in some cases to "wrap" or update and exising 'SomeGenCode'.+overSIS+  :: (forall out. GenCode inp out -> SomeGenCode inp)+  -> SomeIndigoState inp+  -> SomeIndigoState inp+overSIS f si = SomeIndigoState $ \md -> runSIS si md f
+ src/Indigo/Common/State.hs view
@@ -0,0 +1,247 @@+-- SPDX-FileCopyrightText: 2021 Oxhead Alpha+-- SPDX-License-Identifier: LicenseRef-MIT-OA++{-# LANGUAGE InstanceSigs #-}++{- |+This module contains the core of Indigo language:+'IndigoState', a datatype that represents its state.+It also includes some convenient functions to work with it,+to provide rebindable syntax.++'IndigoState' implements the functionality of a symbolic interpreter.+During its execution Lorentz code is being generated.++Functionally, it's the same as having Lorentz instruction that can access and+modify a 'StackVars', referring to values on the stack with a 'RefId'.+-}++module Indigo.Common.State+  ( -- * Indigo State+    IndigoState (..)+  , usingIndigoState+  , (>>)+  , (<$>)+  , iput+  , nopState+  , assignTopVar+  , withObject+  , withObjectState+  , withStackVars++  , DecomposedObjects+  , GenCodeHooks (..)+  , emptyGenCodeHooks+  , MetaData (..)+  , stmtHook+  , stmtHookState+  , auxiliaryHook+  , auxiliaryHookState+  , exprHook+  , exprHookState+  , replStkMd+  , alterStkMd+  , pushRefMd+  , pushNoRefMd+  , popNoRefMd++  , GenCode (..)+  , cleanGenCode++  , (##)+  ) where++import Data.Map qualified as M+import Data.Typeable (eqT, (:~:)(..))+import Fmt (pretty)++import Indigo.Backend.Prelude+import Indigo.Common.Object+import Indigo.Common.Var+import Indigo.Lorentz+import Lorentz.Instr qualified as L+import Morley.Michelson.Typed qualified as M+import Morley.Util.Peano++----------------------------------------------------------------------------+-- Indigo State+----------------------------------------------------------------------------++-- | IndigoState data type.+--+-- It takes as input a 'StackVars' (for the initial state) and returns a+-- 'GenCode' (for the resulting state and the generated Lorentz code).+--+-- IndigoState has to be used to write backend typed Lorentz code+-- from the corresponding frontend constructions.+--+-- It has no return type, IndigoState instruction may take one or more+-- "return variables", that they assign to values produced during their execution.+newtype IndigoState inp out = IndigoState {+    runIndigoState :: MetaData inp -> GenCode inp out+  }++-- | Inverse of 'runIndigoState' for utility.+usingIndigoState :: MetaData inp -> IndigoState inp out -> GenCode inp out+usingIndigoState md act = runIndigoState act md++-- | Then for rebindable syntax.+(>>) :: IndigoState inp out -> IndigoState out out1 -> IndigoState inp out1+(>>) a b = IndigoState $ \md ->+  let GenCode st1 cd1 cl1 = runIndigoState a md in+  let GenCode st2 cd2 cl2 = runIndigoState b (replStkMd md st1) in+  GenCode st2 (cd1 ## cd2) (cl2 ## cl1)++-- | Put new 'GenCode'.+iput :: GenCode inp out -> IndigoState inp out+iput gc = IndigoState $ \_ -> gc++-- | The simplest 'IndigoState', it does not modify the stack, nor the produced+-- code.+nopState :: IndigoState inp inp+nopState = IndigoState $ \md -> GenCode (mdStack md) L.nop L.nop++-- | Assigns a variable to reference the element on top of the stack.+assignTopVar :: KnownValue x => Var x -> IndigoState (x : inp) (x : inp)+assignTopVar var = IndigoState $ \md ->+  GenCode (assignVarAt var (mdStack md) SZ) L.nop L.nop++withObject+  :: forall a r .  KnownValue a+  => DecomposedObjects+  -> Var a+  -> (Object a -> r)+  -> r+withObject objs (Var refId) f = case M.lookup refId objs of+  Nothing -> f (Cell refId)+  Just so -> case so of+    SomeObject (obj :: Object a1) -> case eqT @a @a1 of+      Just Refl -> f obj+      Nothing ->+        error $ "unexpectedly SomeObject with by reference #" <> pretty refId <> " has different type"++withObjectState+  :: forall a inp out . KnownValue a+  => Var a+  -> (Object a -> IndigoState inp out)+  -> IndigoState inp out+withObjectState v f = IndigoState $ \md -> usingIndigoState md (withObject (mdObjects md) v f)++-- | Utility function to create 'IndigoState' that need access to the current 'StackVars'.+withStackVars :: (StackVars inp -> IndigoState inp out) -> IndigoState inp out+withStackVars fIs = IndigoState $ \md -> usingIndigoState md (fIs $ mdStack md)++----------------------------------------------------------------------------+-- MetaData primitives+----------------------------------------------------------------------------++type DecomposedObjects = Map RefId SomeObject++data MetaData inp = MetaData+  { mdStack   :: StackVars inp+  , mdObjects :: DecomposedObjects+  , mdHooks   :: GenCodeHooks+  }++data GenCodeHooks = GenCodeHooks+  { gchStmtHook      :: forall inp out . Text -> (inp :-> out) -> (inp :-> out)+  , gchAuxiliaryHook :: forall inp out . Text -> (inp :-> out) -> (inp :-> out)+  , gchExprHook      :: forall inp out . Text -> (inp :-> out) -> (inp :-> out)+  -- pva701: dunno whether this level of verbosity is needed+  --, csSubExpr    :: forall a inp out . Expr a -> (inp :-> out) -> (inp :-> out)+  }++instance Semigroup GenCodeHooks where+  GenCodeHooks a b c <> GenCodeHooks a1 b1 c1 = GenCodeHooks+    { gchStmtHook = \t cd -> a1 t (a t cd)+    , gchAuxiliaryHook = \t cd -> b1 t (b t cd)+    , gchExprHook = \t cd -> c1 t (c t cd)+    }++instance Monoid GenCodeHooks where+  mempty = emptyGenCodeHooks++emptyGenCodeHooks :: GenCodeHooks+emptyGenCodeHooks = GenCodeHooks (const id) (const id) (const id)++stmtHook :: forall inp out any . MetaData any -> Text -> (inp :-> out) -> (inp :-> out)+stmtHook MetaData{..} tx cd = (gchStmtHook mdHooks) tx cd++stmtHookState :: Text -> IndigoState inp out -> IndigoState inp out+stmtHookState tx cd = IndigoState $ \md ->+  let GenCode st c cl = usingIndigoState md cd in+  GenCode st (stmtHook md tx c) cl++auxiliaryHook :: forall inp out any . MetaData any -> Text -> (inp :-> out) -> (inp :-> out)+auxiliaryHook MetaData{..} tx cd = (gchAuxiliaryHook mdHooks) tx cd++auxiliaryHookState :: Text -> IndigoState inp out -> IndigoState inp out+auxiliaryHookState tx cd = IndigoState $ \md ->+  let GenCode st c cl = usingIndigoState md cd in+  GenCode st (auxiliaryHook md tx c) cl++exprHook :: forall inp out any . MetaData any -> Text -> (inp :-> out) -> (inp :-> out)+exprHook MetaData{..} exTx cd = (gchExprHook mdHooks) exTx cd++exprHookState :: Text -> IndigoState inp out -> IndigoState inp out+exprHookState tx cd = IndigoState $ \md ->+  let GenCode st c cl = usingIndigoState md cd in+  GenCode st (exprHook md tx c) cl+++replStkMd :: MetaData inp -> StackVars inp1 -> MetaData inp1+replStkMd md = alterStkMd md . const++alterStkMd :: MetaData inp -> (StackVars inp -> StackVars inp1) -> MetaData inp1+alterStkMd (MetaData stk objs cm) f = MetaData (f stk) objs cm++-- | 'pushRef' version for 'MetaData'+pushRefMd :: KnownValue a => Var a -> MetaData inp -> MetaData (a : inp)+pushRefMd var md = alterStkMd md (pushRef var)++-- | 'pushNoRef' version for 'MetaData'+pushNoRefMd :: KnownValue a => MetaData inp -> MetaData (a : inp)+pushNoRefMd md = alterStkMd md pushNoRef++-- | 'popNoRef' version for 'MetaData'+popNoRefMd :: MetaData (a : inp) -> MetaData inp+popNoRefMd md = alterStkMd md popNoRef++----------------------------------------------------------------------------+-- Code generation primitives+----------------------------------------------------------------------------++-- | Resulting state of IndigoM.+data GenCode inp out = GenCode+  { gcStack :: ~(StackVars out)+  -- ^ Stack of the symbolic interpreter.+  , gcCode  :: inp :-> out+  -- ^ Generated Lorentz code.+  , gcClear :: out :-> inp+  -- ^ Clearing Lorentz code.+  }++-- | Produces the generated Lorentz code that cleans after itself, leaving the+-- same stack as the input one+cleanGenCode :: GenCode inp out -> inp :-> inp+cleanGenCode GenCode {..} = gcCode ## gcClear++----------------------------------------------------------------------------+-- Helpers+----------------------------------------------------------------------------++-- | Version of '#' which performs some optimizations immediately.+--+-- In particular, this avoids glueing @Nop@s.+(##) :: (a :-> b) -> (b :-> c) -> (a :-> c)+l ## r =+  -- We are very verbose about cases to avoid+  -- significant compilation time increase+  case l of+    I M.Nop -> case r of+      I x -> I x+      _   -> l # r+    I x -> case r of+      I M.Nop -> I x+      _       -> l # r+    _ -> l # r
+ src/Indigo/Common/Var.hs view
@@ -0,0 +1,157 @@+-- SPDX-FileCopyrightText: 2021 Oxhead Alpha+-- SPDX-License-Identifier: LicenseRef-MIT-OA++-- | Datatype representing Indigo variables and utilities for working with+-- them.+module Indigo.Common.Var+  ( -- * Variables+    Var (..)+  , RefId+  , StackVars (..)+  , StackVars'+  , StkEl (..)++  -- * Stack operations+  , emptyStack+  , assignVarAt+  , pushRef+  , pushNoRef+  , popNoRef++  -- * Operations/Storage variables+  , Ops+  , HasSideEffects+  , operationsVar+  , HasStorage+  , storageVar+  ) where++import Data.Kind qualified as Kind+import Data.Reflection (Given(..))+import Data.Singletons (Sing)+import Data.Type.Equality (TestEquality(..))+import Data.Typeable (eqT)+import Fmt (Buildable(..), pretty)+import Morley.Michelson.Typed.Haskell.Value+import Morley.Util.Peano++import Indigo.Backend.Prelude+import Indigo.Lorentz++----------------------------------------------------------------------------+-- Stack and variable definition+----------------------------------------------------------------------------++-- | Reference id to a stack cell+newtype RefId = RefId Word+  deriving stock (Show, Generic)+  deriving newtype (Eq, Ord, Real, Num, Integral, Enum, Bounded)++instance Buildable RefId where+  build (RefId r) = "#ref" <> pretty r++-- | Stack element of the symbolic interpreter.+--+-- It holds either a reference index that refers to this element+-- or just 'NoRef', indicating that there are no references+-- to this element.+data StkEl a where+  NoRef :: (KnownValue a, KnownIsoT a) => StkEl a+  Ref :: (KnownValue a, KnownIsoT a) => RefId -> StkEl a++instance TestEquality StkEl where+  testEquality NoRef NoRef = eqT+  testEquality (Ref _) (Ref _) = eqT+  testEquality (Ref _) NoRef = eqT+  testEquality NoRef (Ref _) = eqT++type StackVars' stk = Rec StkEl stk++-- | Stack of the symbolic interpreter.+data StackVars (stk :: [Kind.Type]) where+  StkElements  :: Rec StkEl stk -> StackVars stk+  FailureStack :: StackVars stk++-- | A variable referring to an element in the stack.+data Var a = Var RefId+  deriving stock (Generic, Show)++instance Buildable (Var a) where+  build (Var (RefId r)) = "$var" <> pretty r++----------------------------------------------------------------------------+-- Stack operations+----------------------------------------------------------------------------++emptyStack :: StackVars '[]+emptyStack = StkElements RNil++instance Default (StackVars '[]) where+  def = emptyStack++instance (KnownValue x, Default (StackVars xs)) => Default (StackVars (x ': xs)) where+  def = case def of+    FailureStack -> error "impossible happened"+    StkElements rc -> StkElements $ NoRef :& rc++-- | Given a 'StackVars' and a @Peano@ singleton for a depth, it puts a new 'Var'+-- at that depth (0-indexed) and returns it with the updated 'StackVars'.+--+-- If there is a 'Var' there already it is used and the 'StackVars' not changed.+assignVarAt+  :: (KnownValue a, a ~ At n inp, RequireLongerThan inp n)+  => Var a+  -> StackVars inp+  -> Sing n+  -> StackVars inp+assignVarAt _ FailureStack = const $ error "You try to assing var against failure stack"+assignVarAt var@(Var varRef) st@(StkElements (top :& xs)) = \case+  SS n -> appendToStack top $ assignVarAt var (StkElements xs) n+  SZ -> case top of+    Ref mdRef | mdRef == varRef -> st+    Ref _ -> error "Tried to assign a Var to an already referenced value"+    NoRef -> StkElements $ Ref varRef :& xs+  where+    appendToStack :: StkEl x -> StackVars inp -> StackVars (x ': inp)+    appendToStack _ FailureStack = error "append to failure stack"+    appendToStack v (StkElements s) = StkElements (v :& s)++-- | Push a new stack element with a reference to it, given the variable.+pushRef :: KnownValue a => Var a -> StackVars inp -> StackVars (a : inp)+pushRef _ FailureStack = error "You try to push ref to failure stack"+pushRef (Var ref) (StkElements xs) = StkElements $ Ref ref :& xs++-- | Push a new stack element without a reference to it.+pushNoRef :: KnownValue a => StackVars inp -> StackVars (a : inp)+pushNoRef FailureStack = error "You try to push no-ref to failure stack"+pushNoRef (StkElements xs) = StkElements $ NoRef :& xs++-- | Remove the top element of the stack.+-- It's supposed that no variable refers to this element.+popNoRef :: StackVars (a : inp) -> StackVars inp+popNoRef FailureStack = error "You try to pop from failure stack"+popNoRef (StkElements (NoRef :& xs)) = StkElements xs+popNoRef (StkElements (Ref refId :& _)) =+  error $ "You try to pop stack element, which is referenced by some variable #" <> pretty refId++----------------------------------------------------------------------------+-- Operations/Storage variables+----------------------------------------------------------------------------++type Ops = [Operation]++-- | Allows to get a variable with operations+type HasSideEffects = Given (Var Ops)++-- | Return a variable which refers to a stack cell with operations+operationsVar :: HasSideEffects => Var Ops+operationsVar = given++-- This storage machinery is here to avoid cyclic deps++-- | Allows to get a variable with storage+type HasStorage st = (Given (Var st), KnownValue st)++-- | Return a variable which refers to a stack cell with storage+storageVar :: HasStorage st => Var st+storageVar = given
src/Indigo/Compilation.hs view
@@ -14,9 +14,14 @@   , compileIndigoContract   ) where -import qualified Data.Map as M+import Data.Map qualified as M import Prelude +import Indigo.Backend.Expr.Decompose (deepDecomposeCompose)+import Indigo.Common.Object (IsObject, SomeObject(SomeObject))+import Indigo.Common.SIS (SomeGenCode(SomeGenCode))+import Indigo.Common.State (GenCode(GenCode), MetaData(MetaData))+import Indigo.Common.Var import Indigo.Compilation.Field import Indigo.Compilation.Hooks   (CommentHooks(..), CommentSettings(..), CommentsVerbosity(..), defaultCommentSettings,@@ -25,10 +30,8 @@ import Indigo.Compilation.Params import Indigo.Compilation.Sequential import Indigo.Frontend.Program (IndigoContract)-import Indigo.Internal hiding (SetField, (<>), (==), (>>)) import Indigo.Lorentz-import qualified Lorentz.Instr as L-import qualified Lorentz.Macro as L+import Lorentz.Instr qualified as L  -- | Compile Indigo code to Lorentz. --@@ -76,7 +79,7 @@   => CommentSettings   -> IndigoContract param st   -> ContractCode param st-compileIndigoContractFull (settingsToHooks -> CommentHooks{..}) code =+compileIndigoContractFull (settingsToHooks -> CommentHooks{..}) code = mkContractCode $   prepare $ compileIndigoImpl @3 @'[param, st, Ops] chFrontendHooks (contractToIndigoWithParams code) $ \(block, nextRef) ->     \case       (StkElements (Ref parRef :& Ref stRef :& opsStack))  ->
src/Indigo/Compilation/Field.hs view
@@ -8,8 +8,8 @@  import Indigo.Backend.Prelude +import Indigo.Common.Var (RefId) import Indigo.Compilation.Sequential-import Indigo.Internal.Var (RefId)  optimizeFields :: (Block, RefId) -> (Block, RefId) optimizeFields = id -- TODO #279
src/Indigo/Compilation/Hooks.hs view
@@ -1,6 +1,5 @@--- SPDX-FileCopyrightText: 2020 Tocqueville Group------ SPDX-License-Identifier: LicenseRef-MIT-TQ+-- SPDX-FileCopyrightText: 2021 Oxhead Alpha+-- SPDX-License-Identifier: LicenseRef-MIT-OA  {-# LANGUAGE NoRebindableSyntax #-} @@ -16,13 +15,13 @@ import Prelude  import GHC.Stack.Types (SrcLoc(..))+import Indigo.Common.State import Indigo.Compilation.Sequential   (InstrCollector(..), Instruction(..), SequentialHooks(..), stmtHookL)-import Indigo.Internal.State import Indigo.Lorentz-import qualified Lorentz.Instr as L-import qualified Michelson.Typed.Convert as M-import qualified Michelson.Typed.Instr as M+import Lorentz.Ext qualified as L+import Morley.Michelson.Typed.Convert qualified as M+import Morley.Michelson.Typed.Instr qualified as M  --------------------------------------------- --- Comments settings
src/Indigo/Compilation/Lambda.hs view
@@ -8,11 +8,11 @@  import Prelude -import qualified Data.Map as M+import Data.Map qualified as M  import Indigo.Backend as B+import Indigo.Common.Var import Indigo.Compilation.Sequential-import Indigo.Internal.Var  -- | Collects named lambdas that are used more than once and separates them into -- a lambda creation and multiple lambda executions.@@ -110,6 +110,7 @@       CreateContract varAddr ctrc exk exm exs -> CreateContract varAddr ctrc exk exm exs       SelfCalling proxy varCR ep -> SelfCalling proxy varCR ep       ContractCalling varMcr pCp epRef exAddr -> ContractCalling varMcr pCp epRef exAddr+      Emit tag ex -> Emit tag ex        Fail failure -> Fail failure       FailOver failure ex -> FailOver failure ex@@ -172,6 +173,7 @@       CreateContract {}  -> return ()       SelfCalling {}     -> return ()       ContractCalling {} -> return ()+      Emit {}            -> return ()       Fail {}            -> return ()       FailOver {}        -> return () 
src/Indigo/Compilation/Params.hs view
@@ -1,6 +1,5 @@--- SPDX-FileCopyrightText: 2020 Tocqueville Group------ SPDX-License-Identifier: LicenseRef-MIT-TQ+-- SPDX-FileCopyrightText: 2021 Oxhead Alpha+-- SPDX-License-Identifier: LicenseRef-MIT-OA  module Indigo.Compilation.Params   ( IndigoWithParams@@ -13,10 +12,11 @@ import Data.Singletons (Sing, SingI(..))  import Indigo.Backend.Prelude-import Indigo.Frontend.Program (IndigoM, IndigoContract)-import Indigo.Internal.Var+import Indigo.Common.Var+import Indigo.Frontend.Program (IndigoContract, IndigoM) import Indigo.Lorentz-import Util.Peano+import Morley.Michelson.Typed.Contract (giveNotInView)+import Morley.Util.Peano  -- | Type of a function with @n@ 'Var' arguments and @IndigoM a@ result. --@@ -73,4 +73,4 @@   => IndigoContract param st   -> IndigoWithParams 3 '[param, st, Ops] () contractToIndigoWithParams code = \varOps varSt varParam ->-  (give varOps $ give varSt code) varParam+  (give varOps $ giveNotInView $ give varSt code) varParam
src/Indigo/Compilation/Sequential.hs view
@@ -1,6 +1,5 @@--- SPDX-FileCopyrightText: 2020 Tocqueville Group------ SPDX-License-Identifier: LicenseRef-MIT-TQ+-- SPDX-FileCopyrightText: 2021 Oxhead Alpha+-- SPDX-License-Identifier: LicenseRef-MIT-OA  -- | 'Instruction' datatype and its compilations. --@@ -38,323 +37,21 @@  import Data.Vinyl.Core (RMap(..)) -import Lens.Micro.TH (makeLensesFor)-import Lorentz.Entrypoints.Helpers (RequireSumType)-import qualified Lorentz.Run as L (Contract)-import Michelson.Typed.Haskell.Instr.Sum (CaseClauseParam(..), CtorField(..))-import Util.TypeLits (AppendSymbol)- import Indigo.Backend-import Indigo.Frontend.Program-import qualified Indigo.Frontend.Statement as S-import Indigo.Internal (Expr, HasField)-import Indigo.Internal.Object (IsObject)-import Indigo.Internal.SIS-import Indigo.Internal.State hiding ((>>))-import qualified Indigo.Internal.State as St-import Indigo.Internal.Var-import Indigo.Lorentz-import qualified Michelson.Typed as MT---- | Simple synonym for a list of 'Instruction'-type Block = [Instruction]---- | Data type representing an instruction.------ Differently from the frontend this is not used to build a Monad of some kind,--- it is instead based on having as argument the variable to associate with the--- resulting value (if any).------ This is combined in simple lists, named 'Block', and it is intended to be--- easily altered, this is because these are used as the intermediate representation--- between the frontend and the backend, where optimizations can occur.-data Instruction where-  LiftIndigoState :: (forall inp. SomeIndigoState inp) -> Instruction-  Comment :: Text -> Instruction--  AssignVar :: KnownValue x => Var x -> Expr x -> Instruction-  SetVar :: KnownValue x => Var x -> Expr x -> Instruction-  VarModification-    :: (IsObject x, KnownValue y)-    => [y, x] :-> '[x]-    -> Var x-    -> Expr y-    -> Instruction-  SetField-    :: ( HasField store fname ftype-       , IsObject store-       , IsObject ftype-       )-    => Var store -> Label fname -> Expr ftype -> Instruction--  LambdaCall1-    :: LambdaKind st arg ret extra-    -- ^ Kind of lambda (pure, storage modification, fully functional lambda with effects)-    -> String-    -- ^ Name of the lambda-    -> Expr arg-    -- ^ Expression for the lambda argument-    -> Var arg-    -- ^ Variable for the argument value (available to the lambda code block)-    -> Block-    -- ^ Code block for the lambda-    -> ret-    -- ^ Return value(s) of the lambda-    -> RetVars ret-    -- ^ Variable(s) that will be assigned to the resulting value(s)-    -> Instruction--  CreateLambda1-    :: CreateLambda1CGeneric extra arg ret-    => StackVars (arg : extra)-    -- ^ Initial 'StackVars' to be used in the lambda code-    -> Var arg-    -- ^ Variable for the argument value (available to the lambda code block)-    -> Block-    -- ^ Code block for the lambda-    -> ret-    -- ^ Return value(s) of the lambda-    -> Var (Lambda1Generic extra arg ret)-    -- ^ Variable that will be assigned to the resulting lambda-    -> Instruction--  ExecLambda1-    :: LambdaKind st arg ret extra-    -> Proxy ret-    -> Expr arg-    -- ^ Expression for the lambda argument-    -> Var (Lambda1Generic extra arg ret)-    -- ^ Variable of the lambda to be executed-    -> RetVars ret-    -- ^ Variable(s) that will be assigned to the resulting value(s)-    -> Instruction--  Scope-    :: ScopeCodeGen ret-    => Block-    -- ^ Code block to execute inside the scope-    -> ret-    -- ^ Return value(s) of the scoped code block-    -> RetVars ret-    -- ^ Variable that will be assigned to the resulting value(s)-    -> Instruction-  If-    :: IfConstraint a b-    => Expr Bool-    -- ^ Expression for the control flow-    -> Block-    -- ^ Code block for the positive branch-    -> a-    -- ^ Return value(s) of the positive branch-    -> Block-    -- ^ Code block for the negative branch-    -> b-    -- ^ Return value(s) of the negative branch-    -> RetVars a-    -- ^ Variable(s) that will be assigned to the resulting value(s)-    -> Instruction-  IfSome-    :: (IfConstraint a b, KnownValue x)-    => Expr (Maybe x)-    -- ^ Expression for the control flow-    -> Var x-    -- ^ Variable for the 'Just' value (available to the next code block)-    -> Block-    -- ^ Code block for the 'Just' branch-    -> a-    -- ^ Return value(s) of the 'Just' branch-    -> Block-    -- ^ Code block for the 'Nothing' branch-    -> b-    -- ^ Return value(s) of the 'Nothing' branch-    -> RetVars a-    -- ^ Variable(s) that will be assigned to the resulting value(s)-    -> Instruction-  IfRight-    :: (IfConstraint a b, KnownValue r, KnownValue l)-    => Expr (Either l r)-    -- ^ Expression for the control flow-    -> Var r-    -- ^ Variable for the 'Right' value (available to the next code block)-    -> Block-    -- ^ Code block for the 'Right' branch-    -> a-    -- ^ Return value(s) of the 'Right' branch-    -> Var l-    -- ^ Variable for the 'Left' value (available to the next code block)-    -> Block-    -- ^ Code block for the 'Left' branch-    -> b-    -- ^ Return value(s) of the 'Left' branch-    -> RetVars a-    -- ^ Variable(s) that will be assigned to the resulting value(s)-    -> Instruction-  IfCons-    :: (IfConstraint a b, KnownValue x)-    => Expr (List x)-    -- ^ Expression for the control flow-    -> Var x-    -- ^ Variable for the "head" value (available to the next code block)-    -> Var (List x)-    -- ^ Variable for the "tail" value (available to the next code block)-    -> Block-    -- ^ Code block for the non-empty list branch-    -> a-    -- ^ Return value(s) of the non-empty list branch-    -> Block-    -- ^ Code block for the empty list branch-    -> b-    -- ^ Return value(s) of the empty list branch-    -> RetVars a-    -- ^ Variable(s) that will be assigned to the resulting value(s)-    -> Instruction--  Case-    :: CaseCommon dt ret clauses-    => Expr dt-    -> clauses-    -> RetVars ret-    -- ^ Variable(s) that will be assigned to the resulting value(s)-    -> Instruction-  EntryCase-    :: ( CaseCommon dt ret clauses-       , DocumentEntrypoints entryPointKind dt-       )-    => Proxy entryPointKind-    -> Expr dt-    -> clauses-    -> RetVars ret-    -- ^ Variable(s) that will be assigned to the resulting value(s)-    -> Instruction-  EntryCaseSimple-    :: ( CaseCommon dt ret clauses-       , DocumentEntrypoints PlainEntrypointsKind dt-       , NiceParameterFull dt-       , RequireFlatParamEps dt-       )-    => Expr dt-    -> clauses-    -> RetVars ret-    -- ^ Variable(s) that will be assigned to the resulting value(s)-    -> Instruction--  While-    :: Expr Bool-    -- ^ Expression for the control flow-    -> Block-    -- ^ Block of code to execute, as long as the expression holds 'True'-    -> Instruction-  WhileLeft-    :: (KnownValue l, KnownValue r)-    => Expr (Either l r)-    -- ^ Expression for the control flow value-    -> Var l-    -- ^ Variable for the 'Left' value (available to the code block)-    -> Block-    -- ^ Code block to execute while the value is 'Left'-    -> Var r-    -- ^ Variable that will be assigned to the resulting value-    -> Instruction-  ForEach-    :: (IterOpHs a, KnownValue (IterOpElHs a))-    => Expr a-    -- ^ Expression for the container to traverse-    -> Var (IterOpElHs a)-    -- ^ Variable for the current item (available to the code block)-    -> Block-    -- ^ Code block to execute over each element of the container-    -> Instruction--  ContractName-    :: Text-    -> Block-    -> Instruction-  DocGroup-    :: forall di. DocItem di-    => (SubDoc -> di)-    -> Block-    -> Instruction-  ContractGeneral-    :: Block-    -> Instruction-  FinalizeParamCallingDoc-    :: (NiceParameterFull cp, RequireSumType cp)-    => Var cp-    -> Block-    -> Expr cp-    -> Instruction--  TransferTokens-    :: (NiceParameter p, HasSideEffects)-    => Expr p-    -> Expr Mutez-    -> Expr (ContractRef p)-    -> Instruction-  SetDelegate-    :: HasSideEffects-    => Expr (Maybe KeyHash)-    -> Instruction--  CreateContract-    :: (HasSideEffects, NiceStorage s, NiceParameterFull p)-    => L.Contract p s-    -> Expr (Maybe KeyHash)-    -> Expr Mutez-    -> Expr s-    -> Var Address-    -- ^ Variable that will be assigned to the resulting 'Address'-    -> Instruction-  SelfCalling-    :: ( NiceParameterFull p-       , KnownValue (GetEntrypointArgCustom p mname)-       )-    => Proxy p-    -> EntrypointRef mname-    -> Var (ContractRef (GetEntrypointArgCustom p mname))-    -- ^ Variable that will be assigned to the resulting 'ContractRef'-    -> Instruction-  ContractCalling-    :: ( HasEntrypointArg cp epRef epArg-       , ToTAddress cp addr-       , ToT addr ~ ToT Address-       , KnownValue epArg-       )-    => Proxy cp-    -> epRef-    -> Expr addr-    -> Var (Maybe (ContractRef epArg))-    -- ^ Variable that will be assigned to the resulting 'ContractRef'-    -> Instruction--  Fail-    :: (forall inp. SomeIndigoState inp)-    -> Instruction-  FailOver-    :: (forall inp. Expr a -> SomeIndigoState inp)-    -> Expr a-    -> Instruction+import Indigo.Common.SIS+import Indigo.Common.State hiding ((>>))+import Indigo.Common.State qualified as St+import Indigo.Common.Var+import Indigo.Compilation.Sequential.Types+import Indigo.Frontend.Internal.Statement qualified as S+import Indigo.Frontend.Program (IndigoM(..), interpretProgram)+import Indigo.Lorentz hiding (comment)+import Morley.Michelson.Typed qualified as MT  ---------------------------------------------------------------------------- -- Translations ---------------------------------------------------------------------------- --- | Data type internally used to collect 'Instruction's from 'IndigoM'-data InstrCollector = InstrCollector-  { nextRef   :: RefId-  , instrList :: Block-  , seqHooks  :: SequentialHooks-  }--newtype SequentialHooks = SequentialHooks {-    shStmtHook    :: CallStack -> Block -> State InstrCollector ()-  }--instance Semigroup SequentialHooks where-  SequentialHooks s <> SequentialHooks s1 = SequentialHooks (\t -> s t >> s1 t)--instance Monoid SequentialHooks where-  mempty = SequentialHooks (const $ appendNewInstrs . reverse)- -- | Transformation from 'IndigoM' to a 'Block' of 'Instruction's. -- -- Requires the first non-used 'RefId' and returns the next one.@@ -493,6 +190,8 @@     varMcr <- mkNextVar     appendNewInstr $ ContractCalling proxy epRef exAddr varMcr     return varMcr+  S.Emit tag ex ->+    appendNewInstr $ Emit tag ex    S.Fail (_ :: Proxy ret) failure -> do     appendNewInstr $ Fail failure@@ -527,9 +226,6 @@ appendNewInstr :: Instruction -> State InstrCollector () appendNewInstr is = modify $ \iColl -> iColl {instrList = is : instrList iColl} -appendNewInstrs :: Block -> State InstrCollector ()-appendNewInstrs blk = modify $ \iColl -> iColl {instrList = blk ++ instrList iColl}- -- | Creates a new var. This simply advances the ref counter and updates it. mkNextVar :: State InstrCollector (Var a) mkNextVar = do@@ -611,8 +307,10 @@     toSIS $ createContract ctrc exk exm exs varAddr   SelfCalling (Proxy :: Proxy p) ep varCR ->     toSIS $ selfCalling @p ep varCR-  ContractCalling (Proxy :: Proxy cp) epRef exAddr varMcr ->-    toSIS $ contractCalling @cp epRef exAddr varMcr+  ContractCalling (Proxy :: Proxy (cp, vd)) epRef exAddr varMcr ->+    toSIS $ contractCalling @cp @vd epRef exAddr varMcr+  Emit tag ex ->+    toSIS $ emit tag ex    Fail failure -> failure   FailOver failure ex -> failure ex@@ -621,33 +319,6 @@ -- Case machinery ---------------------------------------------------------------------------- --- | Common constraint for case-like 'Instruction's.-type CaseCommon dt ret clauses = CaseCommonF IndigoSeqCaseClause dt ret clauses---- | Analogous datatype as 'IndigoCaseClauseL' and 'IndigoMCaseClauseL'.-data IndigoSeqCaseClause ret (param :: CaseClauseParam) where-  OneFieldIndigoSeqCaseClause-    :: (AppendSymbol "c" ctor ~ name)-    => Label name-    -> CaseBranch x ret-    -> IndigoSeqCaseClause ret ('CaseClauseParam ctor ('OneField x))---- | Representation of a branch of a generic case-like 'Instruction'.-data CaseBranch x ret where-  CaseBranch-    :: ( KnownValue x-       , ScopeCodeGen retBr-       , ret ~ RetExprs retBr-       , RetOutStack ret ~ RetOutStack retBr-       )-    => Var x-    -- ^ Input variable (accessible to the branch's code block)-    -> Block-    -- ^ Code block for this branch-    -> retBr-    -- ^ Return value of this branch-    -> CaseBranch x ret- -- | Convert clauses from their "sequential" representation to the "backend" one. clausesToBackend   :: forall ret dt . RMap dt@@ -696,5 +367,3 @@ mapMClauses f (x :& xs) = case x of   OneFieldIndigoSeqCaseClause _cName (CaseBranch _ block _) ->     f block >> mapMClauses f xs--makeLensesFor [ ("shStmtHook", "stmtHookL")] ''SequentialHooks
+ src/Indigo/Compilation/Sequential/Types.hs view
@@ -0,0 +1,373 @@+-- SPDX-FileCopyrightText: 2021 Oxhead Alpha+-- SPDX-License-Identifier: LicenseRef-MIT-OA++-- | 'Instruction' datatype.+module Indigo.Compilation.Sequential.Types+  ( Block+  , Instruction (..)++  , IndigoSeqCaseClause (..)+  , CaseBranch (..)++  -- * Translations+  , SequentialHooks (..)+  , InstrCollector (..)+  , stmtHookL+  ) where++import Prelude++import Lens.Micro.TH (makeLensesFor)+import Lorentz.Entrypoints.Helpers (RequireSumType)+import Lorentz.Run qualified as L (Contract)+import Morley.Michelson.Typed.Haskell.Instr.Sum (CaseClauseParam(..), CtorField(..))+import Morley.Michelson.Untyped.Annotation (FieldAnn)+import Morley.Util.TypeLits (AppendSymbol)++import Indigo.Backend+import Indigo.Common.Expr (Expr)+import Indigo.Common.Field (HasField)+import Indigo.Common.SIS+import Indigo.Common.Var+import Indigo.Lorentz hiding (comment)++-- | Simple synonym for a list of 'Instruction'+type Block = [Instruction]++-- | Data type representing an instruction.+--+-- Differently from the frontend this is not used to build a Monad of some kind,+-- it is instead based on having as argument the variable to associate with the+-- resulting value (if any).+--+-- This is combined in simple lists, named 'Block', and it is intended to be+-- easily altered, this is because these are used as the intermediate representation+-- between the frontend and the backend, where optimizations can occur.+data Instruction where+  LiftIndigoState :: (forall inp. SomeIndigoState inp) -> Instruction+  Comment :: Text -> Instruction++  AssignVar :: KnownValue x => Var x -> Expr x -> Instruction+  SetVar :: KnownValue x => Var x -> Expr x -> Instruction+  VarModification+    :: (IsObject x, KnownValue y)+    => [y, x] :-> '[x]+    -> Var x+    -> Expr y+    -> Instruction+  SetField+    :: ( HasField store fname ftype+       , IsObject store+       , IsObject ftype+       )+    => Var store -> Label fname -> Expr ftype -> Instruction++  LambdaCall1+    :: LambdaKind st arg ret extra+    -- ^ Kind of lambda (pure, storage modification, fully functional lambda with effects)+    -> String+    -- ^ Name of the lambda+    -> Expr arg+    -- ^ Expression for the lambda argument+    -> Var arg+    -- ^ Variable for the argument value (available to the lambda code block)+    -> Block+    -- ^ Code block for the lambda+    -> ret+    -- ^ Return value(s) of the lambda+    -> RetVars ret+    -- ^ Variable(s) that will be assigned to the resulting value(s)+    -> Instruction++  CreateLambda1+    :: CreateLambda1CGeneric extra arg ret+    => StackVars (arg : extra)+    -- ^ Initial 'StackVars' to be used in the lambda code+    -> Var arg+    -- ^ Variable for the argument value (available to the lambda code block)+    -> Block+    -- ^ Code block for the lambda+    -> ret+    -- ^ Return value(s) of the lambda+    -> Var (Lambda1Generic extra arg ret)+    -- ^ Variable that will be assigned to the resulting lambda+    -> Instruction++  ExecLambda1+    :: LambdaKind st arg ret extra+    -> Proxy ret+    -> Expr arg+    -- ^ Expression for the lambda argument+    -> Var (Lambda1Generic extra arg ret)+    -- ^ Variable of the lambda to be executed+    -> RetVars ret+    -- ^ Variable(s) that will be assigned to the resulting value(s)+    -> Instruction++  Scope+    :: ScopeCodeGen ret+    => Block+    -- ^ Code block to execute inside the scope+    -> ret+    -- ^ Return value(s) of the scoped code block+    -> RetVars ret+    -- ^ Variable that will be assigned to the resulting value(s)+    -> Instruction+  If+    :: IfConstraint a b+    => Expr Bool+    -- ^ Expression for the control flow+    -> Block+    -- ^ Code block for the positive branch+    -> a+    -- ^ Return value(s) of the positive branch+    -> Block+    -- ^ Code block for the negative branch+    -> b+    -- ^ Return value(s) of the negative branch+    -> RetVars a+    -- ^ Variable(s) that will be assigned to the resulting value(s)+    -> Instruction+  IfSome+    :: (IfConstraint a b, KnownValue x)+    => Expr (Maybe x)+    -- ^ Expression for the control flow+    -> Var x+    -- ^ Variable for the 'Just' value (available to the next code block)+    -> Block+    -- ^ Code block for the 'Just' branch+    -> a+    -- ^ Return value(s) of the 'Just' branch+    -> Block+    -- ^ Code block for the 'Nothing' branch+    -> b+    -- ^ Return value(s) of the 'Nothing' branch+    -> RetVars a+    -- ^ Variable(s) that will be assigned to the resulting value(s)+    -> Instruction+  IfRight+    :: (IfConstraint a b, KnownValue r, KnownValue l)+    => Expr (Either l r)+    -- ^ Expression for the control flow+    -> Var r+    -- ^ Variable for the 'Right' value (available to the next code block)+    -> Block+    -- ^ Code block for the 'Right' branch+    -> a+    -- ^ Return value(s) of the 'Right' branch+    -> Var l+    -- ^ Variable for the 'Left' value (available to the next code block)+    -> Block+    -- ^ Code block for the 'Left' branch+    -> b+    -- ^ Return value(s) of the 'Left' branch+    -> RetVars a+    -- ^ Variable(s) that will be assigned to the resulting value(s)+    -> Instruction+  IfCons+    :: (IfConstraint a b, KnownValue x)+    => Expr (List x)+    -- ^ Expression for the control flow+    -> Var x+    -- ^ Variable for the "head" value (available to the next code block)+    -> Var (List x)+    -- ^ Variable for the "tail" value (available to the next code block)+    -> Block+    -- ^ Code block for the non-empty list branch+    -> a+    -- ^ Return value(s) of the non-empty list branch+    -> Block+    -- ^ Code block for the empty list branch+    -> b+    -- ^ Return value(s) of the empty list branch+    -> RetVars a+    -- ^ Variable(s) that will be assigned to the resulting value(s)+    -> Instruction++  Case+    :: CaseCommon dt ret clauses+    => Expr dt+    -> clauses+    -> RetVars ret+    -- ^ Variable(s) that will be assigned to the resulting value(s)+    -> Instruction+  EntryCase+    :: ( CaseCommon dt ret clauses+       , DocumentEntrypoints entryPointKind dt+       )+    => Proxy entryPointKind+    -> Expr dt+    -> clauses+    -> RetVars ret+    -- ^ Variable(s) that will be assigned to the resulting value(s)+    -> Instruction+  EntryCaseSimple+    :: ( CaseCommon dt ret clauses+       , DocumentEntrypoints PlainEntrypointsKind dt+       , NiceParameterFull dt+       , RequireFlatParamEps dt+       )+    => Expr dt+    -> clauses+    -> RetVars ret+    -- ^ Variable(s) that will be assigned to the resulting value(s)+    -> Instruction++  While+    :: Expr Bool+    -- ^ Expression for the control flow+    -> Block+    -- ^ Block of code to execute, as long as the expression holds 'True'+    -> Instruction+  WhileLeft+    :: (KnownValue l, KnownValue r)+    => Expr (Either l r)+    -- ^ Expression for the control flow value+    -> Var l+    -- ^ Variable for the 'Left' value (available to the code block)+    -> Block+    -- ^ Code block to execute while the value is 'Left'+    -> Var r+    -- ^ Variable that will be assigned to the resulting value+    -> Instruction+  ForEach+    :: (IterOpHs a, KnownValue (IterOpElHs a))+    => Expr a+    -- ^ Expression for the container to traverse+    -> Var (IterOpElHs a)+    -- ^ Variable for the current item (available to the code block)+    -> Block+    -- ^ Code block to execute over each element of the container+    -> Instruction++  ContractName+    :: Text+    -> Block+    -> Instruction+  DocGroup+    :: forall di. DocItem di+    => (SubDoc -> di)+    -> Block+    -> Instruction+  ContractGeneral+    :: Block+    -> Instruction+  FinalizeParamCallingDoc+    :: (NiceParameterFull cp, RequireSumType cp)+    => Var cp+    -> Block+    -> Expr cp+    -> Instruction++  TransferTokens+    :: (NiceParameter p, HasSideEffects, IsNotInView)+    => Expr p+    -> Expr Mutez+    -> Expr (ContractRef p)+    -> Instruction+  SetDelegate+    :: (HasSideEffects, IsNotInView)+    => Expr (Maybe KeyHash)+    -> Instruction++  CreateContract+    :: ( HasSideEffects, NiceStorage s, NiceParameterFull p+       , NiceViewsDescriptor vd, Typeable vd, IsNotInView+       )+    => L.Contract p s vd+    -> Expr (Maybe KeyHash)+    -> Expr Mutez+    -> Expr s+    -> Var Address+    -- ^ Variable that will be assigned to the resulting 'Address'+    -> Instruction+  SelfCalling+    :: ( NiceParameterFull p+       , KnownValue (GetEntrypointArgCustom p mname)+       , IsoValue (ContractRef (GetEntrypointArgCustom p mname))+       , IsNotInView+       )+    => Proxy p+    -> EntrypointRef mname+    -> Var (ContractRef (GetEntrypointArgCustom p mname))+    -- ^ Variable that will be assigned to the resulting 'ContractRef'+    -> Instruction+  ContractCalling+    :: ( HasEntrypointArg cp epRef epArg+       , ToTAddress cp vd addr+       , ToT addr ~ ToT Address+       , KnownValue epArg+       , IsoValue (ContractRef epArg)+       )+    => Proxy (cp, vd)+    -> epRef+    -> Expr addr+    -> Var (Maybe (ContractRef epArg))+    -- ^ Variable that will be assigned to the resulting 'ContractRef'+    -> Instruction+  Emit :: (HasSideEffects, NicePackedValue a, HasAnnotation a) => FieldAnn -> Expr a -> Instruction++  Fail+    :: (forall inp. SomeIndigoState inp)+    -> Instruction+  FailOver+    :: (forall inp. Expr a -> SomeIndigoState inp)+    -> Expr a+    -> Instruction++----------------------------------------------------------------------------+-- Translations+----------------------------------------------------------------------------++-- | Data type internally used to collect 'Instruction's from 'IndigoM'+data InstrCollector = InstrCollector+  { nextRef   :: RefId+  , instrList :: Block+  , seqHooks  :: SequentialHooks+  }++newtype SequentialHooks = SequentialHooks {+    shStmtHook    :: CallStack -> Block -> State InstrCollector ()+  }++instance Semigroup SequentialHooks where+  SequentialHooks s <> SequentialHooks s1 = SequentialHooks (\t -> s t >> s1 t)++instance Monoid SequentialHooks where+  mempty = SequentialHooks (const $ appendNewInstrs . reverse)++appendNewInstrs :: Block -> State InstrCollector ()+appendNewInstrs blk = modify $ \iColl -> iColl {instrList = blk ++ instrList iColl}++----------------------------------------------------------------------------+-- Case machinery+----------------------------------------------------------------------------++-- | Common constraint for case-like 'Instruction's.+type CaseCommon dt ret clauses = CaseCommonF IndigoSeqCaseClause dt ret clauses++-- | Analogous datatype as 'IndigoCaseClauseL' and 'IndigoMCaseClauseL'.+data IndigoSeqCaseClause ret (param :: CaseClauseParam) where+  OneFieldIndigoSeqCaseClause+    :: (AppendSymbol "c" ctor ~ name)+    => Label name+    -> CaseBranch x ret+    -> IndigoSeqCaseClause ret ('CaseClauseParam ctor ('OneField x))++-- | Representation of a branch of a generic case-like 'Instruction'.+data CaseBranch x ret where+  CaseBranch+    :: ( KnownValue x+       , ScopeCodeGen retBr+       , ret ~ RetExprs retBr+       , RetOutStack ret ~ RetOutStack retBr+       )+    => Var x+    -- ^ Input variable (accessible to the branch's code block)+    -> Block+    -- ^ Code block for this branch+    -> retBr+    -- ^ Return value of this branch+    -> CaseBranch x ret++makeLensesFor [ ("shStmtHook", "stmtHookL")] ''SequentialHooks
src/Indigo/Frontend.hs view
@@ -2,9 +2,18 @@ -- -- SPDX-License-Identifier: LicenseRef-MIT-TQ +-- | Indigo compiler front-end.+--+-- For reference, "front-end" refers to the part of the compiler pipeline+-- that comes before the intermediate representation. In our case, intermediate+-- representation is defined in "Indigo.Frontend.Internal.Statement".+--+-- This module exports the syntactical constructs of the Indigo language,+-- along with the required types. module Indigo.Frontend   ( module ReExports   ) where +import Indigo.Frontend.Expr as ReExports import Indigo.Frontend.Language as ReExports import Indigo.Frontend.Program as ReExports
+ src/Indigo/Frontend/Expr.hs view
@@ -0,0 +1,883 @@+-- SPDX-FileCopyrightText: 2021 Oxhead Alpha+-- SPDX-License-Identifier: LicenseRef-MIT-OA++-- | All the basic 'Expr'essions used in Indigo code.+--+-- Note: infix operators acting on structure follow a naming convention:+--+-- 1. the last character identifies the structure type:+--+--      - @:@ for containers ('Map', 'BigMap', 'Set', 'List')+--      - @\@@ for storage operations (@MEM@, @GET@, @UPDATE@)+--      - @!@ for 'HasField'+--      - @~@ fot 'Util.Named'+--+-- 2. the preceding characters identify the action:+--+--      - @#@ for get, lookup or from+--      - @!@ for set, update or to+--      - @+@ for insert+--      - @++@ for insertNew+--      - @-@ for remove+--      - @?@ for mem or elem+--+-- The only exception to this convention is '(.:)' (for 'cons')++module Indigo.Frontend.Expr+  ( -- * Basic+    constExpr, varExpr, cast++  -- * Math+  , add, sub, mul, div, mod, neg, abs, even, odd+  , (+), (-), (*), (/), (%)++  -- * Comparison+  , eq, neq, lt, gt, le, ge+  , (==), (/=), (<), (>), (<=), (>=)++  -- * Conversion+  , isNat, toInt, nonZero, coerce, forcedCoerce++  -- * Bits and boolean+  , lsl, lsr, and, or, xor, not+  , (<<<), (>>>), (&&), (||), (^)++  -- * Serialization+  , pack, unpack+  , packRaw, unpackRaw++  -- * Pairs+  , pair, car, cdr, fst, snd++  -- * Maybe+  , some, none++  -- * Either+  , right, left++  -- * Bytes and string+  , slice, concat, (<>)++  -- * List+  , concatAll, nil, cons, (.:)++  -- * Containers+  , get, update, insert, remove, mem, size+  , (#:), (!:), (+:), (-:), (?:)+  , empty, emptyBigMap, emptyMap, emptySet++  -- * Storages+  , stGet, stUpdate, stInsert, stInsertNew, stDelete, stMem+  , (#@), (!@), (+@), (++@), (-@), (?@)++  -- * Sum types+  , wrap, unwrap++  -- * HasField+  , (!!), (#!)++  -- * Record and Named+  , name, unName, (!~), (#~)+  , construct, constructRec++  -- * Contract+  , contract+  , self+  , selfAddress+  , contractAddress+  , contractCallingUnsafe+  , contractCallingString+  , runFutureContract+  , implicitAccount+  , convertEpAddressToContract+  , makeView+  , makeVoid++  -- * Auxiliary+  , now+  , amount+  , sender+  , blake2b+  , sha256+  , sha512+  , sha3+  , keccak+  , hashKey+  , chainId+  , balance+  , level+  , votingPower+  , totalVotingPower+  , checkSignature+  ) where++import Data.Vinyl.Core (RMap(..), RecordToList(..))+import Fmt (Buildable)++import Indigo.Backend.Prelude (fromInteger)+import Indigo.Common.Expr+import Indigo.Common.Field+import Indigo.Common.Var (Var)+import Indigo.Lorentz hiding (forcedCoerce)+import Indigo.Prelude+import Morley.Michelson.Text (unMText)+import Morley.Michelson.Typed.Arith qualified as M+import Morley.Michelson.Typed.Haskell.Instr.Sum (CtorOnlyField, InstrUnwrapC, InstrWrapOneC)+import Morley.Michelson.Untyped.Entrypoints (buildEpName)+import Morley.Util.TypeTuple++----------------------------------------------------------------------------+-- Basic+----------------------------------------------------------------------------++constExpr :: forall a . NiceConstant a => a -> Expr a+constExpr a = C a++-- | Create an expression holding a variable.+varExpr :: KnownValue a => Var a -> Expr a+varExpr = V++cast :: (ex :~> a) => ex -> Expr a+cast = Cast . toExpr++----------------------------------------------------------------------------+-- Math+----------------------------------------------------------------------------++infixl 6 ++add, (+)+  :: IsArithExpr exN exM M.Add n m r+  => exN -> exM+  -> Expr r+add n m = Add (toExpr n) (toExpr m)+(+) = add++infixl 6 -+sub, (-)+  :: IsArithExpr exN exM M.Sub n m r+  => exN -> exM+  -> Expr r+sub n m = Sub (toExpr n) (toExpr m)+(-) = sub++infixl 7 *+mul, (*)+  :: IsArithExpr exN exM M.Mul n m r+  => exN -> exM+  -> Expr r+mul n m = Mul (toExpr n) (toExpr m)+(*) = mul++infixl 7 /+div, (/)+  :: forall reminder exN exM n m ratio. IsDivExpr exN exM n m ratio reminder+  => exN -> exM+  -> Expr ratio+div n m = Div (toExpr n) (toExpr m) (Proxy :: Proxy reminder)+(/) = div @reminder++infixl 7 %+mod, (%)+  :: forall ratio exN exM n m reminder. IsModExpr exN exM n m ratio reminder+  => exN -> exM+  -> Expr reminder+mod n m = Mod (toExpr n) (toExpr m) (Proxy :: Proxy ratio)+(%) = mod @ratio++abs+  :: IsUnaryArithExpr exN M.Abs n+  => exN+  -> Expr (UnaryArithResHs M.Abs n)+abs = Abs . toExpr++neg+  :: IsUnaryArithExpr exN M.Neg n+  => exN+  -> Expr (UnaryArithResHs M.Neg n)+neg = Neg . toExpr++class ParityExpr n m where+  even :: (ArithOpHs M.EDiv n m r, exN :~> n) => exN -> Expr Bool+  odd  :: (ArithOpHs M.EDiv n m r, exN :~> n) => exN -> Expr Bool++instance ParityExpr Integer Integer where+  even = eq (0 :: Natural) . (`mod` (2 :: Natural))+  odd = neq (0 :: Natural) . (`mod` (2 :: Natural))++instance ParityExpr Natural Natural where+  even = eq (0 :: Natural) . (`mod` (2 :: Natural))+  odd = neq (0 :: Natural) . (`mod` (2 :: Natural))++instance ParityExpr Mutez Mutez where+  even = eq zeroMutez . (`mod` [tz|2u|])+  odd = neq zeroMutez . (`mod` [tz|2u|])++----------------------------------------------------------------------------+-- Comparison+----------------------------------------------------------------------------++infix 4 ==+eq, (==)+  :: (NiceComparable n, c :~> n, c1 :~> n)+  => c -> c1+  -> Expr Bool+eq a b = Eq' (toExpr a) (toExpr b)+(==) = eq++infix 4 /=+neq, (/=)+  :: (NiceComparable n, c :~> n, c1 :~> n)+  => c -> c1+  -> Expr Bool+neq a b = Neq (toExpr a) (toExpr b)+(/=) = neq++infix 4 <+lt, (<)+  :: (NiceComparable n, c :~> n, c1 :~> n)+  => c -> c1+  -> Expr Bool+lt a b = Lt (toExpr a) (toExpr b)+(<) = lt++infix 4 >+gt, (>)+  :: (NiceComparable n, c :~> n, c1 :~> n)+  => c -> c1+  -> Expr Bool+gt a b = Gt (toExpr a) (toExpr b)+(>) = gt++infix 4 <=+le, (<=)+  :: (NiceComparable n, c :~> n, c1 :~> n)+  => c -> c1+  -> Expr Bool+le a b = Le (toExpr a) (toExpr b)+(<=) = le++infix 4 >=+ge, (>=)+  :: (NiceComparable n, c :~> n, c1 :~> n)+  => c -> c1+  -> Expr Bool+ge a b = Ge (toExpr a) (toExpr b)+(>=) = ge++----------------------------------------------------------------------------+-- Conversion+----------------------------------------------------------------------------++isNat :: (ex :~> Integer) => ex -> Expr (Maybe Natural)+isNat = IsNat . toExpr++toInt :: (ex :~> Natural) => ex -> Expr Integer+toInt = Int' . toExpr++nonZero :: (ex :~> n, NonZero n, KnownValue (Maybe n)) => ex -> Expr (Maybe n)+nonZero = NonZero . toExpr++-- | Convert between types that have the same Michelson representation and an+-- explicit permission for that in the face of 'CanCastTo' constraint.+coerce :: forall b a ex. (Castable_ a b, KnownValue b, ex :~> a) => ex -> Expr b+coerce = Coerce . toExpr++-- | Convert between expressions of types that have the same Michelson+-- representation.+forcedCoerce+  :: forall b a ex. (MichelsonCoercible a b, KnownValue b, ex :~> a)+  => ex -> Expr b+forcedCoerce = ForcedCoerce . toExpr++----------------------------------------------------------------------------+-- Bits and boolean+----------------------------------------------------------------------------++infixl 8 <<<+lsl, (<<<)+  :: IsArithExpr exN exM M.Lsl n m r+  => exN -> exM+  -> Expr r+lsl a b = Lsl (toExpr a) (toExpr b)+(<<<) = lsl++infixl 8 >>>+lsr, (>>>)+  :: IsArithExpr exN exM M.Lsr n m r+  => exN -> exM+  -> Expr r+lsr a b = Lsr (toExpr a) (toExpr b)+(>>>) = lsr++infixr 2 ||+or, (||)+  :: IsArithExpr exN exM M.Or n m r+  => exN -> exM+  -> Expr r+or a b = Or (toExpr a) (toExpr b)+(||) = or++infixr 3 &&+and, (&&)+  :: IsArithExpr exN exM M.And n m r+  => exN -> exM+  -> Expr r+and a b = And (toExpr a) (toExpr b)+(&&) = and++infixr 2 ^+xor, (^)+  :: IsArithExpr exN exM M.Xor n m r+  => exN -> exM+  -> Expr r+xor a b = Xor (toExpr a) (toExpr b)+(^) = xor++not+  :: IsUnaryArithExpr exN M.Not n+  => exN+  -> Expr (UnaryArithResHs M.Not n)+not = Not . toExpr++----------------------------------------------------------------------------+-- Serialization+----------------------------------------------------------------------------++pack :: (ex :~> a, NicePackedValue a) => ex -> Expr (Packed a)+pack = Pack . toExpr++unpack :: (NiceUnpackedValue a, exb :~> Packed a) => exb -> Expr (Maybe a)+unpack = Unpack . toExpr++packRaw :: (ex :~> a, NicePackedValue a) => ex -> Expr ByteString+packRaw = PackRaw . toExpr++unpackRaw :: (NiceUnpackedValue a, exb :~> ByteString) => exb -> Expr (Maybe a)+unpackRaw = UnpackRaw . toExpr++----------------------------------------------------------------------------+-- Pairs+----------------------------------------------------------------------------++pair :: (ex1 :~> n, ex2 :~> m, KnownValue (n, m)) => ex1 -> ex2 -> Expr (n, m)+pair a b = Pair (toExpr a) (toExpr b)++car, fst :: (op :~> (n, m), KnownValue n) => op -> Expr n+car = fst+fst = Fst . toExpr++cdr, snd :: (op :~> (n, m), KnownValue m) => op -> Expr m+cdr = snd+snd = Snd . toExpr++----------------------------------------------------------------------------+-- Maybe+----------------------------------------------------------------------------++some :: (ex :~> t, KnownValue (Maybe t)) => ex -> Expr (Maybe t)+some = Some . toExpr++none :: KnownValue t => Expr (Maybe t)+none = None++----------------------------------------------------------------------------+-- Either+----------------------------------------------------------------------------++right :: (ex :~> x, KnownValue y, KnownValue (Either y x)) => ex -> Expr (Either y x)+right = Right' . toExpr++left :: (ex :~> y, KnownValue x, KnownValue (Either y x)) => ex -> Expr (Either y x)+left = Left' . toExpr++----------------------------------------------------------------------------+-- Bytes and string+----------------------------------------------------------------------------++slice+  :: ( an :~> Natural+     , bn :~> Natural+     , IsSliceExpr ex c+     )+  => (an, bn) -> ex+  -> Expr (Maybe c)+slice (a, b) ex = Slice (toExpr a) (toExpr b) (toExpr ex)++infixr 6 <>+concat, (<>)+  :: IsConcatExpr exN1 exN2 n+  => exN1 -> exN2+  -> Expr n+concat a b = Concat (toExpr a) (toExpr b)+(<>) = concat++----------------------------------------------------------------------------+-- List+----------------------------------------------------------------------------++infixr 5 .:+cons, (.:) :: (ex1 :~> a, ex2 :~> List a) => ex1 -> ex2 -> Expr (List a)+cons el lst = Cons (toExpr el) (toExpr lst)+(.:) = cons++concatAll :: IsConcatListExpr exN n => exN -> Expr n+concatAll = Concat' . toExpr++nil :: KnownValue a => Expr (List a)+nil = Nil++----------------------------------------------------------------------------+-- Containers+----------------------------------------------------------------------------++class ExprMagma c where+  empty :: (NiceComparable (UpdOpKeyHs c), KnownValue c) => Expr c++instance KnownValue v => ExprMagma (BigMap k v) where+  empty = EmptyBigMap++instance KnownValue v => ExprMagma (Map k v) where+  empty = EmptyMap++instance ExprMagma (Set k) where+  empty = EmptySet++-- | Expression class to insert an element into a data structure.+--+-- Note that while this is based on 'update' and 'UpdOpHs', it is necessary to+-- have different instances to allow for different 'update' parameter types,+-- ('Set' uses a 'Bool' instead of a 'Maybe'), just like 'ExprRemovable'.+--+-- Moreover, this class is parameterized with an @insParam@ as well in order to+-- have both key-value pairs ('Map' and 'BigMap') as well as key only ('Set').+class UpdOpHs c => ExprInsertable c insParam where+  insert :: ex :~> c => insParam -> ex -> Expr c++instance (NiceComparable k, exKey :~> k, exValue :~> v)+    => ExprInsertable (BigMap k v) (exKey, exValue) where+  insert (k, v) c = update (k, some v) c++instance (NiceComparable k, exKey :~> k, exValue :~> v)+    => ExprInsertable (Map k v) (exKey, exValue) where+  insert (k, v) c = update (k, some v) c++instance (NiceComparable a, exKey :~> a) => ExprInsertable (Set a) exKey where+  insert k c = update (k, True) c++-- | Expression class to remove an element from a data structure.+--+-- Note that while this is based on 'update' and 'UpdOpHs', it is necessary to+-- have different instances to allow for different 'update' parameter types,+-- ('Set' uses a 'Bool' instead of a 'Maybe').+class UpdOpHs c => ExprRemovable c where+  remove+    :: (exStruct :~> c, exKey :~> UpdOpKeyHs c)+    => exKey -> exStruct -> Expr c++instance (NiceComparable k, KnownValue v) => ExprRemovable (BigMap k v) where+  remove k c = update (k, none) c++instance (NiceComparable k, KnownValue v) => ExprRemovable (Map k v) where+  remove k c = update (k, none) c++instance NiceComparable a => ExprRemovable (Set a) where+  remove k c = update (k, False) c++get+  :: IsGetExpr exKey exMap map+  => exKey -> exMap+  -> Expr (Maybe (GetOpValHs map))+get k m = Get (toExpr k) (toExpr m)++update+  :: IsUpdExpr exKey exVal exMap map+  => (exKey, exVal) -> exMap+  -> Expr map+update (k, v) s = Update (toExpr s) (toExpr k) (toExpr v)++mem+  :: IsMemExpr exKey exN n+  => exKey -> exN+  -> Expr Bool+mem key n = Mem (toExpr key) (toExpr n)++size+  :: IsSizeExpr exN n+  => exN -> Expr Natural+size = Size . toExpr++infixl 8 #:+(#:)+  :: IsGetExpr exKey exMap map+  => exMap -> exKey+  -> Expr (Maybe (GetOpValHs map))+(#:) = flip get++infixl 8 !:+(!:)+  :: IsUpdExpr exKey exVal exMap map+  => exMap -> (exKey, exVal)+  -> Expr map+(!:) = flip update++infixl 8 +:+(+:)+  :: ( ExprInsertable c exParam+     , exStructure :~> c+     )+     => exStructure -> exParam+     -> Expr c+(+:) = flip insert++infixl 8 -:+(-:)+  :: ( ExprRemovable c+     , exStruct :~> c+     , exKey :~> UpdOpKeyHs c+     )+  => exStruct -> exKey+  -> Expr c+(-:) = flip remove++infixl 8 ?:+(?:)+  :: IsMemExpr exKey exN n+  => exN -> exKey+  -> Expr Bool+(?:) = flip mem++emptyBigMap+  :: (KnownValue value, NiceComparable key, KnownValue (BigMap key value))+  => Expr (BigMap key value)+emptyBigMap = empty++emptyMap+  :: (KnownValue value, NiceComparable key, KnownValue (Map key value))+  => Expr (Map key value)+emptyMap = empty++emptySet+  :: (NiceComparable key, KnownValue (Set key))+  => Expr (Set key)+emptySet = empty++----------------------------------------------------------------------------+-- Storages+----------------------------------------------------------------------------++infixr 8 #@+stGet, (#@)+  :: ( StoreHasSubmap store name key value+     , KnownValue value+     , exKey   :~> key+     , exStore :~> store+     )+  => exStore -> (Label name, exKey)+  -> Expr (Maybe value)+stGet store (uName, key) = StGet uName (toExpr key) (toExpr store)+(#@) = stGet++infixl 8 !@+stUpdate, (!@)+  :: ( StoreHasSubmap store name key value+     , exKey   :~> key+     , exVal   :~> Maybe value+     , exStore :~> store+     )+  => exStore -> (Label name, exKey, exVal)+  -> Expr store+stUpdate store (uName, key, val) =+  StUpdate uName (toExpr key) (toExpr val) (toExpr store)+(!@) = stUpdate++infixr 8 +@+stInsert, (+@)+  :: ( StoreHasSubmap store name key value+     , exKey   :~> key+     , exVal   :~> value+     , exStore :~> store+     )+  => exStore -> (Label name, exKey, exVal)+  -> Expr store+stInsert store (uName, key, val) =+  StInsert uName (toExpr key) (toExpr val) (toExpr store)+(+@) = stInsert++infixr 8 ++@+stInsertNew, (++@)+  :: ( StoreHasSubmap store name key value+     , Dupable key+     , IsError err+     , Buildable err+     , exKey   :~> key+     , exVal   :~> value+     , exStore :~> store+     )+  => exStore+  -> (Label name, err, exKey, exVal)+  -> Expr store+stInsertNew store (uName, err, key, val) =+  StInsertNew uName err (toExpr key) (toExpr val) (toExpr store)+(++@) = stInsertNew++infixl 8 -@+stDelete, (-@)+  :: ( StoreHasSubmap store name key value+     , KnownValue value+     , exKey   :~> key+     , exStore :~> store+     )+  => exStore -> (Label name, exKey)+  -> Expr store+stDelete store (uName, key) = StDelete uName (toExpr key) (toExpr store)+(-@) = stDelete++infixl 8 ?@+stMem, (?@)+  :: ( StoreHasSubmap store name key value+     , KnownValue value+     , exKey   :~> key+     , exStore :~> store+     )+  => exStore -> (Label name, exKey)+  -> Expr Bool+stMem store (uName, key) = StMem uName (toExpr key) (toExpr store)+(?@) = stMem++----------------------------------------------------------------------------+-- Sum types+----------------------------------------------------------------------------++wrap+  :: ( InstrWrapOneC dt name+     , exField :~> CtorOnlyField name dt+     , KnownValue dt+     )+  => Label name+  -> exField+  -> Expr dt+wrap l = Wrap l . toExpr++unwrap+  :: ( InstrUnwrapC dt name+     , exDt :~> dt+     , KnownValue (CtorOnlyField name dt)+     )+  => Label name+  -> exDt+  -> Expr (CtorOnlyField name dt)+unwrap l = Unwrap l . toExpr++----------------------------------------------------------------------------+-- HasField+----------------------------------------------------------------------------++infixl 8 #!+(#!)+  :: (HasField dt name ftype, exDt :~> dt)+  => exDt+  -> Label name+  -> Expr ftype+(#!) (toExpr -> (ObjMan fa)) fName = ObjMan (ToField fa fName)+(#!) exDt fName = ObjMan (ToField (Object $ toExpr exDt) fName)++infixl 8 !!+(!!)+  :: ( HasField dt name ftype+     , exDt :~> dt+     , exFld :~> ftype+     )+  => exDt+  -> (Label name, exFld)+  -> Expr dt+(!!) (toExpr -> (ObjMan fa)) (fName, eFld) = ObjMan (SetField fa fName (toExpr eFld))+dt !! (fName, eFld) = ObjMan (SetField (Object $ toExpr dt) fName (toExpr eFld))++----------------------------------------------------------------------------+-- Record and Named+----------------------------------------------------------------------------++name :: (ex :~> t, KnownValue (name :! t)) => Label name -> ex -> Expr (name :! t)+name lName = Name lName . toExpr++unName :: (ex :~> (name :! t), KnownValue t) => Label name -> ex -> Expr t+unName lName = UnName lName . toExpr++infixl 8 !~+(!~)+  :: (ex :~> t, KnownValue (name :! t))+  => ex -> Label name+  -> Expr (name :! t)+(!~) = flip name++infixl 8 #~+(#~)+  :: (ex :~> (name :! t), KnownValue t)+  => ex -> Label name+  -> Expr t+(#~) = flip unName++-- TODO: we should try to make this have a set of 'IsExpr' as input instead of 'Expr'+construct+  :: ( InstrConstructC dt, KnownValue dt+     , RMap (ConstructorFieldTypes dt)+     , RecordToList (ConstructorFieldTypes dt)+     , fields ~ Rec Expr (ConstructorFieldTypes dt)+     , RecFromTuple fields+     )+  => IsoRecTuple fields -> Expr dt+construct = Construct Proxy. recFromTuple++constructRec+  :: ( InstrConstructC dt+     , RMap (ConstructorFieldTypes dt)+     , RecordToList (ConstructorFieldTypes dt)+     , KnownValue dt+     )+  => Rec Expr (ConstructorFieldTypes dt)+  -> Expr dt+constructRec = Construct Proxy++----------------------------------------------------------------------------+-- Contract+----------------------------------------------------------------------------++contract+  :: forall p vd addr exAddr.+     ( NiceParameterFull p+     , NoExplicitDefaultEntrypoint p+     , IsoValue (ContractRef p)+     , ToTAddress p vd addr+     , ToT addr ~ ToT Address+     , exAddr :~> addr+     )+  => exAddr -> Expr (Maybe (ContractRef p))+contract = Contract (Proxy @vd) . toExpr++self+  :: ( NiceParameterFull p+     , NoExplicitDefaultEntrypoint p+     , IsoValue (ContractRef p)+     , IsNotInView+     )+  => Expr (ContractRef p)+self = Self++selfAddress :: Expr Address+selfAddress = SelfAddress++contractAddress :: (exc :~> ContractRef p) => exc -> Expr Address+contractAddress = ContractAddress . toExpr++contractCallingUnsafe+  :: ( NiceParameter arg+     , IsoValue (ContractRef arg)+     , exAddr :~> Address+     )+  => EpName -> exAddr -> Expr (Maybe (ContractRef arg))+contractCallingUnsafe epName = ContractCallingUnsafe epName . toExpr++contractCallingString+  :: ( NiceParameter arg+     , IsoValue (ContractRef arg)+     , exAddr :~> Address+     )+  => MText -> exAddr -> Expr (Maybe (ContractRef arg))+contractCallingString =+    contractCallingUnsafe+  . unsafe . buildEpName+  . unMText++runFutureContract+  :: ( NiceParameter p+     , IsoValue (ContractRef p)+     , conExpr :~> FutureContract p+     )+  => conExpr -> Expr (Maybe (ContractRef p))+runFutureContract = RunFutureContract . toExpr++implicitAccount+  :: (exkh :~> KeyHash)+  => exkh+  -> Expr (ContractRef ())+implicitAccount = ImplicitAccount . toExpr++convertEpAddressToContract+  :: ( NiceParameter p+     , IsoValue (ContractRef p)+     , epExpr :~> EpAddress+     )+  => epExpr -> Expr (Maybe (ContractRef p))+convertEpAddressToContract = ConvertEpAddressToContract . toExpr++makeView+  :: ( KnownValue (View_ a r)+     , exa :~> a+     , exCRef :~> ContractRef r+     )+  => exa -> exCRef -> Expr (View_ a r)+makeView a cRef = MakeView (toExpr a) (toExpr cRef)++makeVoid+  :: ( KnownValue (Void_ a b)+     , exa :~> a+     , exCRef :~> Lambda b b+     )+  => exa -> exCRef -> Expr (Void_ a b)+makeVoid a cRef = MakeVoid (toExpr a) (toExpr cRef)++----------------------------------------------------------------------------+-- Auxiliary+----------------------------------------------------------------------------++now :: Expr Timestamp+now = Now++amount :: Expr Mutez+amount = Amount++sender :: Expr Address+sender = Sender++checkSignature+  :: ( pkExpr :~> PublicKey+     , sigExpr :~> TSignature bs+     , hashExpr :~> bs+     , BytesLike bs+     )+  => pkExpr -> sigExpr -> hashExpr+  -> Expr Bool+checkSignature pk sig hash = CheckSignature (toExpr pk) (toExpr sig) (toExpr hash)++sha256 :: (hashExpr :~> bs, BytesLike bs) => hashExpr -> Expr (Hash Sha256 bs)+sha256 = Sha256 . toExpr++sha512 :: (hashExpr :~> bs, BytesLike bs) => hashExpr -> Expr (Hash Sha512 bs)+sha512 = Sha512 . toExpr++blake2b :: (hashExpr :~> bs, BytesLike bs) => hashExpr -> Expr (Hash Blake2b bs)+blake2b = Blake2b . toExpr++sha3 :: (hashExpr :~> bs, BytesLike bs) => hashExpr -> Expr (Hash Sha3 bs)+sha3 = Sha3 . toExpr++keccak :: (hashExpr :~> bs, BytesLike bs) => hashExpr -> Expr (Hash Keccak bs)+keccak = Keccak . toExpr++hashKey :: (keyExpr :~> PublicKey) => keyExpr -> Expr KeyHash+hashKey = HashKey . toExpr++chainId :: Expr ChainId+chainId = ChainId++balance :: Expr Mutez+balance = Balance++level :: Expr Natural+level = Level++votingPower :: (keyExpr :~> KeyHash) => keyExpr -> Expr Natural+votingPower = VotingPower . toExpr++totalVotingPower :: Expr Natural+totalVotingPower = TotalVotingPower
+ src/Indigo/Frontend/Internal/Statement.hs view
@@ -0,0 +1,222 @@+-- SPDX-FileCopyrightText: 2021 Oxhead Alpha+-- SPDX-License-Identifier: LicenseRef-MIT-OA++-- | 'StatementF' functor datatype for Freer monad+--+-- This defines the AST of the syntactical constructs of+-- Indigo.+--+-- Despite being a part of the "front-end", this module is considered internal+-- implementation detail. It's not intended to be used by the end-user and hence+-- is not re-exported.+module Indigo.Frontend.Internal.Statement+  ( StatementF (..)++  , IfConstraint+  , IndigoMCaseClauseL (..)+  , LambdaKind (..)+  , withLambdaKind+  ) where++import Data.Kind qualified as Kind++import Lorentz.Entrypoints.Helpers (RequireSumType)+import Lorentz.Run qualified as L (Contract)+import Morley.Michelson.Typed.Haskell.Instr.Sum (CaseClauseParam(..), CtorField(..))+import Morley.Michelson.Untyped.Annotation (FieldAnn)+import Morley.Util.TypeLits (AppendSymbol)++import Indigo.Backend.Case (CaseCommonF)+import Indigo.Backend.Conditional (IfConstraint)+import Indigo.Backend.Lambda (LambdaKind(..), withLambdaKind)+import Indigo.Backend.Scope (RetExprs, RetOutStack, RetVars, ReturnableValue, ScopeCodeGen)+import Indigo.Common.Expr (Expr)+import Indigo.Common.Field (HasField)+import Indigo.Common.Object (IsObject)+import Indigo.Common.SIS (SomeIndigoState)+import Indigo.Common.Var (HasSideEffects, Var)+import Indigo.Lorentz+import Indigo.Prelude++-- | Analogous datatype as IndigoCaseClauseL from Indigo.Backend.Case+data IndigoMCaseClauseL freer ret (param :: CaseClauseParam) where+    OneFieldIndigoMCaseClauseL+      :: ( name ~ (AppendSymbol "c" ctor)+         , KnownValue x+         , ScopeCodeGen retBr+         , ret ~ RetExprs retBr+         , RetOutStack ret ~ RetOutStack retBr+         )+      => Label name+      -> (Var x -> freer retBr)+      -> IndigoMCaseClauseL freer ret ('CaseClauseParam ctor ('OneField x))++-- | StatementF functor for Freer monad.+--+-- The constructors correspond to every Indigo statement that has expressions+-- (@'Expr' x@) in its signature.+--+-- The ones that don't take expressions are compiled directly to 'IndigoState'+-- (and kept in 'LiftIndigoState'), because they won't be taken into consideration+-- by an optimizer anyway.+--+-- One more detail about 'StatementF' is that it takes a @cont@ type parameter,+-- which is basically 'IndigoM' (freer monad), to avoid cyclic dependencies.+-- @cont@ is needed to support statements which have recursive structure+-- (like: @if@, @while@, @case@, etc).+data StatementF (freer :: Kind.Type -> Kind.Type) a where+  -- | Direct injection of IndigoState of statements+  -- which are not going to be analyzed by optimizer.+  LiftIndigoState :: (forall inp. SomeIndigoState inp) -> StatementF freer ()++  -- | Constructor wrapper which holds 'IndigoM' function+  -- among with the callstack of caller side.+  --+  -- The another option could be to add `HasCallStack` to 'Instr' constructor of 'Program'+  -- but this would have held only a 'CallStack' of separate primitive statement (unlike 'updateStorageField', etc).+  -- The idea is to be able to have correspondence between original Indigo code+  -- and the generated Michelson assembler and vice versa to perform quick navigation and analyze,+  -- so it's better to have call stack for non-primitive frontend statements.+  CalledFrom :: CallStack -> freer a -> StatementF freer a++  NewVar :: KnownValue x => Expr x -> StatementF freer (Var x)+  SetVar :: KnownValue x => Var x -> Expr x -> StatementF freer ()+  VarModification+    :: (IsObject x, KnownValue y)+    => [y, x] :-> '[x]+    -> Var x+    -> Expr y+    -> StatementF freer ()+  SetField ::+    ( IsObject dt+    , IsObject ftype+    , HasField dt fname ftype+    )+    => Var dt -> Label fname -> Expr ftype -> StatementF cont ()++  LambdaCall1+    :: LambdaKind st arg res extra+    -> String+    -> (Var arg -> freer res)+    -> Expr arg+    -> StatementF freer (RetVars res)++  Scope :: ScopeCodeGen a => freer a -> StatementF freer (RetVars a)+  If+    :: IfConstraint a b+    => Expr Bool+    -> freer a+    -> freer b+    -> StatementF freer (RetVars a)+  IfSome+    :: (IfConstraint a b, KnownValue x)+    => Expr (Maybe x)+    -> (Var x -> freer a)+    -> freer b+    -> StatementF freer (RetVars a)+  IfRight+    :: (IfConstraint a b, KnownValue x, KnownValue y)+    => Expr (Either y x)+    -> (Var x -> freer a)+    -> (Var y -> freer b)+    -> StatementF freer (RetVars a)+  IfCons+    :: (IfConstraint a b, KnownValue x)+    => Expr (List x)+    -> (Var x -> Var (List x) -> freer a)+    -> freer b+    -> StatementF freer (RetVars a)+  Case+    :: CaseCommonF (IndigoMCaseClauseL freer) dt ret clauses+    => Expr dt -> clauses+    -> StatementF freer (RetVars ret)+  EntryCase+    :: ( CaseCommonF (IndigoMCaseClauseL freer) dt ret clauses+       , DocumentEntrypoints entrypointKind dt+       )+    => Proxy entrypointKind+    -> Expr dt+    -> clauses+    -> StatementF freer (RetVars ret)+  EntryCaseSimple+    :: ( CaseCommonF (IndigoMCaseClauseL freer) cp ret clauses+       , DocumentEntrypoints PlainEntrypointsKind cp+       , NiceParameterFull cp+       , RequireFlatParamEps cp+       )+    => Expr cp+    -> clauses+    -> StatementF freer (RetVars ret)++  While :: Expr Bool -> freer () -> StatementF freer ()+  WhileLeft+    :: (KnownValue x, KnownValue y)+    => Expr (Either y x)+    -> (Var y -> freer ())+    -> StatementF freer (Var x)+  ForEach+    :: (IterOpHs a, KnownValue (IterOpElHs a))+    => Expr a+    -> (Var (IterOpElHs a) -> freer ())+    -> StatementF freer ()++  ContractName+    :: Text -> freer () -> StatementF freer ()+  DocGroup+    :: DocItem di+    => (SubDoc -> di) -> freer () -> StatementF freer ()+  ContractGeneral :: freer () -> StatementF freer ()+  FinalizeParamCallingDoc+    :: (NiceParameterFull cp, RequireSumType cp, HasCallStack)+    => (Var cp -> freer ()) -> Expr cp -> StatementF freer ()++  TransferTokens+    :: (NiceParameter p, HasSideEffects, IsNotInView)+    => Expr p -> Expr Mutez -> Expr (ContractRef p) -> StatementF freer ()+  SetDelegate :: (HasSideEffects, IsNotInView) => Expr (Maybe KeyHash) -> StatementF freer ()++  CreateContract+    :: ( IsObject st+       , NiceStorage st, NiceParameterFull param+       , HasSideEffects, NiceViewsDescriptor vd, Typeable vd+       , IsNotInView+       )+    => L.Contract param st vd+    -> Expr (Maybe KeyHash)+    -> Expr Mutez+    -> Expr st+    -> StatementF freer (Var Address)+  SelfCalling+    :: ( NiceParameterFull p+       , KnownValue (GetEntrypointArgCustom p mname)+       , IsoValue (ContractRef (GetEntrypointArgCustom p mname))+       , IsNotInView+       )+    => Proxy p+    -> EntrypointRef mname+    -> StatementF freer (Var (ContractRef (GetEntrypointArgCustom p mname)))+  ContractCalling+    :: ( HasEntrypointArg cp epRef epArg+       , ToTAddress cp vd addr+       , ToT addr ~ ToT Address+       , KnownValue epArg+       , IsoValue (ContractRef epArg)+       )+    => Proxy (cp, vd) -> epRef -> Expr addr -> StatementF freer (Var (Maybe (ContractRef epArg)))+  Emit+    :: (HasSideEffects, NicePackedValue a, HasAnnotation a)+    => FieldAnn -> Expr a -> StatementF freer ()++  -- Generic failing statements, hardly more than 'LiftIndigoState', but with the+  -- knowledge that they end in a failure.+  Fail+    :: ReturnableValue ret+    => Proxy ret+    -> (forall inp. SomeIndigoState inp)+    -> StatementF freer (RetVars ret)+  FailOver+    :: ReturnableValue ret+    => Proxy ret+    -> (forall inp. Expr a -> SomeIndigoState inp)+    -> Expr a+    -> StatementF freer (RetVars ret)
src/Indigo/Frontend/Language.hs view
@@ -1,6 +1,5 @@--- SPDX-FileCopyrightText: 2020 Tocqueville Group------ SPDX-License-Identifier: LicenseRef-MIT-TQ+-- SPDX-FileCopyrightText: 2021 Oxhead Alpha+-- SPDX-License-Identifier: LicenseRef-MIT-OA  -- | Frontend statements's functions of the Indigo Language. @@ -84,15 +83,18 @@   , setDelegate   , createContract   , createLorentzContract+  , emit    -- * Failures   , failWith   , assert   , failCustom   , failCustom_+  , failCustomNoArg   , failUnexpected_   , assertCustom   , assertCustom_+  , assertCustomNoArg   , assertSome   , assertNone   , assertRight@@ -100,6 +102,8 @@   -- * Re-exports   , ReturnableValue   , RetVars+  , FieldAnn+  , annQ    -- * Comments   , comment@@ -120,26 +124,32 @@ import GHC.Stack (popCallStack) import GHC.Stack.Types (SrcLoc(..)) -import qualified Indigo.Backend as B+import Indigo.Backend qualified as B import Indigo.Backend.Case hiding (caseRec, entryCaseRec) import Indigo.Backend.Lambda import Indigo.Backend.Scope+import Indigo.Common.Expr (Expr(C), ExprType, IsExpr, ToExpr, toExpr, type (:~>))+import Indigo.Common.Field (HasField)+import Indigo.Common.Object (IsObject)+import Indigo.Common.SIS (SomeIndigoState, toSIS)+import Indigo.Common.Var (HasSideEffects, HasStorage, Var, storageVar) import Indigo.Compilation (compileIndigoContract)+import Indigo.Frontend.Expr ((#!))+import Indigo.Frontend.Internal.Statement import Indigo.Frontend.Program-import Indigo.Frontend.Statement-import Indigo.Internal hiding (SetField, (==), (>>))-import Indigo.Lorentz+import Indigo.Lorentz hiding (comment, commentAroundFun, commentAroundStmt, justComment) import Indigo.Prelude import Lorentz.Entrypoints.Helpers (RequireSumType)-import qualified Lorentz.Instr as L-import qualified Lorentz.Run as L-import qualified Michelson.Typed as MT-import qualified Michelson.Typed.Arith as M-import Michelson.Typed.Haskell.Instr.Sum (CaseClauseParam(..), CtorField(..))+import Lorentz.Instr qualified as L+import Lorentz.Run qualified as L+import Morley.Michelson.Typed qualified as MT+import Morley.Michelson.Typed.Arith qualified as M+import Morley.Michelson.Typed.Haskell.Instr.Sum (CaseClauseParam(..), CtorField(..))+import Morley.Michelson.Untyped.Annotation (FieldAnn, annQ)+import Morley.Util.Markdown (toAnchor)+import Morley.Util.TypeLits (AppendSymbol)+import Morley.Util.TypeTuple.Class import Prelude ((==))-import Util.Markdown (toAnchor)-import Util.TypeLits (AppendSymbol)-import Util.TypeTuple.Class  oneIndigoM :: StatementF IndigoM a -> IndigoM a oneIndigoM st = IndigoM (Instr st)@@ -192,56 +202,56 @@  (+=)   :: ( IsExpr ex1 n, IsObject m-     , ArithOpHs M.Add n m, ArithResHs M.Add n m ~ m+     , ArithOpHs M.Add n m m      , HasCallStack      ) => Var m -> ex1 -> IndigoM () (+=) = calledFrom ... varModification L.add  (-=)   :: ( IsExpr ex1 n, IsObject m-     , ArithOpHs M.Sub n m, ArithResHs M.Sub n m ~ m+     , ArithOpHs M.Sub n m m      , HasCallStack      ) => Var m -> ex1 -> IndigoM () (-=) = calledFrom ... varModification L.sub  (*=)   :: ( IsExpr ex1 n, IsObject m-     , ArithOpHs M.Mul n m, ArithResHs M.Mul n m ~ m+     , ArithOpHs M.Mul n m m      , HasCallStack      ) => Var m -> ex1 -> IndigoM () (*=) = calledFrom ... varModification L.mul  (||=)   :: ( IsExpr ex1 n, IsObject m-     , ArithOpHs M.Or n m, ArithResHs M.Or n m ~ m+     , ArithOpHs M.Or n m m      , HasCallStack      ) => Var m -> ex1 -> IndigoM () (||=) = calledFrom ... varModification L.or  (&&=)   :: ( IsExpr ex1 n, IsObject m-     , ArithOpHs M.And n m, ArithResHs M.And n m ~ m+     , ArithOpHs M.And n m m      , HasCallStack      ) => Var m -> ex1 -> IndigoM () (&&=) = calledFrom ... varModification L.and  (^=)   :: ( IsExpr ex1 n, IsObject m-     , ArithOpHs M.Xor n m, ArithResHs M.Xor n m ~ m+     , ArithOpHs M.Xor n m m      , HasCallStack      ) => Var m -> ex1 -> IndigoM () (^=) = calledFrom ... varModification L.xor  (<<<=)   :: ( IsExpr ex1 n, IsObject m-     , ArithOpHs M.Lsl n m, ArithResHs M.Lsl n m ~ m+     , ArithOpHs M.Lsl n m m      , HasCallStack      ) => Var m -> ex1 -> IndigoM () (<<<=) = calledFrom ... varModification L.lsl  (>>>=)   :: ( IsExpr ex1 n, IsObject m-     , ArithOpHs M.Lsr n m, ArithResHs M.Lsr n m ~ m+     , ArithOpHs M.Lsr n m m      , HasCallStack      ) => Var m -> ex1 -> IndigoM () (>>>=) = calledFrom ... varModification L.lsr@@ -560,9 +570,9 @@ -- specified to avoid the warning for redundant constraints. defContract   :: HasCallStack-  => (HasSideEffects => IndigoM ())-  -> (HasSideEffects => IndigoProcedure)-defContract = calledFrom . scope+  => ((HasSideEffects, IsNotInView) => IndigoM ())+  -> ((HasSideEffects, IsNotInView) => IndigoProcedure)+defContract c = calledFrom (scope c)  -- | Family of @defNamed*LambdaN@ functions put an Indigo computation -- on the stack to later call it avoiding code duplication.@@ -682,7 +692,7 @@ -- | Group documentation built in the given piece of code -- into a block dedicated to one thing, e.g. to one entrypoint. docGroup :: (DocItem di, HasCallStack) => (SubDoc -> di) -> IndigoM () -> IndigoM ()-docGroup = calledFrom . oneIndigoM ... DocGroup+docGroup f i = calledFrom $ oneIndigoM $ DocGroup f i  -- | Insert documentation of the contract's storage type. The type -- should be passed using type applications.@@ -735,23 +745,25 @@   :: forall p mname.      ( NiceParameterFull p      , KnownValue (GetEntrypointArgCustom p mname)-     , HasCallStack+     , IsoValue (ContractRef (GetEntrypointArgCustom p mname))+     , HasCallStack, IsNotInView      )   => EntrypointRef mname   -> IndigoM (Var (ContractRef (GetEntrypointArgCustom p mname)))-selfCalling = calledFrom . oneIndigoM ... SelfCalling (Proxy @p)+selfCalling ep = calledFrom $ oneIndigoM $ SelfCalling (Proxy @p) ep  contractCalling-  :: forall cp epRef epArg addr exAddr.+  :: forall cp vd epRef epArg addr exAddr.      ( HasEntrypointArg cp epRef epArg-     , ToTAddress cp addr+     , ToTAddress cp vd addr      , ToT addr ~ ToT Address      , exAddr :~> addr      , KnownValue epArg+     , IsoValue (ContractRef epArg)      , HasCallStack      )   => epRef -> exAddr -> IndigoM (Var (Maybe (ContractRef epArg)))-contractCalling epRef = calledFrom . oneIndigoM . ContractCalling (Proxy @cp) epRef . toExpr+contractCalling epRef = calledFrom . oneIndigoM . ContractCalling (Proxy @(cp, vd)) epRef . toExpr  ---------------------------------------------------------------------------- -- Side-effects operations@@ -764,23 +776,28 @@      , NiceParameter p      , HasSideEffects      , HasCallStack+     , IsNotInView      )   => exp -> exm -> exc -> IndigoM () transferTokens ep em ec = calledFrom $ oneIndigoM $   TransferTokens (toExpr ep) (toExpr em) (toExpr ec) -setDelegate :: (HasSideEffects, IsExpr ex (Maybe KeyHash), HasCallStack) => ex -> IndigoM ()+setDelegate+  :: (HasSideEffects, IsExpr ex (Maybe KeyHash), HasCallStack, IsNotInView)+  => ex -> IndigoM () setDelegate = calledFrom . oneIndigoM . SetDelegate . toExpr  -- | Create contract using default compilation options for Lorentz compiler. -- -- See "Lorentz.Run". createContract-  :: ( IsObject st+  :: forall st exk exm exs param.+     ( IsObject st      , IsExpr exk (Maybe KeyHash), IsExpr exm Mutez, IsExpr exs st-     , NiceStorage st, NiceParameterFull param+     , NiceStorageFull st, NiceParameterFull param      , HasSideEffects      , HasCallStack+     , IsNotInView      )   => (HasStorage st => Var param -> IndigoM ())   -> exk@@ -790,17 +807,18 @@ createContract iCtr ek em es = calledFrom $ oneIndigoM $   -- pva701: we don't have GenCodeHooks at this point so we just pass empty ones   -- Maybe we should pass this hooks via 'given'-  CreateContract (defaultContract $ compileIndigoContract iCtr) (toExpr ek) (toExpr em) (toExpr es)+  CreateContract (mkContract $ compileIndigoContract iCtr) (toExpr ek) (toExpr em) (toExpr es)  -- | Create contract from raw Lorentz 'L.Contract'. createLorentzContract   :: ( IsObject st      , IsExpr exk (Maybe KeyHash), IsExpr exm Mutez, IsExpr exs st-     , NiceStorage st, NiceParameterFull param+     , NiceStorage st, NiceParameterFull param, NiceViewsDescriptor vd, Typeable vd      , HasSideEffects      , HasCallStack+     , IsNotInView      )-  => L.Contract param st+  => L.Contract param st vd   -> exk   -> exm   -> exs@@ -808,12 +826,25 @@ createLorentzContract lCtr ek em es = calledFrom $ oneIndigoM $   CreateContract lCtr (toExpr ek) (toExpr em) (toExpr es) +-- | @emit tag expression@ emits a contract event with textual tag @tag@ and+-- payload @expression@.+--+-- The tag must be a field annotation. Use 'annQ' quoter to construct it from a+-- literal, for example:+--+-- > emit [annQ|tag|] ()+emit+  :: (HasSideEffects, NicePackedValue a, HasAnnotation a, HasCallStack)+  => FieldAnn -> Expr a -> IndigoM ()+emit tag ex = calledFrom $ oneIndigoM $ Emit tag ex+ ---------------------------------------------------------------------------- -- Error ----------------------------------------------------------------------------  failWith-  :: forall ret a ex . (IsExpr ex a, ReturnableValue ret, HasCallStack)+  :: forall ret a ex.+     (NiceConstant a, IsExpr ex a, ReturnableValue ret, HasCallStack)   => ex -> IndigoM (RetVars ret) failWith = calledFrom . oneIndigoM . FailOver (Proxy @ret) (toSIS . B.failWith) . toExpr @@ -825,7 +856,7 @@ failCustom   :: forall ret tag err ex.      ( ReturnableValue ret-     , err ~ ErrorArg tag+     , MustHaveErrorArg tag (MText, err)      , CustomErrorHasDoc tag      , NiceConstant err      , ex :~> err@@ -835,15 +866,25 @@ failCustom l = calledFrom . oneIndigoM . FailOver (Proxy @ret) (toSIS . B.failCustom l) . toExpr  failCustom_-  :: forall ret tag notVoidErrorMsg.+  :: forall ret tag.      ( ReturnableValue ret-     , RequireNoArgError tag notVoidErrorMsg+     , MustHaveErrorArg tag (MText, ())      , CustomErrorHasDoc tag      , HasCallStack      )   => Label tag -> IndigoM (RetVars ret) failCustom_ tag = calledFrom $ oneIndigoM $ Fail (Proxy @ret) (toSIS $ B.failCustom_ tag) +failCustomNoArg+  :: forall ret tag.+     ( ReturnableValue ret+     , MustHaveErrorArg tag MText+     , CustomErrorHasDoc tag+     , HasCallStack+     )+  => Label tag -> IndigoM (RetVars ret)+failCustomNoArg tag = calledFrom $ oneIndigoM $ Fail (Proxy @ret) (toSIS $ B.failCustomNoArg tag)+ failUnexpected_   :: forall ret. (ReturnableValue ret, HasCallStack)   => MText -> IndigoM (RetVars ret)@@ -860,8 +901,8 @@ assert err ex = calledFrom $ if_ ex (return ()) (failUsing_ @() err)  assertCustom-  :: forall tag err errEx ex .-     ( err ~ ErrorArg tag+  :: forall tag err errEx ex.+     ( MustHaveErrorArg tag (MText, err)      , CustomErrorHasDoc tag      , NiceConstant err      , IsExpr errEx err@@ -872,14 +913,24 @@ assertCustom tag errEx ex = calledFrom $ if_ ex (return ()) (failCustom @() tag errEx)  assertCustom_-  :: forall tag notVoidErrorMsg ex.-     ( RequireNoArgError tag notVoidErrorMsg+  :: forall tag ex.+     ( MustHaveErrorArg tag (MText, ())      , CustomErrorHasDoc tag      , IsExpr ex Bool      , HasCallStack      )   => Label tag -> ex -> IndigoM () assertCustom_ tag ex = calledFrom $ if_ ex (return ()) (failCustom_ @() tag)++assertCustomNoArg+  :: forall tag ex.+     ( MustHaveErrorArg tag MText+     , CustomErrorHasDoc tag+     , IsExpr ex Bool+     , HasCallStack+     )+  => Label tag -> ex -> IndigoM ()+assertCustomNoArg tag ex = calledFrom $ if_ ex (return ()) (failCustomNoArg @() tag)  assertSome   :: forall x err ex.
src/Indigo/Frontend/Program.hs view
@@ -13,8 +13,9 @@  import Control.Monad (liftM) -import Indigo.Frontend.Statement-import Indigo.Internal.Var (HasSideEffects, HasStorage, Var)+import Indigo.Common.Var (HasSideEffects, HasStorage, Var)+import Indigo.Frontend.Internal.Statement+import Indigo.Lorentz (IsNotInView) import Indigo.Prelude  -- | This is freer monad (in other words operational monad).@@ -61,4 +62,4 @@  -- | Type of a contract that can be compiled to Lorentz with 'compileIndigoContract'. type IndigoContract param st =-  (HasStorage st, HasSideEffects) => Var param -> IndigoM ()+  (HasStorage st, HasSideEffects, IsNotInView) => Var param -> IndigoM ()
− src/Indigo/Frontend/Statement.hs
@@ -1,202 +0,0 @@--- SPDX-FileCopyrightText: 2020 Tocqueville Group------ SPDX-License-Identifier: LicenseRef-MIT-TQ---- | 'StatementF' functor datatype for Freer monad--module Indigo.Frontend.Statement-  ( StatementF (..)--  , IfConstraint-  , IndigoMCaseClauseL (..)-  , LambdaKind (..)-  , withLambdaKind-  ) where--import qualified Data.Kind as Kind-import Util.TypeLits (AppendSymbol)--import Lorentz.Entrypoints.Helpers (RequireSumType)-import qualified Lorentz.Run as L (Contract)-import Michelson.Typed.Haskell.Instr.Sum (CaseClauseParam(..), CtorField(..))--import Indigo.Backend-import Indigo.Internal-import Indigo.Lorentz-import Indigo.Prelude---- | Analogous datatype as IndigoCaseClauseL from Indigo.Backend.Case-data IndigoMCaseClauseL freer ret (param :: CaseClauseParam) where-    OneFieldIndigoMCaseClauseL-      :: ( name ~ (AppendSymbol "c" ctor)-         , KnownValue x-         , ScopeCodeGen retBr-         , ret ~ RetExprs retBr-         , RetOutStack ret ~ RetOutStack retBr-         )-      => Label name-      -> (Var x -> freer retBr)-      -> IndigoMCaseClauseL freer ret ('CaseClauseParam ctor ('OneField x))---- | StatementF functor for Freer monad.------ The constructors correspond to every Indigo statement that has expressions--- (@'Expr' x@) in its signature.------ The ones that don't take expressions are compiled directly to 'IndigoState'--- (and kept in 'LiftIndigoState'), because they won't be taken into consideration--- by an optimizer anyway.------ One more detail about 'StatementF' is that it takes a @cont@ type parameter,--- which is basically 'IndigoM' (freer monad), to avoid cyclic dependencies.--- @cont@ is needed to support statements which have recursive structure--- (like: @if@, @while@, @case@, etc).-data StatementF (freer :: Kind.Type -> Kind.Type) a where-  -- | Direct injection of IndigoState of statements-  -- which are not going to be analyzed by optimizer.-  LiftIndigoState :: (forall inp. SomeIndigoState inp) -> StatementF freer ()--  -- | Constructor wrapper which holds 'IndigoM' function-  -- among with the callstack of caller side.-  ---  -- The another option could be to add `HasCallStack` to 'Instr' constructor of 'Program'-  -- but this would have held only a 'CallStack' of separate primitive statement (unlike 'updateStorageField', etc).-  -- The idea is to be able to have correspondence between original Indigo code-  -- and the generated Michelson assembler and vice versa to perform quick navigation and analyze,-  -- so it's better to have call stack for non-primitive frontend statements.-  CalledFrom :: CallStack -> freer a -> StatementF freer a--  NewVar :: KnownValue x => Expr x -> StatementF freer (Var x)-  SetVar :: KnownValue x => Var x -> Expr x -> StatementF freer ()-  VarModification-    :: (IsObject x, KnownValue y)-    => [y, x] :-> '[x]-    -> Var x-    -> Expr y-    -> StatementF freer ()-  SetField ::-    ( IsObject dt-    , IsObject ftype-    , HasField dt fname ftype-    )-    => Var dt -> Label fname -> Expr ftype -> StatementF cont ()--  LambdaCall1-    :: LambdaKind st arg res extra-    -> String-    -> (Var arg -> freer res)-    -> Expr arg-    -> StatementF freer (RetVars res)--  Scope :: ScopeCodeGen a => freer a -> StatementF freer (RetVars a)-  If-    :: IfConstraint a b-    => Expr Bool-    -> freer a-    -> freer b-    -> StatementF freer (RetVars a)-  IfSome-    :: (IfConstraint a b, KnownValue x)-    => Expr (Maybe x)-    -> (Var x -> freer a)-    -> freer b-    -> StatementF freer (RetVars a)-  IfRight-    :: (IfConstraint a b, KnownValue x, KnownValue y)-    => Expr (Either y x)-    -> (Var x -> freer a)-    -> (Var y -> freer b)-    -> StatementF freer (RetVars a)-  IfCons-    :: (IfConstraint a b, KnownValue x)-    => Expr (List x)-    -> (Var x -> Var (List x) -> freer a)-    -> freer b-    -> StatementF freer (RetVars a)-  Case-    :: CaseCommonF (IndigoMCaseClauseL freer) dt ret clauses-    => Expr dt -> clauses-    -> StatementF freer (RetVars ret)-  EntryCase-    :: ( CaseCommonF (IndigoMCaseClauseL freer) dt ret clauses-       , DocumentEntrypoints entrypointKind dt-       )-    => Proxy entrypointKind-    -> Expr dt-    -> clauses-    -> StatementF freer (RetVars ret)-  EntryCaseSimple-    :: ( CaseCommonF (IndigoMCaseClauseL freer) cp ret clauses-       , DocumentEntrypoints PlainEntrypointsKind cp-       , NiceParameterFull cp-       , RequireFlatParamEps cp-       )-    => Expr cp-    -> clauses-    -> StatementF freer (RetVars ret)--  While :: Expr Bool -> freer () -> StatementF freer ()-  WhileLeft-    :: (KnownValue x, KnownValue y)-    => Expr (Either y x)-    -> (Var y -> freer ())-    -> StatementF freer (Var x)-  ForEach-    :: (IterOpHs a, KnownValue (IterOpElHs a))-    => Expr a-    -> (Var (IterOpElHs a) -> freer ())-    -> StatementF freer ()--  ContractName-    :: Text -> freer () -> StatementF freer ()-  DocGroup-    :: DocItem di-    => (SubDoc -> di) -> freer () -> StatementF freer ()-  ContractGeneral :: freer () -> StatementF freer ()-  FinalizeParamCallingDoc-    :: (NiceParameterFull cp, RequireSumType cp, HasCallStack)-    => (Var cp -> freer ()) -> Expr cp -> StatementF freer ()--  TransferTokens-    :: (NiceParameter p, HasSideEffects)-    => Expr p -> Expr Mutez -> Expr (ContractRef p) -> StatementF freer ()-  SetDelegate :: HasSideEffects => Expr (Maybe KeyHash) -> StatementF freer ()--  CreateContract-    :: ( IsObject st-       , NiceStorage st, NiceParameterFull param-       , HasSideEffects-       )-    => L.Contract param st-    -> Expr (Maybe KeyHash)-    -> Expr Mutez-    -> Expr st-    -> StatementF freer (Var Address)-  SelfCalling-    :: ( NiceParameterFull p-       , KnownValue (GetEntrypointArgCustom p mname)-       )-    => Proxy p-    -> EntrypointRef mname-    -> StatementF freer (Var (ContractRef (GetEntrypointArgCustom p mname)))-  ContractCalling-    :: ( HasEntrypointArg cp epRef epArg-       , ToTAddress cp addr-       , ToT addr ~ ToT Address-       , KnownValue epArg-       )-    => Proxy cp -> epRef -> Expr addr -> StatementF freer (Var (Maybe (ContractRef epArg)))--  -- Generic failing statements, hardly more than 'LiftIndigoState', but with the-  -- knowledge that they end in a failure.-  Fail-    :: ReturnableValue ret-    => Proxy ret-    -> (forall inp. SomeIndigoState inp)-    -> StatementF freer (RetVars ret)-  FailOver-    :: ReturnableValue ret-    => Proxy ret-    -> (forall inp. Expr a -> SomeIndigoState inp)-    -> Expr a-    -> StatementF freer (RetVars ret)
− src/Indigo/Internal.hs
@@ -1,15 +0,0 @@--- SPDX-FileCopyrightText: 2020 Tocqueville Group------ SPDX-License-Identifier: LicenseRef-MIT-TQ--module Indigo.Internal-  ( module ReExports-  ) where--import Indigo.Internal.Expr as ReExports-import Indigo.Internal.Field as ReExports-import Indigo.Internal.Lookup as ReExports-import Indigo.Internal.SIS as ReExports-import Indigo.Internal.State as ReExports-import Indigo.Internal.Object as ReExports-import Indigo.Internal.Var as ReExports
− src/Indigo/Internal/Expr.hs
@@ -1,15 +0,0 @@--- SPDX-FileCopyrightText: 2020 Tocqueville Group------ SPDX-License-Identifier: LicenseRef-MIT-TQ---- | 'Expr'essions supported in Indigo language and their compilation to--- Lorentz code.--module Indigo.Internal.Expr-  ( module Exported-  ) where--import Indigo.Internal.Expr.Compilation as Exported-import Indigo.Internal.Expr.Decompose as Exported-import Indigo.Internal.Expr.Symbolic as Exported-import Indigo.Internal.Expr.Types as Exported
− src/Indigo/Internal/Expr/Compilation.hs
@@ -1,349 +0,0 @@--- SPDX-FileCopyrightText: 2020 Tocqueville Group------ SPDX-License-Identifier: LicenseRef-MIT-TQ---- | 'Expr' compilation--module Indigo.Internal.Expr.Compilation-  ( compileExpr--  , ObjManipulationRes (..)-  , runObjectManipulation-  , namedToExpr--  , nullaryOp-  , unaryOp-  , binaryOp-  , ternaryOp--  , nullaryOpFlat-  , unaryOpFlat-  , binaryOpFlat-  , ternaryOpFlat-  ) where--import Data.Vinyl.Core (RMap(..))--import qualified Lorentz.ADT as L-import qualified Lorentz.Instr as L-import qualified Lorentz.Macro as L-import qualified Lorentz.StoreClass as L-import Michelson.Typed.Haskell.Instr.Product (GetFieldType)--import Indigo.Backend.Prelude-import Indigo.Internal.Expr.Types-import Indigo.Internal.Field-import Indigo.Internal.Lookup (varActionGet)-import Indigo.Internal.Object-  (IndigoObjectF(..), NamedFieldObj(..), castFieldConstructors, namedToTypedRec, typedToNamedRec)-import Indigo.Internal.State-  (DecomposedObjects, GenCode(..), IndigoState(..), MetaData(..), replStkMd, usingIndigoState,-  withObject, withObjectState)-import Indigo.Internal.Var (Var(..), pushNoRef)-import Indigo.Lorentz--compileExpr :: forall a inp . Expr a -> IndigoState inp (a : inp)-compileExpr (C a) = IndigoState $ \md -> GenCode (pushNoRef $ mdStack md) (L.push a) L.drop-compileExpr (V v) = withObjectState v $ compileObjectF namedToExpr-compileExpr (Update m key val) = ternaryOp key val m L.update-compileExpr (Add e1 e2) = binaryOp e1 e2 L.add-compileExpr (Sub e1 e2) = binaryOp e1 e2 L.sub-compileExpr (Mul e1 e2) = binaryOp e1 e2 L.mul-compileExpr (Div e1 e2) = binaryOp e1 e2 (L.ediv # L.ifSome L.car (failUsing [mt|devision by zero|]))-compileExpr (Mod e1 e2) = binaryOp e1 e2 (L.ediv # L.ifSome L.cdr (failUsing [mt|devision by zero|]))-compileExpr (Abs e) = unaryOp e L.abs-compileExpr (Neg e) = unaryOp e L.neg--compileExpr (Lsl e1 e2) = binaryOp e1 e2 L.lsl-compileExpr (Lsr e1 e2) = binaryOp e1 e2 L.lsr--compileExpr (Eq' e1 e2) = binaryOp e1 e2 L.eq-compileExpr (Neq e1 e2) = binaryOp e1 e2 L.neq-compileExpr (Lt e1 e2) = binaryOp e1 e2 L.lt-compileExpr (Le e1 e2) = binaryOp e1 e2 L.le-compileExpr (Gt e1 e2) = binaryOp e1 e2 L.gt-compileExpr (Ge e1 e2) = binaryOp e1 e2 L.ge-compileExpr (IsNat e) = unaryOp e L.isNat-compileExpr (Int' e) = unaryOp e L.int-compileExpr (Coerce e) = unaryOp e checkedCoerce_-compileExpr (ForcedCoerce e) = unaryOp e forcedCoerce_-compileExpr (And e1 e2) = binaryOp e1 e2 L.and-compileExpr (Or e1 e2) = binaryOp e1 e2 L.or-compileExpr (Xor e1 e2) = binaryOp e1 e2 L.xor-compileExpr (Not e) = unaryOp e L.not--compileExpr (Fst e) = unaryOp e L.car-compileExpr (Snd e) = unaryOp e L.cdr-compileExpr (Pair e1 e2) = binaryOp e1 e2 L.pair--compileExpr (Some e) = unaryOp e L.some-compileExpr None = nullaryOp L.none-compileExpr (Right' e) = unaryOp e L.right-compileExpr (Left' e) = unaryOp e L.left-compileExpr (Pack e) = unaryOp e L.pack-compileExpr (Unpack e) = unaryOp e L.unpack-compileExpr (PackRaw e) = unaryOp e L.packRaw-compileExpr (UnpackRaw e) = unaryOp e L.unpackRaw-compileExpr Nil = nullaryOp L.nil-compileExpr (Cons e1 e2) = binaryOp e1 e2 L.cons-compileExpr (Contract e) = unaryOp e L.contract-compileExpr Self = nullaryOp L.self-compileExpr (ContractAddress ec) = unaryOp ec L.address-compileExpr (ContractCallingUnsafe epName addr) = unaryOp addr (L.contractCallingUnsafe epName)-compileExpr (RunFutureContract con) = unaryOp con L.runFutureContract-compileExpr (ConvertEpAddressToContract epAddr) = unaryOp epAddr L.epAddressToContract-compileExpr (MakeView e1 e2) = binaryOp e1 e2 (L.pair # L.wrapView)-compileExpr (MakeVoid e1 e2) = binaryOp e1 e2 (L.pair # L.wrapVoid)--compileExpr (Mem k c) = binaryOp k c L.mem-compileExpr (Size s) = unaryOp s L.size--compileExpr (StInsertNew l err k v store) =-  ternaryOp k v store $ L.stInsertNew l (failUsing err)-compileExpr (StInsert l k v store) =-  ternaryOp k v store $ L.stInsert l-compileExpr (StGet l ekey estore) = binaryOp ekey estore (L.stGet l)-compileExpr (StMem l ekey estore) = binaryOp ekey estore (L.stMem l)-compileExpr (StUpdate l ekey evalue estore) = ternaryOp ekey evalue estore (L.stUpdate l)-compileExpr (StDelete l ekey estore) = binaryOp ekey estore (L.stDelete l)--compileExpr (Wrap l exFld) = unaryOp exFld $ L.wrapOne l-compileExpr (Unwrap l exDt) = unaryOp exDt $ L.unwrapUnsafe_ l--compileExpr (ObjMan fldAcc) = compileObjectManipulation fldAcc-compileExpr (Construct _ fields) = IndigoState $ \md ->-  let cd = L.construct $ rmap (\e -> fieldCtor $ gcCode $ runIndigoState (compileExpr e) md) fields in-  GenCode (pushNoRef $ mdStack md) cd L.drop-compileExpr (ConstructWithoutNamed _ fields) = IndigoState $ \md ->-  let fieldCtrs =-          castFieldConstructors @a $-            rmap (fieldCtor . gcCode . usingIndigoState md . compileExpr) fields-  in GenCode (pushNoRef $ mdStack md) (L.construct @a fieldCtrs) L.drop-compileExpr (Name l e) = unaryOp e (toNamed l)-compileExpr (UnName l e) = unaryOp e (fromNamed l)--compileExpr (Slice ex1 ex2 ex3) = ternaryOp ex1 ex2 ex3 L.slice-compileExpr (Cast ex) = unaryOp ex L.cast-compileExpr (Concat ex1 ex2) = binaryOp ex1 ex2 L.concat-compileExpr (Concat' ex) = unaryOp ex L.concat'--compileExpr (ImplicitAccount kh) = unaryOp kh L.implicitAccount-compileExpr Now = nullaryOp L.now-compileExpr Sender = nullaryOp L.sender-compileExpr Amount = nullaryOp L.amount-compileExpr (CheckSignature pk sig bs) = ternaryOp pk sig bs L.checkSignature-compileExpr (Sha256 c) = unaryOp c L.sha256-compileExpr (Sha512 c) = unaryOp c L.sha512-compileExpr (Blake2b c) = unaryOp c L.blake2B-compileExpr (HashKey hk) = unaryOp hk L.hashKey-compileExpr ChainId = nullaryOp L.chainId-compileExpr Balance = nullaryOp L.balance--compileExpr EmptySet = nullaryOp L.emptySet--compileExpr (Get k m) = binaryOp k m L.get-compileExpr EmptyMap = nullaryOp L.emptyMap-compileExpr EmptyBigMap = nullaryOp L.emptyBigMap--compileExpr (Exec inp lambda) = binaryOp inp lambda L.exec-compileExpr (NonZero e) = unaryOp e L.nonZero------------------------------------------------- Object manipulation: set, get fields------------------------------------------------- | Compile 'ObjectManipulation' datatype to a cell on the stack.--- This function leverages 'ObjManipulationRes' to put off actual field compilation.-compileObjectManipulation :: ObjectManipulation a -> IndigoState inp (a : inp)-compileObjectManipulation fa = IndigoState $ \md -> case runObjectManipulation (mdObjects md) fa of-  StillObject composite -> usingIndigoState md $ compileObjectF unNamedFieldExpr composite-  OnStack computation   -> usingIndigoState md computation--namedToExpr :: NamedFieldObj x name -> Expr (GetFieldType x name)-namedToExpr (NamedFieldObj flObj) = objToExpr namedToExpr flObj---- | Convert arbitrary 'IndigoObjectF' into 'Expr'--- with respect to given converter for fields.-objToExpr-  :: forall a f .-     (forall name . f name -> Expr (GetFieldType a name))-  -> IndigoObjectF f a-  -> Expr a-objToExpr _ (Cell refId) = V (Var @a refId)-objToExpr convExpr (Decomposed fields) =-  ConstructWithoutNamed (Proxy @a) (namedToTypedRec @a convExpr fields)---- | Compile 'IndigoObjectF' to a stack cell,--- with respect to given function that compiles inner fields.-compileObjectF-  :: forall a inp f .-     (forall name . f name -> Expr (GetFieldType a name))-  -> IndigoObjectF f a-  -> IndigoState inp (a : inp)-compileObjectF _ (Cell ref) = IndigoState $ \(mdStack -> s) ->-  GenCode (pushNoRef s) (varActionGet @a ref s) L.drop-compileObjectF conv obj = compileExpr $ objToExpr conv obj---- | 'ObjManipulationRes' represents a postponed compilation of--- 'ObjectManipulation' datatype. When 'ObjectManipulation' is being compiled--- we are trying to put off the generation of code for work with an object--- because we can just go to a deeper field without its "materialization"--- onto stack.-data ObjManipulationRes inp a where-  StillObject :: ObjectExpr a -> ObjManipulationRes inp a-  OnStack :: IndigoState inp (a : inp) -> ObjManipulationRes inp a---- | This function might look cumbersome--- but basically it either goes deeper to an inner field or generates Lorentz code.-runObjectManipulation :: DecomposedObjects -> ObjectManipulation x -> ObjManipulationRes inp x-runObjectManipulation objs (Object e) = exprToManRes objs e--runObjectManipulation objs (ToField (v :: ObjectManipulation dt) (targetLb :: Label fname)) =-  case runObjectManipulation objs v of-    -- In case of decomposed fields, we just go deeper.-    StillObject (Decomposed fields) ->-      case fieldLens @dt @fname of-        -- If we access direct field, we just fetch it from fields-        TargetField lb _ -> exprToManRes objs $ unNamedFieldExpr (fetchField @dt lb fields)-        -- If we access deeper field, we fetch direct field and goes to the deeper field-        DeeperField lb _ ->-          let fe = unNamedFieldExpr $ fetchField @dt lb fields in-          runObjectManipulation objs (ToField (Object fe) targetLb)-    -- If stored object as cell on the stack, we get its field-    -- using 'sopToField', and since this moment 'ObjManipulationRes becomes-    -- a computation, not object anymore.-    StillObject (Cell refId) ->-      OnStack $ unaryOp (V $ Var refId) (sopToField @dt (flSFO fieldLens) targetLb)-    -- If we already got into computation, we use 'sopToField' to fetch field.-    OnStack compLHS -> OnStack $ IndigoState $ \mdI ->-      let cd = gcCode $ usingIndigoState mdI compLHS in-      GenCode (pushNoRef $ mdStack mdI) (cd # sopToField (flSFO fieldLens) targetLb) L.drop--runObjectManipulation objs (SetField (ev :: ObjectManipulation dt) (targetLb :: Label fname) ef) =-  case runObjectManipulation objs ev of-    StillObject lhsObj@(Decomposed fields) ->-      case fieldLens @dt @fname of-        -- If we set direct field, we just reassign its value with new one.-        TargetField lb _ ->-          StillObject $ Decomposed $ assignField @dt lb (NamedFieldExpr ef) fields-        -- If we set deeper field, we need to call recursively-        -- from a direct field, and set a target field of direct field.-        -- Getting a new value of direct field, we set the direct field to this value.-        DeeperField (lb :: Label interm) _ ->-          let fe = unNamedFieldExpr (fetchField @dt lb fields) in-          -- Computing new value of direct field-          case runObjectManipulation objs (SetField (Object fe) targetLb ef) of-            -- If it's still an object, we just reassign direct field with it.-            StillObject updField -> StillObject $ Decomposed $-              assignField @dt lb (NamedFieldExpr $ objToExpr unNamedFieldExpr updField) fields-            -- Otherwise, we use power of 'L.setField' to set a new value.-            OnStack rhs ->-              setFieldOnStack (compileObjectF unNamedFieldExpr lhsObj) rhs (L.setField @dt @interm lb)-    -- If stored object is Cell on stack, we set its field-    -- using 'sopSetField', and since this moment 'ObjManipulationRes' becomes-    -- a computation, not object anymore.-    StillObject (Cell refId) ->-      OnStack $ binaryOp ef (V $ Var refId) $ sopSetField (flSFO fieldLens) targetLb-    -- If we already got into computation, we use 'sopSetField' to set a field.-    OnStack compLHS ->-      setFieldOnStack compLHS (compileExpr ef) (sopSetField (flSFO $ fieldLens @dt) targetLb)-  where-    setFieldOnStack-      :: IndigoState inp (dt : inp)-      -> IndigoState (dt : inp) (fld : dt : inp)-      -> fld : dt : inp :-> dt : inp-      -> ObjManipulationRes inp dt-    setFieldOnStack lhs rhs setOp = OnStack $ IndigoState $ \mdI ->-      let GenCode st1 cdObj _cl1 = runIndigoState lhs mdI in-      let GenCode _st2 cdFld _cl2 = runIndigoState rhs (replStkMd mdI st1) in-      GenCode (pushNoRef $ mdStack mdI) (cdObj # cdFld # setOp) L.drop---- | Convert an expression to 'ObjManipulationRes'.--- The function pattern matches on some specific cases--- of expression those compilation into a stack cell may be postponed.--- They include 'Decomposed' variables and 'ConstructWithoutNamed' expressions.------ This function can't be called for 'ObjMan' constructor, but we--- take care of it just in case.-exprToManRes :: forall x inp . DecomposedObjects -> Expr x -> ObjManipulationRes inp x-exprToManRes objs (ObjMan objMan) = runObjectManipulation objs objMan-exprToManRes _ (ConstructWithoutNamed _ fields) =-  StillObject $ Decomposed $ typedToNamedRec @x NamedFieldExpr fields-exprToManRes objs (V var) = withObject objs var $ \case-  Cell refId ->-    StillObject $ Cell refId-  Decomposed fields ->-    StillObject $ Decomposed $ rmap (NamedFieldExpr . namedToExpr) fields-exprToManRes _ ex = OnStack $ compileExpr ex-------------------------------------------------------- Convenient helpers for operators compilation------------------------------------------------------ternaryOp-  :: KnownValue res-  => Expr n-  -> Expr m-  -> Expr l-  -> n : m : l : inp :-> res : inp-  -> IndigoState inp (res : inp)-ternaryOp e1 e2 e3 opCode = IndigoState $ \md ->-  let GenCode st3 cd3 _cl3  = runIndigoState (compileExpr e3) md in-  let GenCode st2 cd2 _cl2  = runIndigoState (compileExpr e2) (replStkMd md st3) in-  let GenCode _st1 cd1 _cl1 = runIndigoState (compileExpr e1) (replStkMd md st2) in-  GenCode (pushNoRef $ mdStack md) (cd3 # cd2 # cd1 # opCode) L.drop--binaryOp-  :: KnownValue res-  => Expr n -> Expr m-  -> n : m : inp :-> res : inp-  -> IndigoState inp (res : inp)-binaryOp e1 e2 opCode = IndigoState $ \md ->-  let GenCode st2 cd2 _cl2  = runIndigoState (compileExpr e2) md in-  let GenCode _st1 cd1 _cl1 = runIndigoState (compileExpr e1) (replStkMd md st2) in-  GenCode (pushNoRef $ mdStack md) (cd2 # cd1 # opCode) L.drop--unaryOp-  :: KnownValue res-  => Expr n-  -> n : inp :-> res : inp-  -> IndigoState inp (res : inp)-unaryOp e opCode = IndigoState $ \md ->-  let cd = gcCode $ runIndigoState (compileExpr e) md in-  GenCode (pushNoRef $ mdStack md) (cd # opCode) L.drop--nullaryOp :: KnownValue res => inp :-> res ': inp -> IndigoState inp (res ': inp)-nullaryOp lorentzInstr = IndigoState $ \md ->-  GenCode (pushNoRef $ mdStack md) lorentzInstr L.drop--ternaryOpFlat-  :: Expr n-  -> Expr m-  -> Expr l-  -> n : m : l : inp :-> inp-  -> IndigoState inp inp-ternaryOpFlat e1 e2 e3 opCode = IndigoState $ \md ->-  let GenCode st3 cd3 _cl3  = runIndigoState (compileExpr e3) md in-  let GenCode st2 cd2 _cl2  = runIndigoState (compileExpr e2) (replStkMd md st3) in-  let GenCode _st1 cd1 _cl1 = runIndigoState (compileExpr e1) (replStkMd md st2) in-  GenCode (mdStack md) (cd3 # cd2 # cd1 # opCode) L.nop--binaryOpFlat-  :: Expr n -> Expr m-  -> n : m : inp :-> inp-  -> IndigoState inp inp-binaryOpFlat e1 e2 opCode = IndigoState $ \md ->-  let GenCode st2 cd2 _cl2  = runIndigoState (compileExpr e2) md in-  let GenCode _st1 cd1 _cl1 = runIndigoState (compileExpr e1) (replStkMd md st2) in-  GenCode (mdStack md) (cd2 # cd1 # opCode) L.nop--unaryOpFlat-  :: Expr n-  -> n : inp :-> inp-  -> IndigoState inp inp-unaryOpFlat e opCode = IndigoState $ \md ->-  let cd = gcCode $ runIndigoState (compileExpr e) md in-  GenCode (mdStack md) (cd # opCode) L.nop--nullaryOpFlat :: inp :-> inp -> IndigoState inp inp-nullaryOpFlat lorentzInstr = IndigoState $ \md -> GenCode (mdStack md) lorentzInstr L.nop
− src/Indigo/Internal/Expr/Decompose.hs
@@ -1,141 +0,0 @@--- SPDX-FileCopyrightText: 2020 Tocqueville Group------ SPDX-License-Identifier: LicenseRef-MIT-TQ---- | Decompose a complex value into its fields--- to be used in 'setVar'.--- Also functionality to generate code to deconstruct storage--- into primitive fields the storage consists of--- and to construct it back.-module Indigo.Internal.Expr.Decompose-  ( decomposeExpr-  , deepDecomposeCompose-  , ExprDecomposition (..)-  , IsObject-  ) where--import Prelude--import Data.Constraint (Dict(..))-import Data.Vinyl.TypeLevel--import Indigo.Internal.Expr.Compilation-import Indigo.Internal.Expr.Types-import Indigo.Internal.Lookup-import Indigo.Internal.Object-import Indigo.Internal.SIS-import Indigo.Internal.State-import Indigo.Internal.Var-import Indigo.Lorentz-import qualified Lorentz.ADT as L-import qualified Lorentz.Instr as L-import Michelson.Typed.Haskell.Instr.Product (GetFieldType)-import Util.Type---------------------------------------------- Object decomposition---------------------------------------------- | Alike 'SomeIndigoState' datatype but without objects argument-type SIS' stk a = RefId -> StackVars stk -> (a, RefId, SomeGenCode stk)---- | For given element on stack, generate code which--- decomposes it to list of its deep non-decomposable fields.--- Clean up code of 'SomeIndigoState' composes the value back.-deepDecomposeCompose-  :: forall a inp . IsObject a-  => SIS' (a : inp) (Object a)-deepDecomposeCompose-  | Just Dict <- complexObjectDict @a = \refId st ->-      let decomposedSt = fst (noRefGenCode @(FieldTypes a) $ popNoRef st) in-      withStack refId decomposedSt (decomposeComposeFields @(FieldTypes a)) $ \(result, newRefId, gc) ->-        ( Decomposed (typedToNamedRec @a typedToNamedFieldObj result)-        , newRefId-        , SomeGenCode $ GenCode-          { gcStack = gcStack gc-          , gcCode = L.deconstruct @a @(FieldTypes a) # gcCode gc-          , gcClear = gcClear gc # L.constructStack @a  @(FieldTypes a)-          }-        )-  | otherwise =-      \refId stk -> (Cell refId, refId + 1, SomeGenCode $-                      usingIndigoState (MetaData stk mempty emptyGenCodeHooks) (assignTopVar $ Var refId) )-  where-    decomposeComposeFields-      :: forall flds . (KnownList flds, AllConstrained IsObject flds)-      => SIS' (flds ++ inp) (Rec TypedFieldObj flds)-    decomposeComposeFields = case klist @flds of-      KNil -> \refId stk -> (RNil, refId, SomeGenCode $ GenCode stk L.nop L.nop)-      KCons (_ :: Proxy r) (_ :: Proxy rest) -> \refId st ->-        withStack refId (popNoRef st) (decomposeComposeFields @rest) $ \(resultRest, refId', restGc) ->-          withStack refId' (pushNoRef $ gcStack restGc) (deepDecomposeCompose @r) $ \(resultCur, newRefId, curGc) ->-            ( TypedFieldObj resultCur :& resultRest-            , newRefId-            , SomeGenCode $ GenCode-              { gcStack = gcStack curGc-              , gcCode = L.dip (gcCode restGc) # gcCode curGc-              , gcClear = gcClear curGc # L.dip (gcClear restGc)-              }-            )--withStack-  :: RefId-  -> StackVars inp-  -> SIS' inp a-  -> (forall out . (a, RefId, GenCode inp out) -> r)-  -> r-withStack refId stk sis f = case sis refId stk of-  (res, newRefId, SomeGenCode genCode) -> f (res, newRefId, genCode)---------------------------------------------- Expr decomposition---------------------------------------------- | Datatype representing decomposition of 'Expr'.-data ExprDecomposition inp a where-  ExprFields :: Rec Expr (FieldTypes a) -> ExprDecomposition inp a-  Deconstructed :: IndigoState inp (FieldTypes a ++ inp) -> ExprDecomposition inp a---- | Decompose (shallowly) an expression to list of its direct fields.-decomposeExpr :: ComplexObjectC a => DecomposedObjects -> Expr a -> ExprDecomposition inp a-decomposeExpr _ (ConstructWithoutNamed _ fields) = ExprFields fields-decomposeExpr objs (V v) = withObject objs v $ decomposeObjectF namedToExpr-decomposeExpr objs (ObjMan objMan) = case runObjectManipulation objs objMan of-  StillObject obj -> decomposeObjectF unNamedFieldExpr obj-  OnStack comp -> deconstructOnStack comp-decomposeExpr _ ex = deconstructOnStack $ compileExpr ex---- | Decompose any 'IndigoObjectF' with regards to decomposer for field.-decomposeObjectF-  :: forall a inp f . ComplexObjectC a-  => (forall name . f name -> Expr (GetFieldType a name))-  -> IndigoObjectF f a-  -> ExprDecomposition inp a-decomposeObjectF _ (Cell refId) =-  deconstructOnStack $-    IndigoState $ \md -> GenCode (pushNoRef $ mdStack md) (varActionGet @a refId $ mdStack md) L.drop-decomposeObjectF unF (Decomposed fields) =-  ExprFields $ namedToTypedRec @a unF fields---- | Deconstruct top element of the stack and return it--- wrapped into 'Deconstructed' constructor.-deconstructOnStack-  :: forall a inp . ComplexObjectC a-  => IndigoState inp (a : inp)-  -> ExprDecomposition inp a-deconstructOnStack fetchFld =-  Deconstructed $ IndigoState $ \md ->-    let (newSt, clean) = noRefGenCode @(FieldTypes a) (mdStack md) in-    GenCode newSt (gcCode (runIndigoState fetchFld md) # L.deconstruct @a @(FieldTypes a)) clean---------------------------------------------- Helpers---------------------------------------------- | Push the passed stack cells without references to them.-noRefGenCode-  :: forall rs inp . (KnownList rs, AllConstrained KnownValue rs)-  => StackVars inp -> (StackVars (rs ++ inp), (rs ++ inp) :-> inp)-noRefGenCode md = case klist @rs of-  KNil -> (md, L.nop)-  KCons Proxy (_ :: Proxy rest) -> bimap pushNoRef (L.drop #) (noRefGenCode @rest md)
− src/Indigo/Internal/Expr/Symbolic.hs
@@ -1,835 +0,0 @@--- SPDX-FileCopyrightText: 2020 Tocqueville Group------ SPDX-License-Identifier: LicenseRef-MIT-TQ---- | All the basic 'Expr'essions used in Indigo code.------ Note: infix operators acting on structure follow a naming convention:------ 1. the last character identifies the structure type:------      - @:@ for containers ('Map', 'BigMap', 'Set', 'List')---      - @\@@ for storage operations (@MEM@, @GET@, @UPDATE@)---      - @!@ for 'HasField'---      - @~@ fot 'Util.Named'------ 2. the preceding characters identify the action:------      - @#@ for get, lookup or from---      - @!@ for set, update or to---      - @+@ for insert---      - @++@ for insertNew---      - @-@ for remove---      - @?@ for mem or elem------ The only exception to this convention is '(.:)' (for 'cons')--module Indigo.Internal.Expr.Symbolic-  ( -- * Basic-    constExpr, varExpr, cast--  -- * Math-  , add, sub, mul, div, mod, neg, abs-  , (+), (-), (*), (/), (%)--  -- * Comparison-  , eq, neq, lt, gt, le, ge-  , (==), (/=), (<), (>), (<=), (>=)--  -- * Conversion-  , isNat, toInt, nonZero, coerce, forcedCoerce--  -- * Bits and boolean-  , lsl, lsr, and, or, xor, not-  , (<<<), (>>>), (&&), (||), (^)--  -- * Serialization-  , pack, unpack-  , packRaw, unpackRaw--  -- * Pairs-  , pair, car, cdr, fst, snd--  -- * Maybe-  , some, none--  -- * Either-  , right, left--  -- * Bytes and string-  , slice, concat, (<>)--  -- * List-  , concatAll, nil, cons, (.:)--  -- * Containers-  , get, update, insert, remove, mem, size-  , (#:), (!:), (+:), (-:), (?:)-  , empty, emptyBigMap, emptyMap, emptySet--  -- * Storages-  , stGet, stUpdate, stInsert, stInsertNew, stDelete, stMem-  , (#@), (!@), (+@), (++@), (-@), (?@)--  -- * Sum types-  , wrap, unwrap--  -- * HasField-  , (!!), (#!)--  -- * Record and Named-  , name, unName, (!~), (#~)-  , construct, constructRec--  -- * Contract-  , contract-  , self-  , contractAddress-  , contractCallingUnsafe-  , contractCallingString-  , runFutureContract-  , implicitAccount-  , convertEpAddressToContract-  , makeView-  , makeVoid--  -- * Auxiliary-  , now-  , amount-  , sender-  , blake2b-  , sha256-  , sha512-  , hashKey-  , chainId-  , balance-  , checkSignature-  ) where--import Data.Constraint ((\\))-import Data.Vinyl.Core (RMap(..), RecordToList (..))-import Fmt (Buildable)--import Indigo.Internal.Expr.Types-import Indigo.Internal.Field-import Indigo.Internal.Var (Var)-import Indigo.Lorentz hiding (forcedCoerce)-import Indigo.Prelude-import Michelson.Text (unMText)-import qualified Michelson.Typed.Arith as M-import Michelson.Typed.Haskell.Instr.Sum (CtorOnlyField, InstrUnwrapC, InstrWrapOneC)-import Michelson.Untyped.Entrypoints (unsafeBuildEpName)-import Util.TypeTuple--------------------------------------------------------------------------------- Basic-------------------------------------------------------------------------------constExpr :: forall a . NiceConstant a => a -> Expr a-constExpr a = C a \\ niceConstantEvi @a---- | Create an expression holding a variable.-varExpr :: KnownValue a => Var a -> Expr a-varExpr = V--cast :: (ex :~> a) => ex -> Expr a-cast = Cast . toExpr--------------------------------------------------------------------------------- Math-------------------------------------------------------------------------------infixl 6 +-add, (+)-  :: IsArithExpr exN exM M.Add n m-  => exN -> exM-  -> Expr (ArithResHs M.Add n m)-add n m = Add (toExpr n) (toExpr m)-(+) = add--infixl 6 --sub, (-)-  :: IsArithExpr exN exM M.Sub n m-  => exN -> exM-  -> Expr (ArithResHs M.Sub n m)-sub n m = Sub (toExpr n) (toExpr m)-(-) = sub--infixl 7 *-mul, (*)-  :: IsArithExpr exN exM M.Mul n m-  => exN -> exM-  -> Expr (ArithResHs M.Mul n m)-mul n m = Mul (toExpr n) (toExpr m)-(*) = mul--infixl 7 /-div, (/)-  :: IsDivExpr exN exM n m-  => exN -> exM-  -> Expr (EDivOpResHs n m)-div n m = Div (toExpr n) (toExpr m)-(/) = div--infixl 7 %-mod, (%)-  :: IsModExpr exN exM n m-  => exN -> exM-  -> Expr (EModOpResHs n m)-mod n m = Mod (toExpr n) (toExpr m)-(%) = mod--abs-  :: IsUnaryArithExpr exN M.Abs n-  => exN-  -> Expr (UnaryArithResHs M.Abs n)-abs = Abs . toExpr--neg-  :: IsUnaryArithExpr exN M.Neg n-  => exN-  -> Expr (UnaryArithResHs M.Neg n)-neg = Neg . toExpr--------------------------------------------------------------------------------- Comparison-------------------------------------------------------------------------------infix 4 ==-eq, (==)-  :: (NiceComparable n, c :~> n, c1 :~> n)-  => c -> c1-  -> Expr Bool-eq a b = Eq' (toExpr a) (toExpr b)-(==) = eq--infix 4 /=-neq, (/=)-  :: (NiceComparable n, c :~> n, c1 :~> n)-  => c -> c1-  -> Expr Bool-neq a b = Neq (toExpr a) (toExpr b)-(/=) = neq--infix 4 <-lt, (<)-  :: (NiceComparable n, c :~> n, c1 :~> n)-  => c -> c1-  -> Expr Bool-lt a b = Lt (toExpr a) (toExpr b)-(<) = lt--infix 4 >-gt, (>)-  :: (NiceComparable n, c :~> n, c1 :~> n)-  => c -> c1-  -> Expr Bool-gt a b = Gt (toExpr a) (toExpr b)-(>) = gt--infix 4 <=-le, (<=)-  :: (NiceComparable n, c :~> n, c1 :~> n)-  => c -> c1-  -> Expr Bool-le a b = Le (toExpr a) (toExpr b)-(<=) = le--infix 4 >=-ge, (>=)-  :: (NiceComparable n, c :~> n, c1 :~> n)-  => c -> c1-  -> Expr Bool-ge a b = Ge (toExpr a) (toExpr b)-(>=) = ge--------------------------------------------------------------------------------- Conversion-------------------------------------------------------------------------------isNat :: (ex :~> Integer) => ex -> Expr (Maybe Natural)-isNat = IsNat . toExpr--toInt :: (ex :~> Natural) => ex -> Expr Integer-toInt = Int' . toExpr--nonZero :: (ex :~> n, NonZero n, KnownValue (Maybe n)) => ex -> Expr (Maybe n)-nonZero = NonZero . toExpr---- | Convert between types that have the same Michelson representation and an--- explicit permission for that in the face of 'CanCastTo' constraint.-coerce :: forall b a ex. (Castable_ a b, KnownValue b, ex :~> a) => ex -> Expr b-coerce = Coerce . toExpr---- | Convert between expressions of types that have the same Michelson--- representation.-forcedCoerce-  :: forall b a ex. (MichelsonCoercible a b, KnownValue b, ex :~> a)-  => ex -> Expr b-forcedCoerce = ForcedCoerce . toExpr--------------------------------------------------------------------------------- Bits and boolean-------------------------------------------------------------------------------infixl 8 <<<-lsl, (<<<)-  :: IsArithExpr exN exM M.Lsl n m-  => exN -> exM-  -> Expr (ArithResHs M.Lsl n m)-lsl a b = Lsl (toExpr a) (toExpr b)-(<<<) = lsl--infixl 8 >>>-lsr, (>>>)-  :: IsArithExpr exN exM M.Lsr n m-  => exN -> exM-  -> Expr (ArithResHs M.Lsr n m)-lsr a b = Lsr (toExpr a) (toExpr b)-(>>>) = lsr--infixr 2 ||-or, (||)-  :: IsArithExpr exN exM M.Or n m-  => exN -> exM-  -> Expr (ArithResHs M.Or n m)-or a b = Or (toExpr a) (toExpr b)-(||) = or--infixr 3 &&-and, (&&)-  :: IsArithExpr exN exM M.And n m-  => exN -> exM-  -> Expr (ArithResHs M.And n m)-and a b = And (toExpr a) (toExpr b)-(&&) = and--infixr 2 ^-xor, (^)-  :: IsArithExpr exN exM M.Xor n m-  => exN -> exM-  -> Expr (ArithResHs M.Xor n m)-xor a b = Xor (toExpr a) (toExpr b)-(^) = xor--not-  :: IsUnaryArithExpr exN M.Not n-  => exN-  -> Expr (UnaryArithResHs M.Not n)-not = Not . toExpr--------------------------------------------------------------------------------- Serialization-------------------------------------------------------------------------------pack :: (ex :~> a, NicePackedValue a) => ex -> Expr (Packed a)-pack = Pack . toExpr--unpack :: (NiceUnpackedValue a, exb :~> Packed a) => exb -> Expr (Maybe a)-unpack = Unpack . toExpr--packRaw :: (ex :~> a, NicePackedValue a) => ex -> Expr ByteString-packRaw = PackRaw . toExpr--unpackRaw :: (NiceUnpackedValue a, exb :~> ByteString) => exb -> Expr (Maybe a)-unpackRaw = UnpackRaw . toExpr--------------------------------------------------------------------------------- Pairs-------------------------------------------------------------------------------pair :: (ex1 :~> n, ex2 :~> m, KnownValue (n, m)) => ex1 -> ex2 -> Expr (n, m)-pair a b = Pair (toExpr a) (toExpr b)--car, fst :: (op :~> (n, m), KnownValue n) => op -> Expr n-car = fst-fst = Fst . toExpr--cdr, snd :: (op :~> (n, m), KnownValue m) => op -> Expr m-cdr = snd-snd = Snd . toExpr--------------------------------------------------------------------------------- Maybe-------------------------------------------------------------------------------some :: (ex :~> t, KnownValue (Maybe t)) => ex -> Expr (Maybe t)-some = Some . toExpr--none :: KnownValue t => Expr (Maybe t)-none = None--------------------------------------------------------------------------------- Either-------------------------------------------------------------------------------right :: (ex :~> x, KnownValue y, KnownValue (Either y x)) => ex -> Expr (Either y x)-right = Right' . toExpr--left :: (ex :~> y, KnownValue x, KnownValue (Either y x)) => ex -> Expr (Either y x)-left = Left' . toExpr--------------------------------------------------------------------------------- Bytes and string-------------------------------------------------------------------------------slice-  :: ( an :~> Natural-     , bn :~> Natural-     , IsSliceExpr ex c-     )-  => (an, bn) -> ex-  -> Expr (Maybe c)-slice (a, b) ex = Slice (toExpr a) (toExpr b) (toExpr ex)--infixr 6 <>-concat, (<>)-  :: IsConcatExpr exN1 exN2 n-  => exN1 -> exN2-  -> Expr n-concat a b = Concat (toExpr a) (toExpr b)-(<>) = concat--------------------------------------------------------------------------------- List-------------------------------------------------------------------------------infixr 5 .:-cons, (.:) :: (ex1 :~> a, ex2 :~> List a) => ex1 -> ex2 -> Expr (List a)-cons el lst = Cons (toExpr el) (toExpr lst)-(.:) = cons--concatAll :: IsConcatListExpr exN n => exN -> Expr n-concatAll = Concat' . toExpr--nil :: KnownValue a => Expr (List a)-nil = Nil--------------------------------------------------------------------------------- Containers-------------------------------------------------------------------------------class ExprMagma c where-  empty :: (NiceComparable (UpdOpKeyHs c), KnownValue c) => Expr c--instance KnownValue v => ExprMagma (BigMap k v) where-  empty = EmptyBigMap--instance KnownValue v => ExprMagma (Map k v) where-  empty = EmptyMap--instance ExprMagma (Set k) where-  empty = EmptySet---- | Expression class to insert an element into a data structure.------ Note that while this is based on 'update' and 'UpdOpHs', it is necessary to--- have different instances to allow for different 'update' parameter types,--- ('Set' uses a 'Bool' instead of a 'Maybe'), just like 'ExprRemovable'.------ Moreover, this class is parameterized with an @insParam@ as well in order to--- have both key-value pairs ('Map' and 'BigMap') as well as key only ('Set').-class UpdOpHs c => ExprInsertable c insParam where-  insert :: ex :~> c => insParam -> ex -> Expr c--instance (NiceComparable k, exKey :~> k, exValue :~> v)-    => ExprInsertable (BigMap k v) (exKey, exValue) where-  insert (k, v) c = update (k, some v) c--instance (NiceComparable k, exKey :~> k, exValue :~> v)-    => ExprInsertable (Map k v) (exKey, exValue) where-  insert (k, v) c = update (k, some v) c--instance (NiceComparable a, exKey :~> a) => ExprInsertable (Set a) exKey where-  insert k c = update (k, True) c---- | Expression class to remove an element from a data structure.------ Note that while this is based on 'update' and 'UpdOpHs', it is necessary to--- have different instances to allow for different 'update' parameter types,--- ('Set' uses a 'Bool' instead of a 'Maybe').-class UpdOpHs c => ExprRemovable c where-  remove-    :: (exStruct :~> c, exKey :~> UpdOpKeyHs c)-    => exKey -> exStruct -> Expr c--instance (NiceComparable k, KnownValue v) => ExprRemovable (BigMap k v) where-  remove k c = update (k, none) c--instance (NiceComparable k, KnownValue v) => ExprRemovable (Map k v) where-  remove k c = update (k, none) c--instance NiceComparable a => ExprRemovable (Set a) where-  remove k c = update (k, False) c--get-  :: IsGetExpr exKey exMap map-  => exKey -> exMap-  -> Expr (Maybe (GetOpValHs map))-get k m = Get (toExpr k) (toExpr m)--update-  :: IsUpdExpr exKey exVal exMap map-  => (exKey, exVal) -> exMap-  -> Expr map-update (k, v) s = Update (toExpr s) (toExpr k) (toExpr v)--mem-  :: IsMemExpr exKey exN n-  => exKey -> exN-  -> Expr Bool-mem key n = Mem (toExpr key) (toExpr n)--size-  :: IsSizeExpr exN n-  => exN -> Expr Natural-size = Size . toExpr--infixl 8 #:-(#:)-  :: IsGetExpr exKey exMap map-  => exMap -> exKey-  -> Expr (Maybe (GetOpValHs map))-(#:) = flip get--infixl 8 !:-(!:)-  :: IsUpdExpr exKey exVal exMap map-  => exMap -> (exKey, exVal)-  -> Expr map-(!:) = flip update--infixl 8 +:-(+:)-  :: ( ExprInsertable c exParam-     , exStructure :~> c-     )-     => exStructure -> exParam-     -> Expr c-(+:) = flip insert--infixl 8 -:-(-:)-  :: ( ExprRemovable c-     , exStruct :~> c-     , exKey :~> UpdOpKeyHs c-     )-  => exStruct -> exKey-  -> Expr c-(-:) = flip remove--infixl 8 ?:-(?:)-  :: IsMemExpr exKey exN n-  => exN -> exKey-  -> Expr Bool-(?:) = flip mem--emptyBigMap-  :: (KnownValue value, NiceComparable key, KnownValue (BigMap key value))-  => Expr (BigMap key value)-emptyBigMap = empty--emptyMap-  :: (KnownValue value, NiceComparable key, KnownValue (Map key value))-  => Expr (Map key value)-emptyMap = empty--emptySet-  :: (NiceComparable key, KnownValue (Set key))-  => Expr (Set key)-emptySet = empty--------------------------------------------------------------------------------- Storages-------------------------------------------------------------------------------infixr 8 #@-stGet, (#@)-  :: ( StoreHasSubmap store name key value-     , KnownValue value-     , exKey   :~> key-     , exStore :~> store-     )-  => exStore -> (Label name, exKey)-  -> Expr (Maybe value)-stGet store (uName, key) = StGet uName (toExpr key) (toExpr store)-(#@) = stGet--infixl 8 !@-stUpdate, (!@)-  :: ( StoreHasSubmap store name key value-     , exKey   :~> key-     , exVal   :~> Maybe value-     , exStore :~> store-     )-  => exStore -> (Label name, exKey, exVal)-  -> Expr store-stUpdate store (uName, key, val) =-  StUpdate uName (toExpr key) (toExpr val) (toExpr store)-(!@) = stUpdate--infixr 8 +@-stInsert, (+@)-  :: ( StoreHasSubmap store name key value-     , exKey   :~> key-     , exVal   :~> value-     , exStore :~> store-     )-  => exStore -> (Label name, exKey, exVal)-  -> Expr store-stInsert store (uName, key, val) =-  StInsert uName (toExpr key) (toExpr val) (toExpr store)-(+@) = stInsert--infixr 8 ++@-stInsertNew, (++@)-  :: ( StoreHasSubmap store name key value-     , IsError err-     , Buildable err-     , exKey   :~> key-     , exVal   :~> value-     , exStore :~> store-     )-  => exStore-  -> (Label name, err, exKey, exVal)-  -> Expr store-stInsertNew store (uName, err, key, val) =-  StInsertNew uName err (toExpr key) (toExpr val) (toExpr store)-(++@) = stInsertNew--infixl 8 -@-stDelete, (-@)-  :: ( StoreHasSubmap store name key value-     , KnownValue value-     , exKey   :~> key-     , exStore :~> store-     )-  => exStore -> (Label name, exKey)-  -> Expr store-stDelete store (uName, key) = StDelete uName (toExpr key) (toExpr store)-(-@) = stDelete--infixl 8 ?@-stMem, (?@)-  :: ( StoreHasSubmap store name key value-     , KnownValue value-     , exKey   :~> key-     , exStore :~> store-     )-  => exStore -> (Label name, exKey)-  -> Expr Bool-stMem store (uName, key) = StMem uName (toExpr key) (toExpr store)-(?@) = stMem--------------------------------------------------------------------------------- Sum types-------------------------------------------------------------------------------wrap-  :: ( InstrWrapOneC dt name-     , exField :~> CtorOnlyField name dt-     , KnownValue dt-     )-  => Label name-  -> exField-  -> Expr dt-wrap l = Wrap l . toExpr--unwrap-  :: ( InstrUnwrapC dt name-     , exDt :~> dt-     , KnownValue (CtorOnlyField name dt)-     )-  => Label name-  -> exDt-  -> Expr (CtorOnlyField name dt)-unwrap l = Unwrap l . toExpr--------------------------------------------------------------------------------- HasField-------------------------------------------------------------------------------infixl 8 #!-(#!)-  :: (HasField dt name ftype, exDt :~> dt)-  => exDt-  -> Label name-  -> Expr ftype-(#!) (toExpr -> (ObjMan fa)) fName = ObjMan (ToField fa fName)-(#!) exDt fName = ObjMan (ToField (Object $ toExpr exDt) fName)--infixl 8 !!-(!!)-  :: ( HasField dt name ftype-     , exDt :~> dt-     , exFld :~> ftype-     )-  => exDt-  -> (Label name, exFld)-  -> Expr dt-(!!) (toExpr -> (ObjMan fa)) (fName, eFld) = ObjMan (SetField fa fName (toExpr eFld))-dt !! (fName, eFld) = ObjMan (SetField (Object $ toExpr dt) fName (toExpr eFld))--------------------------------------------------------------------------------- Record and Named-------------------------------------------------------------------------------name :: (ex :~> t, KnownValue (name :! t)) => Label name -> ex -> Expr (name :! t)-name lName = Name lName . toExpr--unName :: (ex :~> (name :! t), KnownValue t) => Label name -> ex -> Expr t-unName lName = UnName lName . toExpr--infixl 8 !~-(!~)-  :: (ex :~> t, KnownValue (name :! t))-  => ex -> Label name-  -> Expr (name :! t)-(!~) = flip name--infixl 8 #~-(#~)-  :: (ex :~> (name :! t), KnownValue t)-  => ex -> Label name-  -> Expr t-(#~) = flip unName---- TODO: we should try to make this have a set of 'IsExpr' as input instead of 'Expr'-construct-  :: ( InstrConstructC dt, KnownValue dt-     , RMap (ConstructorFieldTypes dt)-     , RecordToList (ConstructorFieldTypes dt)-     , fields ~ Rec Expr (ConstructorFieldTypes dt)-     , RecFromTuple fields-     )-  => IsoRecTuple fields -> Expr dt-construct = Construct Proxy. recFromTuple--constructRec-  :: ( InstrConstructC dt-     , RMap (ConstructorFieldTypes dt)-     , RecordToList (ConstructorFieldTypes dt)-     , KnownValue dt-     )-  => Rec Expr (ConstructorFieldTypes dt)-  -> Expr dt-constructRec = Construct Proxy--------------------------------------------------------------------------------- Contract-------------------------------------------------------------------------------contract-  :: ( NiceParameterFull p-     , NoExplicitDefaultEntrypoint p-     , ToTAddress p addr-     , ToT addr ~ ToT Address-     , exAddr :~> addr-     )-  => exAddr -> Expr (Maybe (ContractRef p))-contract = Contract . toExpr--self-  :: ( NiceParameterFull p-     , NoExplicitDefaultEntrypoint p-     )-  => Expr (ContractRef p)-self = Self--contractAddress :: (exc :~> ContractRef p) => exc -> Expr Address-contractAddress = ContractAddress . toExpr--contractCallingUnsafe-  :: ( NiceParameter arg-     , exAddr :~> Address-     )-  => EpName -> exAddr -> Expr (Maybe (ContractRef arg))-contractCallingUnsafe epName = ContractCallingUnsafe epName . toExpr--contractCallingString-  :: ( NiceParameter arg-     , exAddr :~> Address-     )-  => MText -> exAddr -> Expr (Maybe (ContractRef arg))-contractCallingString =-    contractCallingUnsafe-  . unsafeBuildEpName-  . unMText--runFutureContract-  :: ( NiceParameter p-     , conExpr :~> FutureContract p-     )-  => conExpr -> Expr (Maybe (ContractRef p))-runFutureContract = RunFutureContract . toExpr--implicitAccount-  :: (exkh :~> KeyHash)-  => exkh-  -> Expr (ContractRef ())-implicitAccount = ImplicitAccount . toExpr--convertEpAddressToContract-  :: ( NiceParameter p-     , epExpr :~> EpAddress-     )-  => epExpr -> Expr (Maybe (ContractRef p))-convertEpAddressToContract = ConvertEpAddressToContract . toExpr--makeView-  :: ( KnownValue (View a r)-     , exa :~> a-     , exCRef :~> ContractRef r-     )-  => exa -> exCRef -> Expr (View a r)-makeView a cRef = MakeView (toExpr a) (toExpr cRef)--makeVoid-  :: ( KnownValue (Void_ a b)-     , exa :~> a-     , exCRef :~> Lambda b b-     )-  => exa -> exCRef -> Expr (Void_ a b)-makeVoid a cRef = MakeVoid (toExpr a) (toExpr cRef)--------------------------------------------------------------------------------- Auxiliary-------------------------------------------------------------------------------now :: Expr Timestamp-now = Now--amount :: Expr Mutez-amount = Amount--sender :: Expr Address-sender = Sender--checkSignature-  :: ( pkExpr :~> PublicKey-     , sigExpr :~> TSignature bs-     , hashExpr :~> bs-     , BytesLike bs-     )-  => pkExpr -> sigExpr -> hashExpr-  -> Expr Bool-checkSignature pk sig hash = CheckSignature (toExpr pk) (toExpr sig) (toExpr hash)--sha256 :: (hashExpr :~> bs, BytesLike bs) => hashExpr -> Expr (Hash Sha256 bs)-sha256 = Sha256 . toExpr--sha512 :: (hashExpr :~> bs, BytesLike bs) => hashExpr -> Expr (Hash Sha512 bs)-sha512 = Sha512 . toExpr--blake2b :: (hashExpr :~> bs, BytesLike bs) => hashExpr -> Expr (Hash Blake2b bs)-blake2b = Blake2b . toExpr--hashKey :: (keyExpr :~> PublicKey) => keyExpr -> Expr KeyHash-hashKey = HashKey . toExpr--chainId :: Expr ChainId-chainId = ChainId--balance :: Expr Mutez-balance = Balance
− src/Indigo/Internal/Expr/TH.hs
@@ -1,130 +0,0 @@--- SPDX-FileCopyrightText: 2020 Tocqueville Group------ SPDX-License-Identifier: LicenseRef-MIT-TQ--{-# LANGUAGE QuasiQuotes #-}--module Indigo.Internal.Expr.TH-       ( deriveExprBuildable-       ) where--import qualified Data.Map as M-import qualified Data.Set as S-import Language.Haskell.TH-import Language.Haskell.TH.Syntax-import qualified Language.Haskell.TH.Syntax as TH-import Prelude hiding (Const)-import qualified Text.Casing as C--pattern CName :: String -> (TH.Name, [BangType])-pattern CName nm <- (TH.Name (OccName nm) _, _)--type UntypedConstr = (Name, [BangType])---- | Generates an Buildable instance for a Expr GADT. /Note:/ This will not generate--- additional constraints to the generated instance if those are required.--- Inspired by 'deriveGADTNFData' from Util.TH.-deriveExprBuildable :: Name -> Q [Dec]-deriveExprBuildable name = do-  TyConI (DataD _ dataName vars _ cons _) <- reify name--  let getNameFromVar (PlainTV n) = n-      getNameFromVar (KindedTV n _) = n-      convertTyVars orig = foldr (\a b -> AppT b . VarT $ getNameFromVar a) orig vars--      -- Unfolds multiple constructors of form "A, B, C :: A -> Stuff"-      -- into a list of tuples of constructor names and their data-      unfoldConstructor (GadtC cs bangs _) = map (,bangs) cs-      unfoldConstructor (ForallC _ _ c) = unfoldConstructor c-      unfoldConstructor _ = fail "Non GADT constructors are not supported."--      (bLeft, bRight, comma) = (LitE (StringL "("), LitE (StringL ")"), LitE (StringL ", "))--      mappendAll :: [Exp] -> Exp-      mappendAll [] = error "impossible empty list"-      mappendAll (hd : rest) = foldl (\res term -> InfixE (Just res) (VarE (mkName "<>")) (Just term)) hd rest--      omitUnaryConstr :: (Exp -> Exp) -> UntypedConstr -> Q Clause-      omitUnaryConstr fun (conName, _) = do-        var <- newName "a"-        return $-          Clause-            [ConP conName [VarP var]]-            (NormalB $ fun (VarE var))-            []--      -- Specific to Expr-      toFunName (CName "Right'") = "right"-      toFunName (CName "Left'")  = "left"-      toFunName (CName "Concat'") = "concatAll"-      toFunName (CName "Int'")  = "toInt"-      toFunName (TH.Name (OccName nm) _, _) = C.toCamel $ C.fromHumps nm--      operators :: Map String String-      operators = M.fromList [ ("Add", "+"), ("Sub", "-"), ("Mul", "*"), ("Div", "/"), ("Mod", "%")-                             , ("Lsl", "<<<"), ("Lsr", ">>>"), ("Eq'", "=="), ("Neq", "/="), ("Le", "=<")-                             , ("Lt", "<"), ("Ge", ">="), ("Gt", ">="), ("Or", "||"), ("Xor", "^"), ("And", "&&")-                             , ("Cons", ".:"), ("Concant", "<>")-                             ]--      braces :: Set String-      braces = S.fromList ["Add", "Sub", "Or", "Xor", "Lsl", "Lsr"]--      makeClause :: UntypedConstr -> Q Clause-      makeClause c@(CName "C") = omitUnaryConstr (AppE (VarE $ mkName "pretty") . AppE (ConE $ mkName "PrintAsValue")) c-      makeClause c@(CName "V") = omitUnaryConstr (AppE (VarE $ mkName "pretty")) c-      makeClause c@(CName "ObjMan") = omitUnaryConstr (AppE (VarE $ mkName "pretty"))  c-      makeClause c@(CName "Construct") = construct c-      makeClause c@(CName "ConstructWithoutNamed") = construct c-      makeClause c@(CName "StInsertNew") =-        generalClauseImpl "pretty" c Nothing-      makeClause c@(TH.Name (OccName nm) _, _) =-        generalClauseImpl "pretty" c $ (, S.member nm braces) <$> M.lookup nm operators--      construct (conName, _) = do-        proxy <- newName "proxy"-        r <- newName "rec"-        let showTypeRep = AppE (VarE $ mkName "show") . AppE (VarE $ mkName "typeRep")-        mappendRec <- [| \x -> mconcat (intersperse "," (recordToList (rmap (\ex -> Const (pretty ex)) x))) |]-        return $-          Clause-            [ConP conName [VarP proxy, VarP r]]-            (NormalB $-              mappendAll [showTypeRep (VarE proxy), bLeft, (AppE mappendRec (VarE r)), bRight])-            []--      -- Constructs a clause "build (ConName a1 a2) = "CON_NAME" <> "(" <> pretty a1 <> pretty a2 <> ")"-      -- The first argument is a workaround: it returns name of printing function either "pretty" or "show"-      -- by index argument.-      -- This is mainly for 'StInsertNew' constructor to print error with show-      generalClauseImpl :: String -> (Name, [BangType]) -> Maybe (String, Bool) -> Q Clause-      generalClauseImpl funName c@(conName, bangs) isInfix = do-        varNames <- traverse (\_ -> newName "a") bangs-        -- useful constants-        let funStr = LitE (StringL $ toFunName c)-        let pretties =-              case map (\e -> AppE (VarE $ mkName funName) (VarE e)) varNames of-                -- Nullary operator: "function_name"-                []    -> [funStr]-                -- Infix binary operator without braces: pretty x <> " operator " <> pretty y-                [x, y] | Just (op, False) <- isInfix ->-                  [x, LitE (StringL $ " " <> op <> " "), y]-                -- Infix binary operator with braces: "(" <> pretty x <> " operator " <> pretty y <> ")"-                [x, y] | Just (op, True) <- isInfix ->-                  [bLeft, x, LitE (StringL $ " " <> op <> " "), y, bRight]-                -- Infix binary operator with braces: "function_name" <> "(" <> pretty x1 <> "," ... <> pretty xn <> ")"-                xs -> funStr : bLeft : (intersperse comma xs ++ [bRight])-        return $-          Clause-            [ConP conName $ map VarP varNames]-            (NormalB $ mappendAll pretties)-            []--  clauses <- traverse makeClause $ cons >>= unfoldConstructor-  return-    [ InstanceD-        Nothing-        []-        (AppT (ConT $ mkName "Buildable") (convertTyVars $ ConT dataName))-        [FunD (mkName "build") clauses]-    ]
− src/Indigo/Internal/Expr/Types.hs
@@ -1,506 +0,0 @@--- SPDX-FileCopyrightText: 2020 Tocqueville Group------ SPDX-License-Identifier: LicenseRef-MIT-TQ---- | 'Expr' data type and its generalizations--module Indigo.Internal.Expr.Types-  ( -- * The Expr data type-    Expr (..)--  -- * Generalizations of Expr-  , IsExpr-  , ToExpr-  , ExprType-  , (:~>)-  , toExpr--  -- * Arithmetic Expr-  , IsArithExpr-  , IsUnaryArithExpr--  -- * Polymorphic Expr-  , IsConcatExpr-  , IsConcatListExpr-  , IsDivExpr-  , IsModExpr-  , IsGetExpr-  , IsMemExpr-  , IsSizeExpr-  , IsSliceExpr-  , IsUpdExpr--  , ObjectManipulation (..)-  , ObjectExpr-  , NamedFieldExpr (..)-  ) where--import Prelude hiding (Const (..))-import qualified Data.Kind as Kind-import Data.Vinyl.Core (RMap(..), RecordToList(..))-import Data.Vinyl.Functor (Const (..))-import Data.Typeable (typeRep)-import Fmt (Buildable (..), pretty)--import Indigo.Lorentz-import Indigo.Internal.Expr.TH (deriveExprBuildable)-import Indigo.Internal.Field-import Indigo.Internal.Object (ComplexObjectC, FieldTypes, IndigoObjectF (..))-import Indigo.Internal.Var (Var (..))-import qualified Michelson.Typed.Arith as M-import Michelson.Typed (GetFieldType, CtorOnlyField, InstrUnwrapC, InstrWrapOneC)--------------------------------------------------------------------------------- The Expr data type-------------------------------------------------------------------------------data Expr a where-  C :: NiceConstant a => a -> Expr a--  V :: KnownValue a => Var a -> Expr a--  ObjMan :: ObjectManipulation a -> Expr a--  Cast :: KnownValue a => Expr a -> Expr a--  Size :: SizeOpHs c => Expr c -> Expr Natural--  Update-    :: (UpdOpHs c, KnownValue c)-    => Expr c -> Expr (UpdOpKeyHs c) -> Expr (UpdOpParamsHs c) -> Expr c--  Add-    :: (ArithOpHs M.Add n m, KnownValue (ArithResHs M.Add n m))-    => Expr n -> Expr m -> Expr (ArithResHs M.Add n m)--  Sub-    :: (ArithOpHs M.Sub n m, KnownValue (ArithResHs M.Sub n m))-    => Expr n -> Expr m -> Expr (ArithResHs M.Sub n m)--  Mul-    :: (ArithOpHs M.Mul n m, KnownValue (ArithResHs M.Mul n m))-    => Expr n -> Expr m -> Expr (ArithResHs M.Mul n m)--  Div-    :: (EDivOpHs n m, KnownValue (EDivOpResHs n m))-    => Expr n -> Expr m -> Expr (EDivOpResHs n m)--  Mod-    :: (EDivOpHs n m, KnownValue (EModOpResHs n m))-    => Expr n -> Expr m -> Expr (EModOpResHs n m)--  Abs-    :: (UnaryArithOpHs M.Abs n, KnownValue (UnaryArithResHs M.Abs n))-    => Expr n -> Expr (UnaryArithResHs M.Abs n)--  Neg-    :: (UnaryArithOpHs M.Neg n, KnownValue (UnaryArithResHs M.Neg n))-    => Expr n -> Expr (UnaryArithResHs M.Neg n)---  Lsl-    :: (ArithOpHs M.Lsl n m, KnownValue (ArithResHs M.Lsl n m))-    => Expr n -> Expr m -> Expr (ArithResHs M.Lsl n m)--  Lsr-    :: (ArithOpHs M.Lsr n m, KnownValue (ArithResHs M.Lsr n m))-    => Expr n -> Expr m -> Expr (ArithResHs M.Lsr n m)---  Eq' :: NiceComparable n => Expr n -> Expr n -> Expr Bool--  Neq :: NiceComparable n => Expr n -> Expr n -> Expr Bool--  Le :: NiceComparable n => Expr n -> Expr n -> Expr Bool--  Lt :: NiceComparable n => Expr n -> Expr n -> Expr Bool--  Ge :: NiceComparable n => Expr n -> Expr n -> Expr Bool--  Gt :: NiceComparable n => Expr n -> Expr n -> Expr Bool--  Or-    :: (ArithOpHs M.Or n m, KnownValue (ArithResHs M.Or n m))-    => Expr n -> Expr m -> Expr (ArithResHs M.Or n m)--  Xor-    :: (ArithOpHs M.Xor n m, KnownValue (ArithResHs M.Xor n m))-    => Expr n -> Expr m -> Expr (ArithResHs M.Xor n m)--  And-    :: (ArithOpHs M.And n m, KnownValue (ArithResHs M.And n m))-    => Expr n -> Expr m -> Expr (ArithResHs M.And n m)--  Not-    :: (UnaryArithOpHs M.Not n, KnownValue (UnaryArithResHs M.Not n))-    => Expr n -> Expr (UnaryArithResHs M.Not n)--  Int' :: Expr Natural -> Expr Integer--  IsNat :: Expr Integer -> Expr (Maybe Natural)--  Coerce-    :: (Castable_ a b, KnownValue b)-    => Expr a -> Expr b--  ForcedCoerce-    :: (MichelsonCoercible a b, KnownValue b)-    => Expr a -> Expr b--  Fst :: KnownValue n => Expr (n, m) -> Expr n-  Snd :: KnownValue m => Expr (n, m) -> Expr m--  Pair :: KnownValue (n, m) => Expr n -> Expr m -> Expr (n, m)--  Some :: KnownValue (Maybe t) => Expr t -> Expr (Maybe t)-  None :: KnownValue t => Expr (Maybe t)--  Right' :: (KnownValue y, KnownValue (Either y x)) => Expr x -> Expr (Either y x)-  Left' :: (KnownValue x, KnownValue (Either y x)) => Expr y -> Expr (Either y x)--  Mem :: MemOpHs c => Expr (MemOpKeyHs c) -> Expr c -> Expr Bool--  StGet-    :: ( StoreHasSubmap store name key value-       , KnownValue value-       )-    => Label name -> Expr key -> Expr store -> Expr (Maybe value)--  StInsertNew-    :: ( StoreHasSubmap store name key value-       , KnownValue store-       , IsError err-       , Buildable err-       )-    => Label name -> err-    -> Expr key -> Expr value -> Expr store -> Expr store--  StInsert-    :: (StoreHasSubmap store name key value, KnownValue store)-    => Label name-    -> Expr key -> Expr value -> Expr store -> Expr store--  StMem-    :: ( StoreHasSubmap store name key val-       , KnownValue val-       )-    => Label name -> Expr key -> Expr store -> Expr Bool--  StUpdate-    :: (StoreHasSubmap store name key val, KnownValue store)-    => Label name -> Expr key -> Expr (Maybe val) -> Expr store -> Expr store--  StDelete-    :: (StoreHasSubmap store name key val, KnownValue store, KnownValue val)-    => Label name -> Expr key -> Expr store -> Expr store--  Wrap-    :: ( InstrWrapOneC dt name-       , KnownValue dt-       )-    => Label name-    -> Expr (CtorOnlyField name dt)-    -> Expr dt-  Unwrap-    :: ( InstrUnwrapC dt name-       , KnownValue (CtorOnlyField name dt)-       )-    => Label name-    -> Expr dt-    -> Expr (CtorOnlyField name dt)--  Construct-    :: ( InstrConstructC dt-       , RMap (ConstructorFieldTypes dt)-       , RecordToList (ConstructorFieldTypes dt)-       , KnownValue dt-       )-    => Proxy dt -> Rec Expr (ConstructorFieldTypes dt) -> Expr dt--  -- TODO remove Construct and rename this one-  ConstructWithoutNamed-    :: ComplexObjectC dt-    => Proxy dt -> Rec Expr (FieldTypes dt) -> Expr dt--  Name-    :: KnownValue (name :! t)-    => Label name -> Expr t -> Expr (name :! t)-  UnName-    :: KnownValue t-    => Label name -> Expr (name :! t) -> Expr t--  EmptySet-    :: (NiceComparable key, KnownValue (Set key))-    => Expr (Set key)--  Get-    :: ( GetOpHs c-       , KnownValue (Maybe (GetOpValHs c))-       , KnownValue (GetOpValHs c)-       )-    => Expr (GetOpKeyHs c) -> Expr c -> Expr (Maybe (GetOpValHs c))--  EmptyMap-    :: (KnownValue value, NiceComparable key, KnownValue (Map key value))-    => Expr (Map key value)--  EmptyBigMap-    :: (KnownValue value, NiceComparable key, KnownValue (BigMap key value))-    => Expr (BigMap key value)--  Pack-    :: NicePackedValue a-    => Expr a -> Expr (Packed a)--  Unpack-    :: NiceUnpackedValue a-    => Expr (Packed a) -> Expr (Maybe a)--  PackRaw-    :: NicePackedValue a-    => Expr a -> Expr ByteString--  UnpackRaw-    :: NiceUnpackedValue a-    => Expr ByteString -> Expr (Maybe a)--  Cons :: KnownValue (List a) => Expr a -> Expr (List a) -> Expr (List a)--  Nil :: KnownValue a => Expr (List a)--  Concat-    :: (ConcatOpHs c, KnownValue c)-    => Expr c -> Expr c -> Expr c--  Concat'-    :: (ConcatOpHs c, KnownValue c)-    => Expr (List c) -> Expr c--  Slice-    :: (SliceOpHs c, KnownValue c)-    => Expr Natural -> Expr Natural -> Expr c -> Expr (Maybe c)--  Contract-    :: ( NiceParameterFull p-       , NoExplicitDefaultEntrypoint p-       , ToTAddress p addr-       , ToT addr ~ ToT Address-       )-    => Expr addr -> Expr (Maybe (ContractRef p))--  Self-    :: ( NiceParameterFull p-       , NoExplicitDefaultEntrypoint p-       )-    => Expr (ContractRef p)--  ContractAddress-    :: Expr (ContractRef p) -> Expr Address--  ContractCallingUnsafe-    :: NiceParameter arg-    => EpName -> Expr Address -> Expr (Maybe (ContractRef arg))--  RunFutureContract-    :: NiceParameter p-    => Expr (FutureContract p) -> Expr (Maybe (ContractRef p))--  ImplicitAccount :: Expr KeyHash -> Expr (ContractRef ())--  ConvertEpAddressToContract-    :: NiceParameter p => Expr EpAddress -> Expr (Maybe (ContractRef p))--  MakeView-    :: KnownValue (View a r)-    => Expr a -> Expr (ContractRef r) -> Expr (View a r)--  MakeVoid-    :: KnownValue (Void_ a b)-    => Expr a -> Expr (Lambda b b) -> Expr (Void_ a b)--  CheckSignature-    :: BytesLike bs => Expr PublicKey -> Expr (TSignature bs) -> Expr bs -> Expr Bool--  Sha256 :: BytesLike bs => Expr bs -> Expr (Hash Sha256 bs)-  Sha512 :: BytesLike bs => Expr bs -> Expr (Hash Sha512 bs)-  Blake2b :: BytesLike bs => Expr bs -> Expr (Hash Blake2b bs)-  HashKey :: Expr PublicKey -> Expr KeyHash--  ChainId :: Expr ChainId--  Now :: Expr Timestamp-  Amount :: Expr Mutez-  Balance :: Expr Mutez-  Sender :: Expr Address--  Exec-    :: KnownValue b-    => Expr a -> Expr (Lambda a b) -> Expr b--  NonZero-    :: (NonZero n, KnownValue (Maybe n))-    => Expr n -> Expr (Maybe n)--------------------------------------------------------------------------------- Object manipulation--------------------------------------------------------------------------------- | Datatype describing access to an inner fields of object, like--- @object !. field1 !. field2 ~. (field3, value3) ~. (field4, value4)@-data ObjectManipulation a where-  Object :: Expr a -> ObjectManipulation a--  ToField-    :: HasField dt fname ftype-    => ObjectManipulation dt-    -> Label fname-    -> ObjectManipulation ftype--  -- NB. @SetField (Object expr) field1-  --       (ObjMan $ SetField (ToField (Object expr) field1) field2 targetExpr)@-  -- is a bad representation, which will cause generation of not optimal code-  -- (like expr would be materialized object),-  -- so it would be nice to enforce only-  -- @SetField (Object expr) (field1 . field2) targetExpr@ representation.-  SetField-    :: HasField dt fname ftype-    => ObjectManipulation dt-    -> Label fname-    -> Expr ftype-    -> ObjectManipulation dt--instance Buildable (ObjectManipulation a) where-  build (Object e) = build e-  build (ToField oman lab) = pretty oman <> " #! " <> pretty lab-  build (SetField oman lab fEx) = pretty oman <> " !! (" <> pretty lab <> ", " <> pretty fEx <> ")"---- | Auxiliary datatype where each field refers to--- an expression the field equals to. It's not recursive one.-data NamedFieldExpr a name where-  NamedFieldExpr-    :: { unNamedFieldExpr :: Expr (GetFieldType a name) }-    -> NamedFieldExpr a name--type ObjectExpr a = IndigoObjectF (NamedFieldExpr a) a--------------------------------------------------------------------------------- Generalizations of Expr-------------------------------------------------------------------------------type IsExpr op n = (ToExpr op, ExprType op ~ n, KnownValue n)-type (:~>) op n = IsExpr op n--type ExprType a = ExprType' (Decide a) a--toExpr :: forall a . ToExpr a => a -> Expr (ExprType a)-toExpr = toExpr' @(Decide a) @a--class ToExpr' (Decide x) x => ToExpr x-instance ToExpr' (Decide x) x => ToExpr x---- This type class is needed to cope with overlapping instances.-class ToExpr' decision c where-  type family ExprType' decision c :: Kind.Type-  toExpr' :: c -> Expr (ExprType' decision c)---- Instance for a var-instance KnownValue (a :: Kind.Type) => ToExpr' 'VarD (Var a) where-  type instance ExprType' 'VarD (Var a) = a-  toExpr' = V---- Instance for a value-instance NiceConstant a => ToExpr' 'ValD a where-  type instance ExprType' 'ValD a = a-  toExpr' = C---- Instance for StructManipulation-instance ToExpr' 'ObjManD (ObjectManipulation a) where-  type instance ExprType' 'ObjManD (ObjectManipulation a) = a-  toExpr' = ObjMan---- Instance for Expr itself-instance ToExpr' 'ExprD (Expr a) where-  type instance ExprType' 'ExprD (Expr a) = a-  toExpr' = id--data Decision = VarD | ValD | ExprD | ObjManD--type family Decide x :: Decision where-  Decide (Var _) = 'VarD-  Decide (Expr _) = 'ExprD-  Decide (ObjectManipulation _) = 'ObjManD-  Decide _ = 'ValD--type IsUnaryArithExpr exN a n =-  ( exN :~> n-  , UnaryArithOpHs a n-  , KnownValue (UnaryArithResHs a n)-  )--type IsArithExpr exN exM a n m =-  ( exN :~> n, exM :~> m-  , ArithOpHs a n m-  , KnownValue (ArithResHs a n m)-  )--type IsDivExpr exN exM n m =-  ( exN :~> n, exM :~> m-  , EDivOpHs n m-  , KnownValue (EDivOpResHs n m)-  )--type IsModExpr exN exM n m =-  ( exN :~> n, exM :~> m-  , EDivOpHs n m-  , KnownValue (EModOpResHs n m)-  )--type IsConcatExpr exN1 exN2 n =-  ( exN1 :~> n-  , exN2 :~> n-  , ConcatOpHs n-  )--type IsConcatListExpr exN n =-  ( exN :~> List n-  , ConcatOpHs n-  , KnownValue n-  )--type IsSliceExpr exN n =-  ( exN :~> n-  , SliceOpHs n-  )--type IsGetExpr exKey exMap map =-  ( exKey :~> GetOpKeyHs map-  , exMap :~> map-  , GetOpHs map-  , KnownValue (GetOpValHs map)-  )--type IsUpdExpr exKey exVal exMap map =-  ( exKey :~> UpdOpKeyHs map-  , exVal :~> UpdOpParamsHs map-  , exMap :~> map-  , UpdOpHs map-  )--type IsMemExpr exKey exN n =-  ( exKey :~> MemOpKeyHs n-  , exN :~> n-  , MemOpHs n-  )--type IsSizeExpr exN n =-  ( exN :~> n-  , SizeOpHs n-  )----data Expr2 a where---  C2 :: (NiceConstant a, HasNoOp (ToT a)) => a -> Expr2 a------instance Buildable (Expr2 a) where---  build (C2 (x :: a)) = pretty (toVal x)--deriveExprBuildable ''Expr
− src/Indigo/Internal/Field.hs
@@ -1,135 +0,0 @@--- SPDX-FileCopyrightText: 2020 Tocqueville Group------ SPDX-License-Identifier: LicenseRef-MIT-TQ--{- | This module contains a datatype representing a lens to a field,-helpers to compose new lens, and type class like StoreHasField returning a lens. -}--module Indigo.Internal.Field-       ( AccessFieldC-       , fetchField-       , assignField--       -- * Lens-       , FieldLens (..)-       , flSFO-       -- * HasLens-       , HasField (..)-       , fieldLensDeeper-       , fieldLensADT-       ) where--import Data.Vinyl (RElem)-import Data.Vinyl.Lens (rget, rput)-import Data.Vinyl.TypeLevel (RIndex)-import GHC.TypeLits (KnownSymbol)--import Indigo.Lorentz-import Indigo.Prelude-import qualified Lorentz.ADT as L-import Michelson.Typed.Haskell.Instr.Product-  (ConstructorFieldNames, GetFieldType, InstrGetFieldC, InstrSetFieldC)---- | Constraint to access/assign field stored in Rec-type AccessFieldC a name =-  RElem name (ConstructorFieldNames a) (RIndex name (ConstructorFieldNames a))---- | Get a field from list of fields-fetchField-  :: forall a name f proxy . AccessFieldC a name-  => proxy name -> Rec f (ConstructorFieldNames a) -> f name-fetchField _ = rget @name---- | Assign a field to a value-assignField-  :: forall a name f proxy . AccessFieldC a name-  => proxy name -> f name -> Rec f (ConstructorFieldNames a) -> Rec f (ConstructorFieldNames a)-assignField _ = rput @name---- | Lens to a field.--- @obj.f1.f2.f3@ is represented as list names of @[f1, f2, f3]@.------ @dt@ is a type of source object (type of obj in example above)--- @fname@ is a name of target field (@"f3"@ in example above)--- @ftype@ is a type of target field------ However, a lens contains not only name of field--- but for each field it contains operations to get and set--- target field.-data FieldLens dt fname ftype where-  -- Direct field of @dt@ (which is target one).-  -- Pay attention that it holds a label of existential type @fname@ but not @targetFName@.-  -- It's made to allow a developer to refer to a field-  -- with a custom name.-  -- The another argument is 'StoreFieldOps'.-  TargetField-    :: ( InstrGetFieldC dt fname-       , InstrSetFieldC dt fname-       , GetFieldType dt fname ~ targetFType-       , AccessFieldC dt fname-       )-    => Label fname-    -> StoreFieldOps dt targetFName targetFType-    -> FieldLens dt targetFName targetFType--  -- Deeper field of @dt@.-  -- It takes a label with name of direct field and-  -- 'HasField' with deeper field as source and-  -- with the same target field,-  -- so it's how this datatype is alike list of fields.-  -- The last argument is Lorentz operations to get and set target field.-  DeeperField-    :: ( AccessFieldC dt fname-       , InstrSetFieldC dt fname-       , HasField (GetFieldType dt fname) targetFName targetFType-       )-    => Label fname-    -> StoreFieldOps dt targetFName targetFType-    -> FieldLens dt targetFName targetFType---- | Access to 'StoreFieldOps'-flSFO :: FieldLens dt fname ftype -> StoreFieldOps dt fname ftype-flSFO (TargetField _ sfo) = sfo-flSFO (DeeperField _ sfo) = sfo---- | Class like 'StoreHasField' type class but holding a lens to a field.-class (KnownValue ftype, KnownValue dt) => HasField dt fname ftype | dt fname -> ftype  where-  fieldLens :: FieldLens dt fname ftype---- | Build a lens to a direct field of an object.-fieldLensADT-  :: forall dt targetFName targetFType fname  .-  ( InstrGetFieldC dt fname-  , InstrSetFieldC dt fname-  , GetFieldType dt fname ~ targetFType-  , AccessFieldC dt fname-  )- => Label fname -> FieldLens dt targetFName targetFType-fieldLensADT lb =-  let sfo = storeFieldOpsADT @dt @fname in-  TargetField lb $ storeFieldOpsReferTo lb sfo---- | Build a lens to deeper field of an object.-fieldLensDeeper-  :: forall dt targetName targetType fname .-  ( AccessFieldC dt fname-  , L.HasFieldOfType dt fname (GetFieldType dt fname)-  , HasField (GetFieldType dt fname) targetName targetType-  )-  => Label fname-  -> FieldLens dt targetName targetType-fieldLensDeeper lb =-  DeeperField lb (composeStoreFieldOps lb (storeFieldOpsADT @dt) (flSFO fieldLens))---- | Default instance for datatype and its direct field name.--- It will be useful unless you want to refer to a field using a custom name.-instance {-# OVERLAPPABLE #-}-         ( InstrSetFieldC dt fname-         , InstrGetFieldC dt fname-         , GetFieldType dt fname ~ ftype-         , AccessFieldC dt fname-         , KnownSymbol fname-         , KnownValue ftype, KnownValue dt-         )-         => HasField dt fname ftype where-  fieldLens = TargetField (Label @fname) storeFieldOpsADT
− src/Indigo/Internal/Lookup.hs
@@ -1,377 +0,0 @@--- SPDX-FileCopyrightText: 2020 Tocqueville Group------ SPDX-License-Identifier: LicenseRef-MIT-TQ--{- |-This module contains the logic to lookup 'Var's in a stack and the actions to-manipulate it.--For efficiency, actions are implemented using Lorentz macros.-To do so every necessary constraint is checked at runtime.--}--module Indigo.Internal.Lookup-  ( -- * Variable Lookup Actions-    varActionGet-  , varActionSet-  , varActionUpdate-  , varActionOperation--  -- * Vinyl manipulation helpers-  , rtake-  , rdrop-  ) where--import Data.Constraint (Dict(..), HasDict)-import Data.Singletons (Sing, SingI(..))-import Data.Type.Equality (TestEquality(..))-import Data.Typeable ((:~:)(..), eqT, typeRep)-import Data.Vinyl ((<+>))-import Data.Vinyl.TypeLevel (type (++))-import Fmt (pretty)-import Prelude hiding (tail)--import Indigo.Internal.Var-  (HasSideEffects, Ops, RefId, StackVars(..), StackVars', StkEl(..), Var(..), operationsVar)-import Indigo.Lorentz-import qualified Lorentz.Instr as L-import qualified Lorentz.Macro as L-import Michelson.Typed (ToTs)-import qualified Michelson.Typed.Instr as MI-import qualified Michelson.Typed.T as MI-import Util.Peano--------------------------------------------------------------------------------- Variable Lookup Actions--------------------------------------------------------------------------------- | Puts a copy of the value for the given 'Var' on top of the stack-varActionGet :: forall a stk . KnownValue a => RefId -> StackVars stk -> stk :-> a : stk-varActionGet _ FailureStack = error "You try to get a cell on failure stack"-varActionGet ref (StkElements stk) = case varDepth @a ref stk of-  VarDepth n -> duupXVar n ref stk---- | Sets the value for the given 'Var' to the topmost value on the stack-varActionSet :: forall a stk . KnownValue a => RefId -> StackVars stk -> a : stk :-> stk-varActionSet _ FailureStack = error "You try to set a cell on failure stack"-varActionSet ref (StkElements stk) = case varDepth @a ref stk of-  VarDepth n -> replaceNVar (SS n) ref (NoRef :& stk)---- | Updates the value for the given 'Var' with the topmost value on the stack--- using the given binary instruction.-varActionUpdate-  :: forall a b stk . (KnownValue a, KnownValue b)-  => RefId-  -> StackVars stk-  -> '[b, a] :-> '[a]-  -> (b ': stk) :-> stk-varActionUpdate _ FailureStack _ = error "You try to update a cell on failure stack"-varActionUpdate v (StkElements stk) instr = case varDepth @a v stk of-  VarDepth n -> updateNVar (SS n) v (NoRef :& stk) instr---- | Given a stack with a list of 'Operation's on its bottom, updates it by--- appending the 'Operation' on the top.-varActionOperation-  :: HasSideEffects-  => StackVars stk-  -> (Operation ': stk) :-> stk-varActionOperation s =-  case operationsVar of-    Var refId -> varActionUpdate @Ops refId s L.cons--------------------------------------------------------------------------------- Variable-based Macros--------------------------------------------------------------------------------- | Like 'varActionGet', but requires the depth of the 'Var' in the input stack-duupXVar-  :: forall inp a (m :: Peano) s tail.-     ( HasCallStack-     , KnownValue a, KnownPeano m, SingI m-     , s ~ ((Take m inp) ++ (a ':  a ': Drop ('S m) inp))-     , tail ~ (Drop ('S m) inp)-     )-  => Sing m -> RefId -> StackVars' inp -> inp :-> (a ': inp)-duupXVar m v stk =-  withVarMaybeDict (duupXClassConstraint n stk a s tail) $-    L.duupXImpl @('S m) @inp @a @s @tail-  where-    a = Ref @a v-    n = SS m-    s = (rtake m stk) <+> (a :& a :& rdrop n stk)-    tail = rdrop n stk---- | Like 'varActionSet', but requires the depth of the 'Var' in the input stack-replaceNVar-  :: forall s a (n :: Peano) mid tail.-     ( HasCallStack-     , KnownValue a-     , mid ~ (Take n (a ': s) ++ Drop n s)-     , tail ~ Drop n s-     )-  => Sing n -> RefId -> StackVars' (a ': s) -> (a ': s) :-> s-replaceNVar n v stk@(_ :& s) =-  withVarMaybeDict (replaceNClassConstraint n s (Ref @a v) mid tail) $-    L.replaceNImpl @n @s @a @mid @tail-  where-    mid = rtake n stk <+> rdrop n s-    tail = rdrop n s---- | Like 'varActionUpdate', but requires the depth of the 'Var' in the input stack-updateNVar-  :: forall s a b mid tail (n :: Peano).-     ( HasCallStack-     , KnownValue b-     , tail ~ Drop n s-     , mid ~ ((Drop ('S 'Z) (Take n (a ': s))) ++ (a ': Drop n (a ': s)))-     )-  => Sing n -> RefId -> StackVars' (a ': s)-  -> '[a, b] :-> '[b]-  -> (a ': s) :-> s-updateNVar n v stk@(a :& s) instr =-  withVarMaybeDict (updateNClassConstraint n s a (Ref @b v) mid tail) $-    L.updateNImpl @n @s @a @b @mid @tail instr-  where-    mid = rdrop (SS SZ) (rtake n stk) <+> a :& rdrop n stk-    tail = rdrop n s--withVarMaybeDict :: (HasDict c e, HasCallStack) => Maybe e -> (c => r) -> r-withVarMaybeDict mDict = withDict (fromMaybe (error constraintFailure) mDict)-  where-    -- NOTE: provided that the 'VarDepth' is correctly calculated every place-    -- where this is used should never result in a 'Nothing', as this is only-    -- necessary to prove to GHC properties that always hold.-    -- For this reason a failure here is always unexpected-    constraintFailure = "Unexpected failure in Var's constraint checking"--------------------------------------------------------------------------------- Variable's Depth--------------------------------------------------------------------------------- | Keeps the 0-indexed depth of a variable as a 'Peano' 'Sing'leton-data VarDepth where-  VarDepth-    :: forall idx . (KnownPeano idx, SingI idx)-    => Sing (idx :: Peano) -> VarDepth---- | Calculates the 'VarDepth' of the given 'Var' in the stack-varDepth-  :: forall a s. KnownValue a-  => RefId-  -> StackVars' s-  -> VarDepth-varDepth refId = \case-  RNil -> error $-    "You are looking for manually created or leaked variable. " <>-    pretty refId <> " of type " <> show (typeRep (Proxy @a))-  stk@(_ :& _) -> varDepthNonEmpty @a refId stk--varDepthNonEmpty-  :: forall a s x xs. (KnownValue a, s ~ (x : xs))-  => RefId -> StackVars' s -> VarDepth-varDepthNonEmpty ref (x :& xs) = case x of-  Ref topRef | ref == topRef -> case eqT @a @x of-    Just Refl -> VarDepth SZ-    Nothing   -> error $-      "Invalid variable type. " <> pretty ref <>-      ".\nWas looking for a " <> show (typeRep $ Proxy @a) <>-      ", but found a: " <> show (typeRep $ Proxy @x)-  _ -> case varDepth @a ref xs of-    VarDepth idx -> VarDepth (SS idx)--------------------------------------------------------------------------------- Macro class constraints-------------------------------------------------------------------------------duupXClassConstraint-  :: Sing n -> StackVars' inp -> StkEl a -> StackVars' s -> StackVars' s'-  -> Maybe (Dict (L.DuupX n inp a s s'))-duupXClassConstraint n inp a s s' = case n of-  SZ -> Nothing-  SS SZ -> case inp of-    (x :& _xs) -> do-      Refl <- testEquality x a-      return Dict-    _ -> Nothing-  SS (SS SZ) -> case inp of-    (_ :& x :& _xs) -> do-      Refl <- testEquality x a-      return Dict-    _ -> Nothing-  SS (SS (SS m)) -> do-    Dict <- duupXLorentzConstraint (SS (SS m)) inp a s s'-    return Dict--replaceNClassConstraint-  :: Sing n -> StackVars' s -> StkEl a -> StackVars' mid -> StackVars' tail-  -> Maybe (Dict (L.ReplaceN n s a mid tail))-replaceNClassConstraint n s a mid tail = case n of-  SZ -> Nothing-  SS SZ -> case s of-    (x :& _xs) -> do-      Refl <- testEquality x a-      return Dict-    _ -> Nothing-  SS (SS m) -> do-    Dict <- replaceNLorentzConstraint (SS m) s a mid tail-    return Dict--updateNClassConstraint-  :: Sing n -> StackVars' s -> StkEl a -> StkEl b -> StackVars' mid -> StackVars' tail-  -> Maybe (Dict (L.UpdateN n s a b mid tail))-updateNClassConstraint n s a b mid tail = case n of-  SZ -> Nothing-  SS SZ -> case s of-    (x :& xs) -> do-      Refl <- testEquality x b-      Refl <- testEquality xs tail-      return Dict-    _ -> Nothing-  SS (SS SZ) -> case s of-    (_x :& y :& xs) -> do-      Refl <- testEquality y b-      Refl <- testEquality xs tail-      return Dict-    _ -> Nothing-  SS (SS (SS m)) -> do-    Dict <- updateNLorentzConstraint (SS (SS m)) s a b mid tail-    return Dict--------------------------------------------------------------------------------- Lorentz constraints-------------------------------------------------------------------------------duupXLorentzConstraint-  :: (KnownPeano n, SingI n)-  => Sing n -> StackVars' inp -> StkEl a -> StackVars' s -> StackVars' s'-  -> Maybe (Dict (L.ConstraintDuupXLorentz n inp a s s'))-duupXLorentzConstraint n s a s1 tail = do-  Refl <- testEquality tail (rdrop (SS n) s)-  Refl <- testEquality (toTVals tail) (rdrop (SS n) (toTVals s))-  Dict <- dipNLorentzConstraint n s s1 (a :& tail) (a :& a :& tail)-  Dict <- digLorentzConstraint n s1 (a :& s) a-  return Dict--updateNLorentzConstraint-  :: (KnownPeano n, SingI n)-  => Sing n -> StackVars' s -> StkEl a -> StkEl b -> StackVars' mid -> StackVars' tail-  -> Maybe (Dict (L.ConstraintUpdateNLorentz n s a b mid tail))-updateNLorentzConstraint n s a b mid tail = do-  Refl <- testEquality tail (rdrop (SS n) s)-  Refl <- testEquality (toTVals tail) (rdrop (SS n) (toTVals s))-  Dict <- dugLorentzConstraint n (a :& s) mid a-  Dict <- dipNLorentzConstraint n mid s (a :& b :& tail) (b :& tail)-  return Dict--replaceNLorentzConstraint-  :: (KnownPeano n, SingI n)-  => Sing n -> StackVars' s -> StkEl a -> StackVars' mid -> StackVars' tail-  -> Maybe (Dict (L.ConstraintReplaceNLorentz n s a mid tail))-replaceNLorentzConstraint n s a mid tail = do-  Refl <- testEquality tail (rdrop (SS n) s)-  Refl <- testEquality (toTVals tail) (rdrop (SS n) (toTVals s))-  Dict <- dipNLorentzConstraint (SS n) (a :& s) mid (a :& tail) tail-  Dict <- dugLorentzConstraint n mid s a-  return Dict--dugLorentzConstraint-  :: (KnownPeano n, SingI n)-  => Sing n -> StackVars' inp -> StackVars' out -> StkEl a-  -> Maybe (Dict (L.ConstraintDUGLorentz n inp out a))-dugLorentzConstraint n inp out a = do-  Dict <- dugConstraint n inp out a-  Dict <- dugConstraint n (toTVals inp) (toTVals out) (toTVal a)-  return Dict--dipNLorentzConstraint-  :: (KnownPeano n, SingI n)-  => Sing n -> StackVars' inp -> StackVars' out -> StackVars' s -> StackVars' s'-  -> Maybe (Dict (L.ConstraintDIPNLorentz n inp out s s'))-dipNLorentzConstraint n inp out s s' = do-  Dict <- dipNConstraint n inp out s s'-  Dict <- dipNConstraint n (toTVals inp) (toTVals out) (toTVals s) (toTVals s')-  return Dict--digLorentzConstraint-  :: (KnownPeano n, SingI n)-  => Sing n -> StackVars' inp -> StackVars' out -> StkEl a-  -> Maybe (Dict (L.ConstraintDIGLorentz n inp out a))-digLorentzConstraint n inp out a = do-  Dict <- digConstraint n inp out a-  Dict <- digConstraint n (toTVals inp) (toTVals out) (toTVal a)-  return Dict--------------------------------------------------------------------------------- Morley constraints-------------------------------------------------------------------------------dugConstraint-  :: (KnownPeano n, SingI n, TestEquality any)-  => Sing n -> Rec any inp -> Rec any out -> any a-  -> Maybe (Dict (MI.ConstraintDUG' kind n inp out a))-dugConstraint n inp out a = do-  Dict <- requireLongerThan out n-  Refl <- testEquality (a :& rdrop (SS SZ) inp) inp-  Refl <- testEquality (rtake n (rdrop (SS SZ) inp) <+> a :& rdrop (SS n) inp) out-  return Dict--dipNConstraint-  :: (KnownPeano n, SingI n, TestEquality any)-  => Sing n -> Rec any inp -> Rec any out -> Rec any s -> Rec any s'-  -> Maybe (Dict (MI.ConstraintDIPN' kind n inp out s s'))-dipNConstraint n inp out s s' = do-  Dict <- requireLongerOrSameLength inp n-  Refl <- testEquality (rtake n inp <+> s) inp-  Refl <- testEquality (rtake n inp <+> s') out-  return Dict--digConstraint-  :: (KnownPeano n, SingI n, TestEquality any)-  => Sing n -> Rec any inp -> Rec any out -> any a-  -> Maybe (Dict (MI.ConstraintDIG' kind n inp out a))-digConstraint n inp out a = do-  Dict <- requireLongerThan inp n-  Refl <- testEquality inp (rtake n inp <+> a :& rdrop (SS n) inp)-  Refl <- testEquality out (a :& rtake n inp <+> rdrop (SS n) inp)-  return Dict--------------------------------------------------------------------------------- Conversion for ToT constraints--------------------------------------------------------------------------------- | Stack representation of 'MI.T' used for constraint checking-type TValStack (stk :: [MI.T]) = Rec TVal stk---- | Simple datatype used to keep a 'MI.T' and its 'Typeable' constraint-data TVal (a :: MI.T) where-  TVal :: Typeable a => TVal a--instance TestEquality TVal where-  testEquality (TVal :: TVal a) (TVal :: TVal b) = eqT @a @b--toTVal :: forall a. StkEl a -> TVal (ToT a)-toTVal = \case-  NoRef -> TVal @(ToT a)-  Ref _ -> TVal @(ToT a)--toTVals :: StackVars' stk -> TValStack (ToTs stk)-toTVals = \case-  RNil          -> RNil-  (NoRef :& xs) -> TVal :& toTVals xs-  (Ref _ :& xs) -> TVal :& toTVals xs--------------------------------------------------------------------------------- Vinyl manipulation helpers-------------------------------------------------------------------------------rtake :: Sing n -> Rec any s -> Rec any (Take n s)-rtake sn stk = case (sn, stk) of-  (SZ, _)           -> RNil-  (SS n, (x :& xs)) -> x :& rtake n xs-  (SS _, RNil)      -> error "given stack is too small"--rdrop :: Sing n -> Rec any s -> Rec any (Drop n s)-rdrop sn stk = case (sn, stk) of-  (SZ, _)           -> stk-  (SS n, (_ :& xs)) -> rdrop n xs-  (SS _, RNil)      -> error "given stack is too small"
− src/Indigo/Internal/Object.hs
@@ -1,183 +0,0 @@--- SPDX-FileCopyrightText: 2020 Tocqueville Group------ SPDX-License-Identifier: LicenseRef-MIT-TQ--module Indigo.Internal.Object-  ( IndigoObjectF (..)-  , NamedFieldObj (..)-  , TypedFieldObj (..)-  , FieldTypes-  , Object-  , SomeObject (..)-  , namedToTypedRec-  , typedToNamedRec-  , namedToTypedFieldObj-  , typedToNamedFieldObj--  , IsObject-  , complexObjectDict-  , ComplexObjectC-  , castFieldConstructors-  ) where--import Data.Vinyl (RMap, RecordToList)-import Data.Vinyl.TypeLevel (AllConstrained)-import Data.Constraint (Dict(..))-import qualified GHC.Generics as G--import Indigo.Internal.Var (RefId)-import Indigo.Backend.Prelude-import Indigo.Lorentz-import Michelson.Typed.Haskell.Instr.Product-  ( GetFieldType, ConstructorFieldNames, GetFieldType-  , InstrDeconstructC, FieldConstructor (..), CastFieldConstructors (..))-import Michelson.Typed (IsPrimitiveValue)-import Util.Type (KnownList (..), KList (..))--------------------------------------------------------------------------------- IndigoObjectF--------------------------------------------------------------------------------- | A object that can be either--- stored in the single stack cell or split into fields.--- Fields are identified by their names.------ @f@ is a functor to be applied to each of field names.-data IndigoObjectF f a where-  -- | Value stored on the stack, it might be-  -- either complex product type, like @(a, b)@, Storage, etc,-  -- or sum type like 'Either', or primitive like 'Int', 'Operation', etc.-  Cell :: KnownValue a => RefId -> IndigoObjectF f a-  -- | Decomposed product type, which is NOT stored-  -- as one cell on the stack.-  Decomposed :: ComplexObjectC a => Rec f (ConstructorFieldNames a) -> IndigoObjectF f a---- | Auxiliary type family to convert list of field names--- to list of field types-type family MapGFT a rs where-  MapGFT _ '[] = '[]-  MapGFT a (name ': xs) = GetFieldType a name ': MapGFT a xs---- | Convert a list of fields from name-based list to type-based one-namedToTypedRec-  :: forall a f g .-    (forall name . f name -> g (GetFieldType a name))-  -> Rec f (ConstructorFieldNames a)-  -> Rec g (FieldTypes a)-namedToTypedRec fun = namedToTypedRecImpl-  where-    namedToTypedRecImpl :: Rec f rs -> Rec g (MapGFT a rs)-    namedToTypedRecImpl RNil = RNil-    namedToTypedRecImpl (v :& xs) = fun v :& namedToTypedRecImpl xs---- | Convert a list of fields from type-based list to named-based one-typedToNamedRec :: forall a f g . KnownList (ConstructorFieldNames a)-  => (forall name . f (GetFieldType a name) -> g name)-  -> Rec f (FieldTypes a)-  -> Rec g (ConstructorFieldNames a)-typedToNamedRec fun = typedToNamedRecImpl-  where-    typedToNamedRecImpl :: forall rs . KnownList rs => Rec f (MapGFT a rs) -> Rec g rs-    typedToNamedRecImpl re = case (klist @rs, re) of-      (KNil, RNil)  -> RNil-      (KCons (_ :: Proxy nm) (_ :: Proxy rs'), v :& vs) -> fun v :& typedToNamedRecImpl vs--castFieldConstructors-  :: forall a st . CastFieldConstructors (FieldTypes a) (ConstructorFieldTypes a)-  => Rec (FieldConstructor st) (FieldTypes a) -> Rec (FieldConstructor st) (ConstructorFieldTypes a)-castFieldConstructors = castFieldConstructorsImpl---- | Auxiliary datatype to define a Objiable.--- Keeps field name as type param-data NamedFieldObj a name where-  NamedFieldObj-    :: IsObject (GetFieldType a name)-    => { unFieldObj :: Object (GetFieldType a name)-       }-    -> NamedFieldObj a name--type Object a = IndigoObjectF (NamedFieldObj a) a--data SomeObject where-  SomeObject :: IsObject a => Object a -> SomeObject---- | Like 'NamedFieldObj', but this one doesn't keep name of a field-data TypedFieldObj a where-  TypedFieldObj :: IsObject a => Object a -> TypedFieldObj a--namedToTypedFieldObj :: forall a name . NamedFieldObj a name -> TypedFieldObj (GetFieldType a name)-namedToTypedFieldObj (NamedFieldObj f) = TypedFieldObj f--typedToNamedFieldObj :: forall a name . TypedFieldObj (GetFieldType a name) -> NamedFieldObj a name-typedToNamedFieldObj (TypedFieldObj f) = NamedFieldObj f--------------------------------------------------------------------------------- IsObject type class-------------------------------------------------------------------------------class IsObject' (TypeDecision a) a => IsObject a-instance IsObject' (TypeDecision a) a => IsObject a--type FieldTypes a = MapGFT a (ConstructorFieldNames a)--type ToDeconstructC a =-  ( InstrDeconstructC a-  , KnownList (FieldTypes a)-  , AllConstrained KnownValue (FieldTypes a)-  )--type ToConstructC a =-  ( KnownValue a-  , InstrConstructC a-  , RMap (ConstructorFieldNames a)-  , RMap (ConstructorFieldTypes a)-  , RMap (FieldTypes a)-  , KnownList (ConstructorFieldNames a)-  , CastFieldConstructors (FieldTypes a) (ConstructorFieldTypes a)-  )--type ComplexObjectC a =-  ( ToDeconstructC a-  , ToConstructC a-  , AllConstrained IsObject (FieldTypes a)-  , RecordToList (FieldTypes a) -- for Buildable-  )---- | Type class instantiated for all possible Indigo types-class KnownValue a => IsObject' (decision :: Decision) a where-  complexObjectDict' :: Maybe (Dict (ComplexObjectC a))--instance KnownValue a => IsObject' 'PrimitiveD a where-  complexObjectDict' = Nothing--instance KnownValue a => IsObject' 'SumTypeD a where-  complexObjectDict' = Nothing--instance ComplexObjectC a => IsObject' 'ProductTypeD a where-  complexObjectDict' = Just Dict--complexObjectDict :: forall a . IsObject a => Maybe (Dict (ComplexObjectC a))-complexObjectDict = complexObjectDict' @(TypeDecision a) @a---- | Decide whether type is either primitive or ADT-type TypeDecision a = Decide (IsPrimitiveValue a) (IsSumType (G.Rep a))--data Decision-  = PrimitiveD-  | SumTypeD-  | ProductTypeD--type family Decide flagPrimitive flagSumType where-  Decide 'True _ = 'PrimitiveD-  Decide 'False 'True = 'SumTypeD-  Decide 'False 'False = 'ProductTypeD--type family IsSumType x where-  IsSumType (G.D1 _ x) = IsSumType x-  IsSumType (G.C1 _ x) = IsSumType x-  IsSumType (G.M1 _ _ x) = IsSumType x-  IsSumType (_ G.:*: _) = 'False-  IsSumType (G.Rec0 _) = 'False-  IsSumType G.V1 = 'False-  IsSumType G.U1 = 'False-  IsSumType (_ G.:+: _) = 'True
− src/Indigo/Internal/SIS.hs
@@ -1,54 +0,0 @@--- SPDX-FileCopyrightText: 2020 Tocqueville Group------ SPDX-License-Identifier: LicenseRef-MIT-TQ--module Indigo.Internal.SIS-  ( SomeIndigoState (..)-  , SomeGenCode (..)-  , toSIS-  , runSIS-  , thenSIS-  , overSIS-  ) where--import Indigo.Prelude--import Indigo.Internal.State---- | 'GenCode' with hidden output stack-data SomeGenCode inp where-  SomeGenCode :: GenCode inp out -> SomeGenCode inp---- | 'IndigoState' with hidden output stack,--- necessary to generate typed Lorentz code from untyped Indigo frontend.-newtype SomeIndigoState inp = SomeIndigoState-  { unSIS :: MetaData inp -> SomeGenCode inp-  }---- | To run 'SomeIndigoState' you need to pass an handler of 'GenCode' with any--- output stack and initial 'MetaData'.-runSIS :: SomeIndigoState inp -> MetaData inp -> (forall out . GenCode inp out -> r) -> r-runSIS (SomeIndigoState act) md f = case act md of-  SomeGenCode gc -> f gc---- | Convert 'IndigoState' to 'SomeIndigoState'-toSIS :: IndigoState inp out -> SomeIndigoState inp-toSIS is = SomeIndigoState $ \md -> SomeGenCode $ runIndigoState is md---- | Similar to a @>>@ for 'SomeIndigoState'.-thenSIS :: SomeIndigoState inp -> (forall out . SomeIndigoState out) -> SomeIndigoState inp-thenSIS m f = SomeIndigoState $ \md ->-  case unSIS m md of-    (SomeGenCode (GenCode st1 cd1 cl1 :: GenCode inp out)) ->-      case unSIS (f @out) (replStkMd md st1) of-        SomeGenCode (GenCode st2 cd2 cl2) ->-          SomeGenCode (GenCode st2 (cd1 ## cd2) (cl2 ## cl1))---- | Modify the 'GenCode' inside a 'SomeIndigoState' by passing an handler of--- 'GenCode' that returns a 'SomeGenCode'.--- Useful in some cases to "wrap" or update and exising 'SomeGenCode'.-overSIS-  :: (forall out. GenCode inp out -> SomeGenCode inp)-  -> SomeIndigoState inp-  -> SomeIndigoState inp-overSIS f si = SomeIndigoState $ \md -> runSIS si md f
− src/Indigo/Internal/State.hs
@@ -1,247 +0,0 @@--- SPDX-FileCopyrightText: 2020 Tocqueville Group------ SPDX-License-Identifier: LicenseRef-MIT-TQ--{-# LANGUAGE InstanceSigs #-}--{- |-This module contains the core of Indigo language:-'IndigoState', a datatype that represents its state.-It also includes some convenient functions to work with it,-to provide rebindable syntax.--'IndigoState' implements the functionality of a symbolic interpreter.-During its execution Lorentz code is being generated.--Functionally, it's the same as having Lorentz instruction that can access and-modify a 'StackVars', referring to values on the stack with a 'RefId'.--}--module Indigo.Internal.State-  ( -- * Indigo State-    IndigoState (..)-  , usingIndigoState-  , (>>)-  , (<$>)-  , iput-  , nopState-  , assignTopVar-  , withObject-  , withObjectState-  , withStackVars--  , DecomposedObjects-  , GenCodeHooks (..)-  , emptyGenCodeHooks-  , MetaData (..)-  , stmtHook-  , stmtHookState-  , auxiliaryHook-  , auxiliaryHookState-  , exprHook-  , exprHookState-  , replStkMd-  , alterStkMd-  , pushRefMd-  , pushNoRefMd-  , popNoRefMd--  , GenCode (..)-  , cleanGenCode--  , (##)-  ) where--import qualified Data.Map as M-import Data.Typeable ((:~:) (..), eqT)--import Indigo.Backend.Prelude-import Indigo.Internal.Object-import Indigo.Internal.Var-import Indigo.Lorentz-import qualified Lorentz.Instr as L-import qualified Michelson.Typed as M-import Util.Peano--------------------------------------------------------------------------------- Indigo State--------------------------------------------------------------------------------- | IndigoState data type.------ It takes as input a 'StackVars' (for the initial state) and returns a--- 'GenCode' (for the resulting state and the generated Lorentz code).------ IndigoState has to be used to write backend typed Lorentz code--- from the corresponding frontend constructions.------ It has no return type, IndigoState instruction may take one or more--- "return variables", that they assign to values produced during their execution.-newtype IndigoState inp out = IndigoState {-    runIndigoState :: MetaData inp -> GenCode inp out-  }---- | Inverse of 'runIndigoState' for utility.-usingIndigoState :: MetaData inp -> IndigoState inp out -> GenCode inp out-usingIndigoState md act = runIndigoState act md---- | Then for rebindable syntax.-(>>) :: IndigoState inp out -> IndigoState out out1 -> IndigoState inp out1-(>>) a b = IndigoState $ \md ->-  let GenCode st1 cd1 cl1 = runIndigoState a md in-  let GenCode st2 cd2 cl2 = runIndigoState b (replStkMd md st1) in-  GenCode st2 (cd1 ## cd2) (cl2 ## cl1)---- | Put new 'GenCode'.-iput :: GenCode inp out -> IndigoState inp out-iput gc = IndigoState $ \_ -> gc---- | The simplest 'IndigoState', it does not modify the stack, nor the produced--- code.-nopState :: IndigoState inp inp-nopState = IndigoState $ \md -> GenCode (mdStack md) L.nop L.nop---- | Assigns a variable to reference the element on top of the stack.-assignTopVar :: KnownValue x => Var x -> IndigoState (x : inp) (x : inp)-assignTopVar var = IndigoState $ \md ->-  GenCode (assignVarAt var (mdStack md) SZ) L.nop L.nop--withObject-  :: forall a r .  KnownValue a-  => DecomposedObjects-  -> Var a-  -> (Object a -> r)-  -> r-withObject objs (Var refId) f = case M.lookup refId objs of-  Nothing -> f (Cell refId)-  Just so -> case so of-    SomeObject (obj :: Object a1) -> case eqT @a @a1 of-      Just Refl -> f obj-      Nothing ->-        error $ "unexpectedly SomeObject with by reference #" <> show refId <> " has different type"--withObjectState-  :: forall a inp out . KnownValue a-  => Var a-  -> (Object a -> IndigoState inp out)-  -> IndigoState inp out-withObjectState v f = IndigoState $ \md -> usingIndigoState md (withObject (mdObjects md) v f)---- | Utility function to create 'IndigoState' that need access to the current 'StackVars'.-withStackVars :: (StackVars inp -> IndigoState inp out) -> IndigoState inp out-withStackVars fIs = IndigoState $ \md -> usingIndigoState md (fIs $ mdStack md)--------------------------------------------------------------------------------- MetaData primitives-------------------------------------------------------------------------------type DecomposedObjects = Map RefId SomeObject--data MetaData inp = MetaData-  { mdStack   :: StackVars inp-  , mdObjects :: DecomposedObjects-  , mdHooks   :: GenCodeHooks-  }--data GenCodeHooks = GenCodeHooks-  { gchStmtHook      :: forall inp out . Text -> (inp :-> out) -> (inp :-> out)-  , gchAuxiliaryHook :: forall inp out . Text -> (inp :-> out) -> (inp :-> out)-  , gchExprHook      :: forall inp out . Text -> (inp :-> out) -> (inp :-> out)-  -- pva701: dunno whether this level of verbosity is needed-  --, csSubExpr    :: forall a inp out . Expr a -> (inp :-> out) -> (inp :-> out)-  }--instance Semigroup GenCodeHooks where-  GenCodeHooks a b c <> GenCodeHooks a1 b1 c1 = GenCodeHooks-    { gchStmtHook = \t cd -> a1 t (a t cd)-    , gchAuxiliaryHook = \t cd -> b1 t (b t cd)-    , gchExprHook = \t cd -> c1 t (c t cd)-    }--instance Monoid GenCodeHooks where-  mempty = emptyGenCodeHooks--emptyGenCodeHooks :: GenCodeHooks-emptyGenCodeHooks = GenCodeHooks (const id) (const id) (const id)--stmtHook :: forall inp out any . MetaData any -> Text -> (inp :-> out) -> (inp :-> out)-stmtHook MetaData{..} tx cd = (gchStmtHook mdHooks) tx cd--stmtHookState :: Text -> IndigoState inp out -> IndigoState inp out-stmtHookState tx cd = IndigoState $ \md ->-  let GenCode st c cl = usingIndigoState md cd in-  GenCode st (stmtHook md tx c) cl--auxiliaryHook :: forall inp out any . MetaData any -> Text -> (inp :-> out) -> (inp :-> out)-auxiliaryHook MetaData{..} tx cd = (gchAuxiliaryHook mdHooks) tx cd--auxiliaryHookState :: Text -> IndigoState inp out -> IndigoState inp out-auxiliaryHookState tx cd = IndigoState $ \md ->-  let GenCode st c cl = usingIndigoState md cd in-  GenCode st (auxiliaryHook md tx c) cl--exprHook :: forall inp out any . MetaData any -> Text -> (inp :-> out) -> (inp :-> out)-exprHook MetaData{..} exTx cd = (gchExprHook mdHooks) exTx cd--exprHookState :: Text -> IndigoState inp out -> IndigoState inp out-exprHookState tx cd = IndigoState $ \md ->-  let GenCode st c cl = usingIndigoState md cd in-  GenCode st (exprHook md tx c) cl---replStkMd :: MetaData inp -> StackVars inp1 -> MetaData inp1-replStkMd md = alterStkMd md . const--alterStkMd :: MetaData inp -> (StackVars inp -> StackVars inp1) -> MetaData inp1-alterStkMd (MetaData stk objs cm) f = MetaData (f stk) objs cm---- | 'pushRef' version for 'MetaData'-pushRefMd :: KnownValue a => Var a -> MetaData inp -> MetaData (a : inp)-pushRefMd var md = alterStkMd md (pushRef var)---- | 'pushNoRef' version for 'MetaData'-pushNoRefMd :: KnownValue a => MetaData inp -> MetaData (a : inp)-pushNoRefMd md = alterStkMd md pushNoRef---- | 'popNoRef' version for 'MetaData'-popNoRefMd :: MetaData (a : inp) -> MetaData inp-popNoRefMd md = alterStkMd md popNoRef--------------------------------------------------------------------------------- Code generation primitives--------------------------------------------------------------------------------- | Resulting state of IndigoM.-data GenCode inp out = GenCode-  { gcStack :: ~(StackVars out)-  -- ^ Stack of the symbolic interpreter.-  , gcCode  :: inp :-> out-  -- ^ Generated Lorentz code.-  , gcClear :: out :-> inp-  -- ^ Clearing Lorentz code.-  }---- | Produces the generated Lorentz code that cleans after itself, leaving the--- same stack as the input one-cleanGenCode :: GenCode inp out -> inp :-> inp-cleanGenCode GenCode {..} = gcCode ## gcClear--------------------------------------------------------------------------------- Helpers--------------------------------------------------------------------------------- | Version of '#' which performs some optimizations immediately.------ In particular, this avoids glueing @Nop@s.-(##) :: (a :-> b) -> (b :-> c) -> (a :-> c)-l ## r =-  -- We are very verbose about cases to avoid-  -- significant compilation time increase-  case l of-    I M.Nop -> case r of-      I x -> I x-      _   -> l # r-    I x -> case r of-      I M.Nop -> I x-      _       -> l # r-    _ -> l # r
− src/Indigo/Internal/Var.hs
@@ -1,155 +0,0 @@--- SPDX-FileCopyrightText: 2020 Tocqueville Group------ SPDX-License-Identifier: LicenseRef-MIT-TQ--module Indigo.Internal.Var-  ( -- * Variables-    Var (..)-  , RefId-  , StackVars (..)-  , StackVars'-  , StkEl (..)--  -- * Stack operations-  , emptyStack-  , assignVarAt-  , pushRef-  , pushNoRef-  , popNoRef--  -- * Operations/Storage variables-  , Ops-  , HasSideEffects-  , operationsVar-  , HasStorage-  , storageVar-  ) where--import qualified Data.Kind as Kind-import Data.Reflection (Given(..))-import Data.Singletons (Sing)-import Data.Type.Equality (TestEquality(..))-import Data.Typeable (eqT)-import Fmt (Buildable(..), pretty)--import Indigo.Backend.Prelude-import Indigo.Lorentz-import Util.Peano--------------------------------------------------------------------------------- Stack and variable definition--------------------------------------------------------------------------------- | Reference id to a stack cell-newtype RefId = RefId Word-  deriving stock (Show, Generic)-  deriving newtype (Eq, Ord, Real, Num, Bounded)--instance Buildable RefId where-  build (RefId r) = "#ref" <> pretty r---- | Stack element of the symbolic interpreter.------ It holds either a reference index that refers to this element--- or just 'NoRef', indicating that there are no references--- to this element.-data StkEl a where-  NoRef :: KnownValue a => StkEl a-  Ref :: KnownValue a => RefId -> StkEl a--instance TestEquality StkEl where-  testEquality NoRef NoRef = eqT-  testEquality (Ref _) (Ref _) = eqT-  testEquality (Ref _) NoRef = eqT-  testEquality NoRef (Ref _) = eqT--type StackVars' stk = Rec StkEl stk---- | Stack of the symbolic interpreter.-data StackVars (stk :: [Kind.Type]) where-  StkElements  :: Rec StkEl stk -> StackVars stk-  FailureStack :: StackVars stk---- | A variable referring to an element in the stack.-data Var a = Var RefId-  deriving stock (Generic, Show)--instance Buildable (Var a) where-  build (Var (RefId r)) = "$var" <> pretty r--------------------------------------------------------------------------------- Stack operations-------------------------------------------------------------------------------emptyStack :: StackVars '[]-emptyStack = StkElements RNil--instance Default (StackVars '[]) where-  def = emptyStack--instance (KnownValue x, Default (StackVars xs)) => Default (StackVars (x ': xs)) where-  def = case def of-    FailureStack -> error "impossible happened"-    StkElements rc -> StkElements $ NoRef :& rc---- | Given a 'StackVars' and a @Peano@ singleton for a depth, it puts a new 'Var'--- at that depth (0-indexed) and returns it with the updated 'StackVars'.------ If there is a 'Var' there already it is used and the 'StackVars' not changed.-assignVarAt-  :: (KnownValue a, a ~ At n inp, RequireLongerThan inp n)-  => Var a-  -> StackVars inp-  -> Sing n-  -> StackVars inp-assignVarAt _ FailureStack = const $ error "You try to assing var against failure stack"-assignVarAt var@(Var varRef) st@(StkElements (top :& xs)) = \case-  SS n -> appendToStack top $ assignVarAt var (StkElements xs) n-  SZ -> case top of-    Ref mdRef | mdRef == varRef -> st-    Ref _ -> error "Tried to assign a Var to an already referenced value"-    NoRef -> StkElements $ Ref varRef :& xs-  where-    appendToStack :: StkEl x -> StackVars inp -> StackVars (x ': inp)-    appendToStack _ FailureStack = error "append to failure stack"-    appendToStack v (StkElements s) = StkElements (v :& s)---- | Push a new stack element with a reference to it, given the variable.-pushRef :: KnownValue a => Var a -> StackVars inp -> StackVars (a : inp)-pushRef _ FailureStack = error "You try to push ref to failure stack"-pushRef (Var ref) (StkElements xs) = StkElements $ Ref ref :& xs---- | Push a new stack element without a reference to it.-pushNoRef :: KnownValue a => StackVars inp -> StackVars (a : inp)-pushNoRef FailureStack = error "You try to push no-ref to failure stack"-pushNoRef (StkElements xs) = StkElements $ NoRef :& xs---- | Remove the top element of the stack.--- It's supposed that no variable refers to this element.-popNoRef :: StackVars (a : inp) -> StackVars inp-popNoRef FailureStack = error "You try to pop from failure stack"-popNoRef (StkElements (NoRef :& xs)) = StkElements xs-popNoRef (StkElements (Ref refId :& _)) =-  error $ "You try to pop stack element, which is referenced by some variable #" <> show refId--------------------------------------------------------------------------------- Operations/Storage variables-------------------------------------------------------------------------------type Ops = [Operation]---- | Allows to get a variable with operations-type HasSideEffects = Given (Var Ops)---- | Return a variable which refers to a stack cell with operations-operationsVar :: HasSideEffects => Var Ops-operationsVar = given---- This storage machinery is here to avoid cyclic deps---- | Allows to get a variable with storage-type HasStorage st = (Given (Var st), KnownValue st)---- | Return a variable which refers to a stack cell with storage-storageVar :: HasStorage st => Var st-storageVar = given
src/Indigo/Lib.hs view
@@ -1,6 +1,5 @@--- SPDX-FileCopyrightText: 2020 Tocqueville Group------ SPDX-License-Identifier: LicenseRef-MIT-TQ+-- SPDX-FileCopyrightText: 2022 Oxhead Alpha+-- SPDX-License-Identifier: LicenseRef-MIT-OA  -- | Standard library for Indigo. --@@ -19,12 +18,12 @@   , subGt0   ) where +import Indigo.Common.Expr+import Indigo.Common.Var (HasSideEffects) import Indigo.Frontend-import Indigo.Internal.Expr-import Indigo.Internal.Var (HasSideEffects) import Indigo.Lorentz import Indigo.Prelude-import Indigo.Rebinded+import Indigo.Rebound  ---------------------------------------------------------------------------- -- Views and Voids@@ -37,9 +36,10 @@   forall arg r viewExpr exr.   ( KnownValue arg   , NiceParameter r-  , viewExpr :~> View arg r+  , viewExpr :~> View_ arg r   , exr :~> r   , HasSideEffects+  , IsNotInView   )   => (Expr arg -> IndigoM exr)   -> viewExpr@@ -57,9 +57,10 @@   forall arg r viewExpr exr.   ( KnownValue arg   , NiceParameter r-  , viewExpr :~> View arg r+  , viewExpr :~> View_ arg r   , exr :~> r   , HasSideEffects+  , IsNotInView   )   => viewExpr   -> (Expr arg -> IndigoM exr)
src/Indigo/Lorentz.hs view
@@ -1,6 +1,5 @@--- SPDX-FileCopyrightText: 2020 Tocqueville Group------ SPDX-License-Identifier: LicenseRef-MIT-TQ+-- SPDX-FileCopyrightText: 2021 Oxhead Alpha+-- SPDX-License-Identifier: LicenseRef-MIT-OA  -- | This module is intended to be imported instead of "Lorentz" by Indigo -- modules.@@ -10,27 +9,26 @@  module Indigo.Lorentz   ( module L+  , (#)   ) where  import Lorentz.ADT as L hiding (HasField, caseT, case_, construct, constructT, setField) import Lorentz.Annotation as L (HasAnnotation) import Lorentz.Arith as L-import Lorentz.Base as L+import Lorentz.Base as L hiding (Contract, (#)) import Lorentz.Bytes as L import Lorentz.Coercions as L import Lorentz.Common as L import Lorentz.Constraints as L-import Lorentz.Doc as L hiding-  (contractGeneral, contractGeneralDefault, contractName, doc, docGroup, docStorage)+import Lorentz.Doc as L hiding (contractGeneralDefault, doc, docGroup) import Lorentz.Entrypoints as L import Lorentz.Entrypoints.Doc as L hiding   (entryCase, entryCaseSimple, entryCase_, finalizeParamCallingDoc)-import Lorentz.Errors as L hiding (failCustom, failCustom_)-import Lorentz.Errors.Common as L ()+import Lorentz.Errors as L hiding (failCustom, failCustomNoArg, failCustom_) import Lorentz.Errors.Numeric as L import Lorentz.Ext as L-import Lorentz.Instr as L (NonZero)-import Lorentz.Macro as L (View, VoidResult, Void_, voidResultTag)+import Lorentz.Lambda as L+import Lorentz.Macro as L (NonZero, View_, VoidResult, Void_, voidResultTag) import Lorentz.Pack as L import Lorentz.Polymorphic as L import Lorentz.Print as L@@ -41,3 +39,13 @@ import Lorentz.Util.TH as L import Lorentz.Value as L import Lorentz.Zip as L ()++import Lorentz.Base qualified as LBase ((#))++-- | Replicate the old behavior of @(#)@, which ignores anything after failing+-- instructions. Indigo relies on this.+-- TODO #62: reconsider this.+(#) :: (a :-> b) -> (b :-> c) -> a :-> c+FI l # _ = FI l+x # y = x LBase.# y+infixl 8 #
src/Indigo/Prelude.hs view
@@ -1,6 +1,5 @@--- SPDX-FileCopyrightText: 2020 Tocqueville Group------ SPDX-License-Identifier: LicenseRef-MIT-TQ+-- SPDX-FileCopyrightText: 2021 Oxhead Alpha+-- SPDX-License-Identifier: LicenseRef-MIT-OA  -- | This module serves the purpose of listing @hiding@ rules of -- Prelude that conflicts with Indigo exported functions.@@ -10,7 +9,6 @@   ) where  import Prelude hiding-  ( abs, and, concat, div, empty, fromInteger, fst, get, mod, not, or, snd, some-  , unless, when, whenLeft, whenRight, xor, (%~), (&&), (*), (+), (-), (/), (/=)-  , (<), (<=), (<>), (==), (>), (>=), (?:), (^), (^.), (^?), (||)-  )+  (abs, and, concat, div, empty, even, fromInteger, fst, get, mod, not, odd, or, snd, some, unless,+  when, whenLeft, whenRight, xor, (%~), (&&), (*), (+), (-), (/), (/=), (<), (<=), (<>), (==), (>),+  (>=), (?:), (^), (^.), (^?), (||))
src/Indigo/Print.hs view
@@ -1,6 +1,5 @@--- SPDX-FileCopyrightText: 2020 Tocqueville Group------ SPDX-License-Identifier: LicenseRef-MIT-TQ+-- SPDX-FileCopyrightText: 2022 Oxhead Alpha+-- SPDX-License-Identifier: LicenseRef-MIT-OA  -- | Module containing pretty-printing of Indigo contracts @@ -16,9 +15,9 @@  import Data.Text.Lazy.IO.Utf8 (writeFile) +import Indigo.Common.Object import Indigo.Compilation import Indigo.Frontend.Program (IndigoContract)-import Indigo.Internal.Object import Indigo.Lorentz import Indigo.Prelude @@ -27,14 +26,14 @@   :: forall param st .      ( IsObject st      , NiceParameterFull param-     , NiceStorage st+     , NiceStorageFull st      )   => Bool -- ^ Force result to be single line   -> CommentSettings   -> IndigoContract param st   -> LText printIndigoContract forceSingleLine sett ctr = printLorentzContract forceSingleLine $-  defaultContract $+  mkContract $   compileIndigoContractFull @param @st sett ctr  -- | Generate an Indigo contract documentation.@@ -42,11 +41,12 @@   :: forall param st .      ( IsObject st      , NiceParameterFull param+     , NiceStorageFull st      )   => IndigoContract param st   -> LText renderIndigoDoc ctr =-  buildMarkdownDoc . attachDocCommons DGitRevisionUnknown $+  buildMarkdownDoc . attachDocCommons DGitRevisionUnknown . mkContract $     compileIndigoContract @param @st ctr  -- | Prints the pretty-printed Michelson code of an Indigo contract to@@ -55,7 +55,7 @@ -- This is intended to be easy to use for newcomers. printAsMichelson   :: forall param st m . ( IsObject st-     , NiceParameterFull param, NiceStorage st+     , NiceParameterFull param, NiceStorageFull st      , MonadIO m      )   => CommentSettings@@ -69,7 +69,7 @@ -- This is intended to be easy to use for newcomers. saveAsMichelson   :: forall param st m . ( IsObject st-     , NiceParameterFull param, NiceStorage st+     , NiceParameterFull param, NiceStorageFull st      , MonadIO m, MonadMask m      )   => CommentSettings@@ -81,8 +81,10 @@  -- | Print the generated documentation to the standard output. printDocumentation-  :: forall param st m . ( IsObject st+  :: forall param st m .+     ( IsObject st      , NiceParameterFull param+     , NiceStorageFull st      , MonadIO m      )   => IndigoContract param st@@ -92,8 +94,10 @@  -- | Save the generated documentation to the given file. saveDocumentation-  :: forall param st m . ( IsObject st+  :: forall param st m .+     ( IsObject st      , NiceParameterFull param+     , NiceStorageFull st      , MonadIO m, MonadMask m      )   => IndigoContract param st
− src/Indigo/Rebinded.hs
@@ -1,86 +0,0 @@--- SPDX-FileCopyrightText: 2020 Tocqueville Group------ SPDX-License-Identifier: LicenseRef-MIT-TQ---- | Reimplementation of some syntax sugar------ You need the following module pragmas to make it work smoothly:------ @--- &#x7b;-\# LANGUAGE NoApplicativeDo, RebindableSyntax \#-&#x7d;--- &#x7b;-\# OPTIONS_GHC -Wno-unused-do-bind \#-&#x7d;--- @--module Indigo.Rebinded-  ( -- * @if/then/else@ construct-    ifThenElse--  -- * Numerical literals resolution-  , fromInteger-  , nat-  , int-  , mutez--  -- * Re-exports-  , IsLabel (..)-  ) where--import qualified Prelude as P-import qualified Data.Kind as Kind--import Indigo.Backend.Conditional (IfConstraint)-import Indigo.Frontend-import Indigo.Internal-import Indigo.Lorentz-import Util.Label (IsLabel(..))--------------------------------------------------------------------------------- @if/then/else@ construct--------------------------------------------------------------------------------- | Defines semantics of @if ... then ... else ...@ construction for Indigo--- where the predicate is a generic @exa@ for which @IsExpr exa Bool@ holds-ifThenElse-  :: (IfConstraint a b, IsExpr exa Bool)-  => exa-  -> IndigoM a-  -> IndigoM b-  -> IndigoM (RetVars a)-ifThenElse cond = if_ (toExpr cond)--------------------------------------------------------------------------------- Numerical literals resolution--------------------------------------------------------------------------------- | Kind used for 'NumType' as part of the disambiguation machinery.-data NumKind = Nat | Int | Mtz---- | Disambiguation type used in 'fromInteger' that links a single 'NumKind' to--- the numeric type to resolve to.-data NumType (n :: NumKind) (t :: Kind.Type) where-  NNat :: NumType 'Nat Natural-  NInt :: NumType 'Int Integer-  NMtz :: NumType 'Mtz Mutez---- | Numerical literal disambiguation value for a 'Natural', see 'fromInteger'.-nat :: NumType 'Nat Natural-nat = NNat---- | Numerical literal disambiguation value for an 'Integer', see 'fromInteger'.-int :: NumType 'Int Integer-int = NInt---- | Numerical literal disambiguation value for a 'Mutez', see 'fromInteger'.-mutez :: NumType 'Mtz Mutez-mutez = NMtz---- | Defines numerical literals resolution for Indigo.------ It is implemented with an additional 'NumType' argument that disambiguates--- the resulting type.--- This allows, for example, @1 int@ to be resolved to @1 :: Integer@.-fromInteger :: Integer -> NumType n t -> t-fromInteger val = \case-  NNat -> P.fromInteger val-  NInt -> val-  NMtz -> toMutez (P.fromInteger val)
+ src/Indigo/Rebound.hs view
@@ -0,0 +1,86 @@+-- SPDX-FileCopyrightText: 2021 Oxhead Alpha+-- SPDX-License-Identifier: LicenseRef-MIT-OA++-- | Reimplementation of some syntax sugar+--+-- You need the following module pragmas to make it work smoothly:+--+-- @+-- &#x7b;-\# LANGUAGE NoApplicativeDo, RebindableSyntax \#-&#x7d;+-- &#x7b;-\# OPTIONS_GHC -Wno-unused-do-bind \#-&#x7d;+-- @++module Indigo.Rebound+  ( -- * @if/then/else@ construct+    ifThenElse++  -- * Numerical literals resolution+  , fromInteger+  , nat+  , int+  , mutez++  -- * Re-exports+  , IsLabel (..)+  ) where++import Data.Kind qualified as Kind+import Prelude qualified as P++import Indigo.Backend.Conditional (IfConstraint)+import Indigo.Common.Expr (IsExpr, toExpr)+import Indigo.Frontend (IndigoM, RetVars, if_)+import Indigo.Lorentz+import Morley.Tezos.Core (mkMutez)+import Morley.Util.Label (IsLabel(..))++----------------------------------------------------------------------------+-- @if/then/else@ construct+----------------------------------------------------------------------------++-- | Defines semantics of @if ... then ... else ...@ construction for Indigo+-- where the predicate is a generic @exa@ for which @IsExpr exa Bool@ holds+ifThenElse+  :: (IfConstraint a b, IsExpr exa Bool)+  => exa+  -> IndigoM a+  -> IndigoM b+  -> IndigoM (RetVars a)+ifThenElse cond = if_ (toExpr cond)++----------------------------------------------------------------------------+-- Numerical literals resolution+----------------------------------------------------------------------------++-- | Kind used for 'NumType' as part of the disambiguation machinery.+data NumKind = Nat | Int | Mtz++-- | Disambiguation type used in 'fromInteger' that links a single 'NumKind' to+-- the numeric type to resolve to.+data NumType (n :: NumKind) (t :: Kind.Type) where+  NNat :: NumType 'Nat Natural+  NInt :: NumType 'Int Integer+  NMtz :: NumType 'Mtz Mutez++-- | Numerical literal disambiguation value for a 'Natural', see 'fromInteger'.+nat :: NumType 'Nat Natural+nat = NNat++-- | Numerical literal disambiguation value for an 'Integer', see 'fromInteger'.+int :: NumType 'Int Integer+int = NInt++-- | Numerical literal disambiguation value for a 'Mutez', see 'fromInteger'.+mutez :: NumType 'Mtz Mutez+mutez = NMtz++-- | Defines numerical literals resolution for Indigo.+--+-- It is implemented with an additional 'NumType' argument that disambiguates+-- the resulting type.+-- This allows, for example, @1 int@ to be resolved to @1 :: Integer@.+fromInteger :: Integer -> NumType n t -> t+fromInteger val = \case+  NNat -> P.fromInteger val+  NInt -> val+  NMtz -> P.unsafe (mkMutez val)
test/Main.hs view
@@ -1,6 +1,5 @@--- SPDX-FileCopyrightText: 2020 Tocqueville Group------ SPDX-License-Identifier: LicenseRef-MIT-TQ+-- SPDX-FileCopyrightText: 2021 Oxhead Alpha+-- SPDX-License-Identifier: LicenseRef-MIT-OA  module Main   ( main@@ -9,7 +8,7 @@ import Prelude import Test.Tasty (defaultMainWithIngredients) -import Cleveland.Ingredients (ourIngredients)+import Test.Cleveland.Ingredients (ourIngredients) import Test.Util.Golden (regenerateTests) import Tree (tests) 
test/Test/Code/Decomposition.hs view
@@ -1,6 +1,5 @@--- SPDX-FileCopyrightText: 2020 Tocqueville Group------ SPDX-License-Identifier: LicenseRef-MIT-TQ+-- SPDX-FileCopyrightText: 2022 Oxhead Alpha+-- SPDX-License-Identifier: LicenseRef-MIT-OA  module Test.Code.Decomposition   ( Meta (..)@@ -12,15 +11,16 @@   ) where  import Indigo+import Test.Cleveland  data Meta = Meta   { mWeight :: Integer   , mDescr  :: MText-  } deriving stock (Generic, Show)+  } deriving stock (Generic, Show, Eq)     deriving anyclass (IsoValue, HasAnnotation)  data Color = Blue | White | Red-  deriving stock (Generic, Show, Enum, Bounded)+  deriving stock (Generic, Show, Enum, Eq, Bounded)   deriving anyclass (IsoValue, HasAnnotation)  data Storage = Storage@@ -28,8 +28,11 @@   , sX :: Integer   , sY :: Integer   , sMeta :: Meta-  } deriving stock (Generic, Show)+  } deriving stock (Generic, Show, Eq)     deriving anyclass (IsoValue, HasAnnotation)++instance HasRPCRepr Storage where+  type AsRPC Storage = Storage  instance HasField Meta "weight" Integer where   fieldLens = fieldLensADT #mWeight
test/Test/Code/Examples.hs view
@@ -1,15 +1,14 @@--- SPDX-FileCopyrightText: 2020 Tocqueville Group------ SPDX-License-Identifier: LicenseRef-MIT-TQ+-- SPDX-FileCopyrightText: 2022 Oxhead Alpha+-- SPDX-License-Identifier: LicenseRef-MIT-OA  -- | Examples of Indigo Contracts and Tests for them  module Test.Code.Examples   ( DummyOp (..)   , contractVarLorentz-  , ifTest   , contractIfLorentz   , contractIfValueLorentz+  , contractWhenLorentz   , contractWhileLorentz   , contractForEachLorentz   , contractCaseLorentz@@ -21,10 +20,10 @@   , contractIfConsLorentz   , contractWhileLeftLorentz   , contractWhileLeftIndigo+  , contractSimpleEmitLorentz   ) where  import Indigo-import qualified Lorentz.Run as L  import Test.Util @@ -34,14 +33,33 @@     _a <- new$ 10 int     return () -ifTest :: L.Contract Integer Integer-ifTest = noOptimizationContract contractIfValueLorentz+-- | Unlike 'contractIfLorentz', this tests whether @if .. then .. else@+-- can return a value.+contractIfValueLorentz :: ContractCode Integer Integer+contractIfValueLorentz = compileIndigoContract $ \param -> do+  let st = storageVar @Integer+  a <- new$ 7 int + param+  _sm <-+    if param < a+    then new (st + param)+    else return (st + param)+  return () +{-# ANN module ("HLint: ignore Use when" :: Text) #-}+ contractIfLorentz :: ContractCode Integer Integer-contractIfLorentz = L.cCode ifTest+contractIfLorentz = compileIndigoContract $ \param -> do+  a <- new$ 7 int + param+  if param < a+    then do+      _c <- new (storageVar @Integer)+      return ()+    else return ()+  _c <- new $ param < storageVar @Integer+  return () -contractIfValueLorentz :: ContractCode Integer Integer-contractIfValueLorentz = compileIndigoContract $ \param -> do+contractWhenLorentz :: ContractCode Integer Integer+contractWhenLorentz = compileIndigoContract $ \param -> do   a <- new$ 7 int + param   when (param < a) do     _c <- new$ storageVar @Integer@@ -120,8 +138,8 @@   setDelegate param   m <- new$ zeroMutez   is <- new$ 0 int-  addr <- createLorentzContract ifTest param m is-  storageVar =: addr+  addr <- createLorentzContract (mkContract contractIfLorentz) param m is+  storageVar =: coerce @Address addr  contractAssertLorentz :: ContractCode Integer Integer contractAssertLorentz = compileIndigoContract $ \param -> do@@ -184,3 +202,7 @@             (iL =: left $ i + 2 int)             (iL =: right i)         )++contractSimpleEmitLorentz :: ContractCode () (Either Integer MText)+contractSimpleEmitLorentz = compileIndigoContract $ \_ ->+  emit [annQ|test|] (varExpr storageVar :: Expr (Either Integer MText))
test/Test/Code/Expr.hs view
@@ -1,6 +1,5 @@--- SPDX-FileCopyrightText: 2020 Tocqueville Group------ SPDX-License-Identifier: LicenseRef-MIT-TQ+-- SPDX-FileCopyrightText: 2021 Oxhead Alpha+-- SPDX-License-Identifier: LicenseRef-MIT-OA  -- | Tests for Indigo Expr @@ -49,8 +48,8 @@ import Fmt (Buildable, pretty)  import Indigo+import Morley.Tezos.Crypto qualified as C import Test.Util-import qualified Tezos.Crypto as C  partialParse :: Buildable b => (a -> Either b c) -> a -> c partialParse f = either (error . pretty) id . f@@ -64,9 +63,6 @@ instance HasFieldOfType MyStore fname ftype =>          StoreHasField MyStore fname ftype where   storeFieldOps = storeFieldOpsADT--instance StoreHasSubmap MyStore "ints" Integer () where-  storeSubmapOps = storeSubmapOpsDeeper #ints  data MySum = MySumA Bool | MySumB Natural   deriving stock (Eq, Show, Generic)
test/Test/Code/Lambda.hs view
@@ -1,10 +1,8 @@--- SPDX-FileCopyrightText: 2020 Tocqueville Group------ SPDX-License-Identifier: LicenseRef-MIT-TQ+-- SPDX-FileCopyrightText: 2022 Oxhead Alpha+-- SPDX-License-Identifier: LicenseRef-MIT-OA  module Test.Code.Lambda   ( SmallMatrix (..)-  , dummyContract   , sumLambdaCalledOnce   , sumLambdaCalledTwice   , lambdasSideEffects@@ -14,7 +12,7 @@   ) where  import Indigo-import qualified Lorentz as L+import Lorentz qualified as L import Test.Util  {-# ANN sumLambda ("HLint: ignore Use uncurry" :: Text) #-}@@ -41,15 +39,16 @@  lambdaCreateContract ::   ( ex :~> (Maybe KeyHash, Integer)-  , HasSideEffects, HasStorage Integer+  , HasSideEffects, HasStorage [Address]+  , IsNotInView   ) => ex -> IndigoM ()-lambdaCreateContract = defNamedEffLambda1 @Integer "create storage" $ \paramSt -> do+lambdaCreateContract = defNamedEffLambda1 @[Address] "create storage" $ \paramSt -> do   m <- new$ zeroMutez-  _addr <- createLorentzContract dummyContract (fst paramSt) m (snd paramSt)-  storageVar @Integer += 1 int+  addr <- createLorentzContract dummyContract (fst paramSt) m (snd paramSt)+  storageVar =: addr .: storageVar  dummyContract-  :: L.Contract Integer Integer+  :: L.Contract Integer Integer () dummyContract = noOptimizationContract $ compileIndigoContract $ \param -> do   a <- new$ 7 int + param   when (param < a) do@@ -60,7 +59,7 @@  -- | Lambda that creates new contract is called twice. -- Test that original operations list is updated in lambda.-lambdasSideEffects :: ContractCode (Maybe KeyHash) Integer+lambdasSideEffects :: ContractCode (Maybe KeyHash) [Address] lambdasSideEffects = compileIndigoContract $ \param -> do   lambdaCreateContract (pair param $ 0 int)   lambdaCreateContract (pair param $ 1 int)
test/Test/DebugComments.hs view
@@ -1,6 +1,5 @@--- SPDX-FileCopyrightText: 2020 Tocqueville Group------ SPDX-License-Identifier: LicenseRef-MIT-TQ+-- SPDX-FileCopyrightText: 2022 Oxhead Alpha+-- SPDX-License-Identifier: LicenseRef-MIT-OA  module Test.DebugComments        ( whileLeftComments@@ -16,8 +15,8 @@ import Prelude hiding (drop, swap)  import Hedgehog (Gen)-import qualified Hedgehog.Gen as Gen-import qualified Hedgehog.Range as Range+import Hedgehog.Gen qualified as Gen+import Hedgehog.Range qualified as Range import Test.Tasty (TestTree)  import Indigo.Compilation@@ -36,28 +35,28 @@   [ testIndigoContract "Frontend comments"       genInteger       genInteger-      (\_ _ _ -> pure ())+      (\_ _ _ _ -> pure ())       (whileLeftComments LogTopLevelFrontendStatements)       pathFrontendComments    , testIndigoContract "Backend comments"       genInteger       genInteger-      (\_ _ _ -> pure ())+      (\_ _ _ _ -> pure ())       (whileLeftComments LogBackendStatements)       pathBackendComments    , testIndigoContract "Aux comments"       genInteger       genInteger-      (\_ _ _ -> pure ())+      (\_ _ _ _ -> pure ())       (whileLeftComments LogAuxCode)       pathAuxComments    , testIndigoContract "Expression comments"       genInteger       genInteger-      (\_ _ _ -> pure ())+      (\_ _ _ _ -> pure ())       (whileLeftComments LogExpressionsComputations)       pathExprComments   ]@@ -66,9 +65,9 @@     genInteger = Gen.integral (Range.linearFrom 0 -1000 1000)  whileLeftComments :: CommentsVerbosity -> ContractCode Integer Integer-whileLeftComments level =+whileLeftComments lvl =   compileIndigoContractFull-    (defaultCommentSettings level)+    (defaultCommentSettings lvl)     contractWhileLeftIndigo  whileLeftCommentsFullStack :: ContractCode Integer Integer
test/Test/Decomposition.hs view
@@ -1,6 +1,5 @@--- SPDX-FileCopyrightText: 2020 Tocqueville Group------ SPDX-License-Identifier: LicenseRef-MIT-TQ+-- SPDX-FileCopyrightText: 2021 Oxhead Alpha+-- SPDX-License-Identifier: LicenseRef-MIT-OA  module Test.Decomposition   ( test_Decomposition@@ -14,15 +13,15 @@  import Prelude +import Data.Default (def) import Hedgehog (Gen)-import qualified Hedgehog.Gen as Gen-import qualified Hedgehog.Range as Range+import Hedgehog.Gen qualified as Gen+import Hedgehog.Range qualified as Range import Test.Tasty (TestTree) -import Cleveland.Util (genTuple2) import Hedgehog.Gen.Michelson (genMText)-import Michelson.Interpret (MichelsonFailed(..))-import Michelson.Text (mt)+import Morley.Michelson.Text (mt)+import Test.Cleveland.Util (genTuple2) import Test.Code.Decomposition import Test.Util @@ -61,7 +60,7 @@ genInteger = Gen.integral (Range.linearFrom 0 -1000 1000)  genMeta :: Gen Meta-genMeta = Meta <$> Gen.integral (Range.linearFrom 0 -1000 1000) <*> genMText+genMeta = Meta <$> Gen.integral (Range.linearFrom 0 -1000 1000) <*> genMText def  genColor :: Gen Color genColor = Gen.enumBounded@@ -78,20 +77,17 @@ setDecomposedVariableCheck   :: (Color, (Integer, Integer))   -> Storage-  -> Either MichelsonFailed Storage-setDecomposedVariableCheck (c, (x, y)) Storage{..} =-  Right $ Storage c x y (Meta 0 (mDescr sMeta))+  -> Storage+setDecomposedVariableCheck (c, (x, y)) Storage{..} = Storage c x y (Meta 0 (mDescr sMeta))  setMaterializedVariableCheck   :: (Color, (Integer, Integer))   -> Storage-  -> Either MichelsonFailed Storage-setMaterializedVariableCheck (c, (x, y)) Storage{..} =-  Right $ Storage c x y (Meta 0 [mt|"hello, Ivan!"|])+  -> Storage+setMaterializedVariableCheck (c, (x, y)) Storage{} = Storage c x y (Meta 0 [mt|"hello, Ivan!"|])  setDecomposedFieldCheck   :: (Color, Integer)   -> Storage-  -> Either MichelsonFailed Storage-setDecomposedFieldCheck (c, w) Storage{..} =-  Right $ Storage c sX sY (Meta w (mDescr sMeta))+  -> Storage+setDecomposedFieldCheck (c, w) Storage{..} = Storage c sX sY (Meta w (mDescr sMeta))
test/Test/Examples.hs view
@@ -14,40 +14,47 @@   , contractVarLorentz   , contractIfLorentz   , contractIfValueLorentz+  , contractWhenLorentz   , contractIfRightLorentz   , contractIfConsLorentz   , contractCaseLorentz   , contractOpsLorentz   , contractAssertLorentz   , contractUserCommentLorentz+  , contractSimpleEmitLorentz   , pathWhile   , pathWhileLeft   , pathForEach   , pathVar   , pathIf   , pathIfValue+  , pathWhen   , pathIfRight   , pathIfCons+  , pathSimpleEmit   , pathCase   , pathOps   , pathAssert   , pathComment   ) where -import Lorentz+import Lorentz hiding ((>>)) import Prelude hiding (drop, swap) +import Fmt (pretty) import Hedgehog (Gen)-import qualified Hedgehog.Gen as Gen-import Hedgehog.Gen.Tezos.Address (genAddress)-import Hedgehog.Gen.Tezos.Crypto (genKeyHash)-import qualified Hedgehog.Range as Range+import Hedgehog.Gen qualified as Gen+import Hedgehog.Range qualified as Range import Test.Tasty (TestTree) -import Cleveland.Util (genTuple2)-import Michelson.Interpret (MichelsonFailed(..))-import Michelson.Runtime.GState-import qualified Michelson.Typed as T+import Hedgehog.Gen.Michelson (genMText)+import Hedgehog.Gen.Tezos.Address (genAddress)+import Hedgehog.Gen.Tezos.Crypto (genKeyHash', genKeyType)+import Morley.Michelson.Typed qualified as T+import Morley.Tezos.Address+import Morley.Tezos.Crypto (KeyType(..))+import Test.Cleveland+import Test.Cleveland.Util (genTuple2) import Test.Code.Examples import Test.Util @@ -66,7 +73,7 @@   [ testIndigoContract "WHILE"       genInteger       genInteger-      (validateContractSt whileCheck)+      whileCheck       contractWhileLorentz       pathWhile   , testIndigoContract "WHILE_LEFT"@@ -105,12 +112,24 @@       (validateContractSt ifConsCheck)       contractIfConsLorentz       pathIfCons+  , testIndigoContract "SIMPLE_EMIT"+      (pure ())+      (Gen.either genInteger (genMText def))+      emitCheck+      contractSimpleEmitLorentz+      pathSimpleEmit   , testIndigoContract "IF_RET_VALUE"       genInteger       genInteger       validateContractConst       contractIfValueLorentz       pathIfValue+  , testIndigoContract "WHEN"+      genInteger+      genInteger+      validateContractConst+      contractWhenLorentz+      pathWhen   , testIndigoContract "CASE"       genDummyOp       genInteger@@ -120,21 +139,21 @@   , testIndigoDoc "DOC"       contractDocLorentz expectedDocContract   , testIndigoContract "OPS"-      (Gen.maybe genKeyHash)+      (Gen.maybe $ genKeyHash' $ Gen.filter (/= KeyTypeBLS) genKeyType)       genAddress-      (validateContractOps opsCheck)+      opsCheck       contractOpsLorentz       pathOps   , testIndigoContract "ASSERT"       genInteger       genInteger-      (validateContractSt assertCheck)+      assertCheck       contractAssertLorentz       pathAssert   , testIndigoContract "COMMENTS"       genInteger       genInteger-      (\_ _ _ -> pure ())+      (\_ _ _ _ -> pure ())       contractUserCommentLorentz       pathComment   ]@@ -170,12 +189,18 @@ pathIfValue :: FilePath pathIfValue = "test/contracts/golden/if_ret_value.tz" +pathWhen :: FilePath+pathWhen = "test/contracts/golden/when.tz"+ pathIfRight :: FilePath pathIfRight = "test/contracts/golden/if_right_value.tz"  pathIfCons :: FilePath pathIfCons = "test/contracts/golden/if_cons_value.tz" +pathSimpleEmit :: FilePath+pathSimpleEmit = "test/contracts/golden/simple_emit.tz"+ pathCase :: FilePath pathCase = "test/contracts/golden/case.tz" @@ -192,49 +217,73 @@ -- Validate Functions -------------------------------------------------------------------------------- -ifRightCheck :: Integer -> Integer -> Either MichelsonFailed Integer+ifRightCheck :: Integer -> Integer -> Integer ifRightCheck param _st-  | param >= 10 = Right 10-  | otherwise = Right 0+  | param >= 10 = 10+  | otherwise = 0 -ifConsCheck :: Integer -> Integer -> Either MichelsonFailed Integer+ifConsCheck :: Integer -> Integer -> Integer ifConsCheck param _st-  | param >= 10 = Right 3-  | otherwise = Right 0+  | param >= 10 = 3+  | otherwise = 0 -whileCheck :: Integer -> Integer -> Either MichelsonFailed Integer-whileCheck param st-  | st <= 0 = Right 0-  | param == 0 = Left zeroDivFail-  | otherwise = Right . sum $ filter ((== 0) . (`T.modMich` param)) [0..(st - 1)]+whileCheck :: MonadCleveland caps m+           => Integer -> Integer -> ContractHandle Integer Integer () -> m a -> m ()+whileCheck param st h act+  | st <= 0 = act >> (getStorage h @@== 0)+  | param == 0 = expectFailedWith [mt|division by zero|] act+  | otherwise = act >> (getStorage h @@== sum (filter ((== 0) . (`T.modMich` param)) [0..(st - 1)])) -whileLeftCheck :: Integer -> Integer -> Either MichelsonFailed Integer+whileLeftCheck :: Integer -> Integer -> Integer whileLeftCheck param _st-  | param < 10 && (param `mod` 2) == 0 = Right 10-  | otherwise = Right param+  | param < 10 && even param = 10+  | otherwise = param -forEachCheck :: [Integer] -> Integer -> Either MichelsonFailed Integer-forEachCheck param _st = Right $ sum param+forEachCheck :: [Integer] -> Integer -> Integer+forEachCheck param _st = sum param -caseCheck :: DummyOp -> Integer -> Either MichelsonFailed Integer-caseCheck param _st = Right $ case param of+caseCheck :: DummyOp -> Integer -> Integer+caseCheck param _st = case param of   DSub (a, b) -> a - b   DAdd (a, b) -> a + b -opsCheck :: Maybe KeyHash -> Address -> Either MichelsonFailed [Operation]-opsCheck param _st = Right [crConOp, setDelOp]-  where-    setDelOp = T.OpSetDelegate $ T.SetDelegate param-    crConOp = T.OpCreateContract $-      T.CreateContract genesisAddress param (toMutez 0) (T.VInt 0)-      (T.cCode $ compileLorentzContract ifTest)+opsCheck :: MonadCleveland caps m+         => Maybe KeyHash+         -> Address+         -> ContractHandle (Maybe KeyHash) Address ()+         -> m a+         -> m ()+opsCheck expectedDelegate st contract action = do+  expectedDelegate & maybe pass \hash -> do+    let delegateAddr = AddressWithAlias (ImplicitAddress hash) "delegate"+    transfer delegateAddr [tz|1|]+    registerDelegate delegateAddr+  void action+  getDelegate contract @@== expectedDelegate+  originatedContract <- getStorage contract+  originatedContract @/= st+  case originatedContract of+    Constrained addr@ContractAddress{} -> do+      getDelegate addr @@== expectedDelegate+      getStorage @Integer addr @@== 0+    _ -> failure $ "Expected contract address, got " <> pretty originatedContract -assertCheck :: Integer -> Integer -> Either MichelsonFailed Integer-assertCheck param st-  | sm <= 0 = Left negativeResFail-  | otherwise = Right sm+assertCheck :: MonadCleveland caps m+            => Integer -> Integer -> ContractHandle Integer Integer () -> m a -> m ()+assertCheck param st h act+  | sm <= 0 = expectFailedWith [mt|unacceptable negative result|] act+  | otherwise = act >> (getStorage h @@== sm)   where sm = st + param +emitCheck+  :: forall caps m st. (MonadCleveland caps m, NiceStorage st, HasAnnotation st)+  => () -> st -> ContractHandle () st () -> m [ContractEvent] -> m ()+emitCheck _ st _ act = act >>= \case+  [ContractEvent{..}] -> do+    ceTag @== "test"+    cePayload @== Just (T.SomeAnnotatedValue (getAnnotation @st NotFollowEntrypoint) (toVal st))+  x -> failure $ "Expected one event, but got " <> pretty (length x)+ -------------------------------------------------------------------------------- -- Expected Contracts --------------------------------------------------------------------------------@@ -243,7 +292,7 @@ -- differences that get eliminated by using `optimizeLorentz` on both  expectedDocContract :: ContractCode Integer Integer-expectedDocContract =+expectedDocContract = mkContractCode $   -- add an empty operation list at the bottom of the stack   nil # swap #   -- leave `param` followed by `st` on the stack
test/Test/Expr.hs view
@@ -1,6 +1,5 @@--- SPDX-FileCopyrightText: 2020 Tocqueville Group------ SPDX-License-Identifier: LicenseRef-MIT-TQ+-- SPDX-FileCopyrightText: 2021 Oxhead Alpha+-- SPDX-License-Identifier: LicenseRef-MIT-OA  -- | Tests for Indigo Expr @@ -10,32 +9,33 @@  import Prelude -import qualified Data.Bits as B-import qualified Data.Map as M-import qualified Data.Set as S-import GHC.Natural (intToNatural, naturalFromInteger, naturalToInt)+import Data.Bits qualified as B+import Data.Map qualified as M+import Data.Set qualified as S import Hedgehog (Gen)-import qualified Hedgehog.Gen as Gen-import qualified Hedgehog.Range as Range+import Hedgehog.Gen qualified as Gen+import Hedgehog.Range qualified as Range import Test.Tasty (TestTree) -import Cleveland.Util (genTuple2) import Hedgehog.Gen.Michelson (genMText) import Hedgehog.Gen.Michelson.Typed (genBigMap) import Hedgehog.Gen.Tezos.Address (genAddress) import Hedgehog.Gen.Tezos.Core (genChainId, genMutez) import Hedgehog.Gen.Tezos.Crypto (genKeyHash, genPublicKey, genSignature)-import qualified Indigo as I+import Indigo qualified as I import Indigo.Lorentz-import Michelson.Interpret (MichelsonFailed(..), runUnpack)-import Michelson.Interpret.Pack-import Michelson.Runtime.GState (genesisAddress)-import Michelson.Text-import qualified Michelson.Typed as T+import Morley.Michelson.Interpret (runUnpack)+import Morley.Michelson.Interpret.Pack+import Morley.Michelson.Runtime.GState (genesisAddress)+import Morley.Michelson.Text+import Morley.Michelson.Typed qualified as T+import Morley.Michelson.Typed.Haskell.Value (BigMap(..))+import Morley.Tezos.Address+import Morley.Tezos.Core (dummyChainId)+import Morley.Tezos.Crypto qualified as C+import Test.Cleveland.Util (genTuple2) import Test.Code.Expr import Test.Util-import Tezos.Core (dummyChainId, unsafeMkMutez)-import qualified Tezos.Crypto as C  genMyStore :: Gen MyStore genMyStore = MyStore@@ -52,20 +52,20 @@ test_SmallIndigoExpr :: [TestTree] test_SmallIndigoExpr =   [ testIndigo "Cast" genInteger genInteger (validateStSuccess const) (exprUnary @Integer I.cast)-  , testIndigo "Size" genIntegerList genNatural (validateStSuccess (const . intToNatural . length)) exprSize+  , testIndigo "Size" genIntegerList genNatural (validateStSuccess (const . fromIntegralOverflowing . length)) exprSize   , testIndigo "Add" genInteger genInteger (validateStSuccess (+)) (exprBinary @Integer (I.+))   , testIndigo "Sub" genInteger genInteger (validateStSuccess (-)) (exprBinary @Integer (I.-))   , testIndigo "Mul" genInteger genInteger (validateStSuccess (*)) (exprBinary @Integer (I.*))   , testIndigo "Neg" genInteger genInteger (validateStSuccess (const . negate)) (exprUnary @Integer I.neg)-  , testIndigo "Abs" genInteger genNatural (validateStSuccess (\p _ -> naturalFromInteger $ abs p)) exprAbs+  , testIndigo "Abs" genInteger genNatural (validateStSuccess (\p _ -> fromIntegralOverflowing $ abs p)) exprAbs   , testIndigo "DivEq" genInteger genInteger (validateStEither divEqCheck) exprDivEq   , testIndigo "ModNeq" genInteger genInteger (validateStEither modNeqCheck) exprModNeq   , testIndigo "Le3" genInteger Gen.bool (validateStSuccess (const . (<= 3))) exprLe3   , testIndigo "Lt3OrGt10" genInteger Gen.bool (validateStSuccess (\p _ -> p < 3 || p > 10)) exprLt3OrGt10   , testIndigo "Lt3OrGt10" genInteger Gen.bool (validateStSuccess (\p _ -> p >= 3 && p < 10)) exprGe3AndNotGe10   , testIndigo "Xor" genNatural genNatural (validateStSuccess xor) (exprBinary @Natural (I.^))-  , testIndigo "Lsl" genNatural genShiftNatural (validateStSuccess (\p st -> B.shiftL p (naturalToInt st))) (exprBinary @Natural (I.<<<))-  , testIndigo "Lsr" genNatural genShiftNatural (validateStSuccess (\p st -> B.shiftR p (naturalToInt st))) (exprBinary @Natural (I.>>>))+  , testIndigo "Lsl" genNatural genShiftNatural (validateStSuccess (\p st -> B.shiftL p (fromIntegralOverflowing st))) (exprBinary @Natural (I.<<<))+  , testIndigo "Lsr" genNatural genShiftNatural (validateStSuccess (\p st -> B.shiftR p (fromIntegralOverflowing st))) (exprBinary @Natural (I.>>>))   , testIndigo "Ge4OrNeq5AndEq6" genInteger Gen.bool (validateStSuccess (\p _ -> p >= 4 || p /= 5 && p == 6)) exprGe4OrNeq5AndEq6   , testIndigo "Not" Gen.bool Gen.bool (validateStSuccess (\p _ -> not p)) exprNot   , testIndigo "IsNat" genInteger (Gen.maybe genNatural) (validateStSuccess isNatCheck) exprIsNat@@ -85,14 +85,14 @@    , testIndigo "Set" genIntegerSet genInteger (validateStack2 setCheck) exprSet   , testIndigo "EmptySet" genUnit genIntegerSet (validateStSuccess (\_ _ -> S.empty)) exprEmptySet-  , testIndigo "BigMapLookup" genBigMapInt genIntegerMaybe (validateStSuccess (\(BigMap p) _st -> M.lookup 2 p)) exprBigMapLookup-  , testIndigo "BigMapDelete" genInteger genBigMapInt (validateStSuccess (\p (BigMap st) -> BigMap $ M.delete p st)) exprBigMapDelete-  , testIndigo "BigMapInsert" genInteger genBigMapInt (validateStSuccess (\p (BigMap st) -> BigMap $ M.insert p p st)) exprBigMapInsert+  , testIndigo "BigMapLookup" genBigMapInt genIntegerMaybe (validateStSuccess (\(bmMap -> p) _st -> M.lookup 2 p)) exprBigMapLookup+  , testIndigo "BigMapDelete" genInteger genBigMapInt (validateStSuccess (\p (BigMap i st) -> BigMap i $ M.delete p st)) exprBigMapDelete+  , testIndigo "BigMapInsert" genInteger genBigMapInt (validateStSuccess (\p (BigMap i st) -> BigMap i $ M.insert p p st)) exprBigMapInsert   , testIndigo "Pack" genSignature genByteString (validateStSuccess (\p _ -> packValue' $ T.VSignature p)) exprPack   , testIndigo "Unpack" genByteString (Gen.maybe genSignature) (validateStSuccess unpackCheck) exprUnpack   , testIndigo "Cons" genInteger genIntegerList (validateStSuccess (\(p :: Integer) s -> p : s)) exprCons-  , testIndigo "Concat" genMText genMText (validateStSuccess @_ @MText (\p s -> p <> s)) exprConcat-  , testIndigo "Slice" genNatural (Gen.maybe genMText) (validateStSuccess sliceCheck) exprSlice+  , testIndigo "Concat" genMText' genMText' (validateStSuccess @MText (\p s -> p <> s)) exprConcat+  , testIndigo "Slice" genNatural (Gen.maybe genMText') (validateStSuccess sliceCheck) exprSlice    -- TODO: Our current testing framework uses storage type for   -- validation, meaning that we cannot test contracts that way@@ -110,9 +110,9 @@   , testIndigo "Crypto" genByteString genByteString (validateStack2 cryptoCheck) exprCrypto   , testIndigo "HashKey" genPublicKey genKeyHash (validateStSuccess (\p _ -> C.hashKey p)) exprHashKey   , testIndigo "ChainId" genUnit genChainId (validateStSuccess (\_ _ -> dummyChainId)) (exprNullary I.chainId)-  , testIndigo "Amount" genUnit genMutez (validateStSuccess (\_ _ -> unsafeMkMutez 100)) (exprNullary I.amount)-  , testIndigo "Balance" genUnit genMutez (validateStSuccess (\_ _ -> unsafeMkMutez 100)) (exprNullary I.balance)-  , testIndigo "Sender" genUnit genAddress (validateStSuccess (\_ _ -> genesisAddress)) (exprNullary I.sender)+  , testIndigo "Amount" genUnit genMutez' (validateStSuccess (\_ _ -> [tz|100u|])) (exprNullary I.amount)+  , testIndigo "Balance" genUnit genMutez' (validateStSuccess (\_ _ -> [tz|100u|])) (exprNullary I.balance)+  , testIndigo "Sender" genUnit genAddress (validateStSuccess (\_ _ -> MkAddress genesisAddress)) (exprNullary I.sender)    -- TODO: ContractEnv needed   -- , Now@@ -123,6 +123,8 @@   ]    where+    genMutez' = genMutez def+    genMText' = genMText def     genIntegerList = Gen.list (Range.linear 0 100) genInteger     genIntegerSet = Gen.set (Range.linear 0 100) genInteger     genIntegerPair = genTuple2 genInteger genInteger@@ -131,7 +133,7 @@     genInteger = Gen.integral @_ @Integer (Range.linearFrom 0 -1000 1000)     genByteString = Gen.bytes (Range.linear 0 100)     genUnit = pure ()-    genBigMapInt = genBigMap genInteger genInteger+    genBigMapInt = genBigMap def genInteger genInteger      -- Cannot shift by more than 256 bits     genShiftNatural = Gen.integral @_ @Natural (Range.linear 0 256)@@ -140,12 +142,12 @@ -- Expected behavior ---------------------------------------------------------------------------- -divEqCheck :: Integer -> Integer -> Either MichelsonFailed Integer+divEqCheck :: Integer -> Integer -> Either MichelsonFailureWithStack Integer divEqCheck param st   | param == 0 = Left zeroDivFail   | otherwise = Right $ st `T.divMich` param -modNeqCheck :: Integer -> Integer -> Either MichelsonFailed Integer+modNeqCheck :: Integer -> Integer -> Either MichelsonFailureWithStack Integer modNeqCheck param st   | param == 0 = Left zeroDivFail   | st `T.modMich` param /= 0 = Right 0@@ -153,7 +155,7 @@  isNatCheck :: Integer -> Maybe Natural -> Maybe Natural isNatCheck param _st-  | param >= 0 = Just (naturalFromInteger param)+  | param >= 0 = Just (fromIntegralOverflowing param)   | otherwise = Nothing  unpackCheck :: ByteString -> Maybe Signature -> Maybe Signature@@ -163,7 +165,7 @@     unwrap :: Value 'T.TSignature -> Signature     unwrap (T.VSignature signature) = signature -setCheck :: Set Integer -> Integer -> Either MichelsonFailed (Set Integer, Integer)+setCheck :: Set Integer -> Integer -> Either MichelsonFailureWithStack (Set Integer, Integer) setCheck param _st = Right (newParam, newSt)   where     newParam@@ -174,7 +176,7 @@       | otherwise = 1  sliceCheck :: Natural -> Maybe MText -> Maybe MText-sliceCheck param (Just st) = Just . takeMText (naturalToInt param) $ st+sliceCheck param (Just st) = Just . takeMText (fromIntegralOverflowing param) $ st sliceCheck _param Nothing = Nothing  checkSignatureCheck :: Bool -> Bool -> Bool@@ -188,7 +190,7 @@ storeCheck   :: Integer   -> MyStore-  -> Either MichelsonFailed (Integer, MyStore)+  -> Either MichelsonFailureWithStack (Integer, MyStore) storeCheck param st   | param == 0 || M.member 0 stBigMap = Left notNewKeyFail   | M.member -1 st1BigMap = Right (param, st)@@ -203,7 +205,7 @@ cryptoCheck   :: ByteString   -> ByteString-  -> Either MichelsonFailed (ByteString, ByteString)+  -> Either MichelsonFailureWithStack (ByteString, ByteString) cryptoCheck param _st = Right (C.sha512 param, C.blake2b param)  nonZeroCheck :: Integer -> Maybe Integer -> Maybe Integer
test/Test/Lambda.hs view
@@ -1,6 +1,5 @@--- SPDX-FileCopyrightText: 2020 Tocqueville Group------ SPDX-License-Identifier: LicenseRef-MIT-TQ+-- SPDX-FileCopyrightText: 2021 Oxhead Alpha+-- SPDX-License-Identifier: LicenseRef-MIT-OA  module Test.Lambda   ( test_Lambdas@@ -18,18 +17,18 @@  import Prelude +import Fmt (pretty) import Hedgehog (Gen)-import qualified Hedgehog.Gen as Gen-import qualified Hedgehog.Range as Range+import Hedgehog.Gen qualified as Gen+import Hedgehog.Range qualified as Range import Test.Hspec.Expectations (errorCall, shouldThrow) import Test.Tasty (TestTree) import Test.Tasty.HUnit (testCase)  import Hedgehog.Gen.Tezos.Crypto (genKeyHash)-import Lorentz hiding (map)-import Michelson.Interpret (MichelsonFailed(..))-import Michelson.Runtime.GState-import qualified Michelson.Typed as T+import Lorentz (KeyHash)+import Morley.Tezos.Address+import Test.Cleveland import Test.Code.Lambda import Test.Util @@ -44,8 +43,8 @@       (validateContractSt sumLambdaCheck)       sumLambdaCalledTwice pathSumLambdaCalledTwice   , testIndigoContract "Lambda with side effects"-      (Gen.maybe genKeyHash) genInteger-      (validateContract lambdasSideEffectsCheck)+      (Gen.maybe genKeyHash) (Gen.constant [])+      lambdasSideEffectsCheck       lambdasSideEffects pathLambdasSideEffects   , testIndigoContract "Inner lambdas"       genSmallMatrix genInteger@@ -79,15 +78,25 @@ pathLambdaInLambda2 :: FilePath pathLambdaInLambda2 = "test/contracts/golden/lambda/impure_inner_lambdas2.tz" -sumLambdaCheck :: [Integer] -> Integer -> Either MichelsonFailed Integer-sumLambdaCheck param _st = Right $ sum param+sumLambdaCheck :: [Integer] -> Integer -> Integer+sumLambdaCheck param _st = sum param -lambdasSideEffectsCheck :: Maybe KeyHash -> Integer -> Either MichelsonFailed ([Operation], Integer)-lambdasSideEffectsCheck param st = Right ([crConOp 1, crConOp 0], st + 2)-  where-    crConOp c = T.OpCreateContract $-      T.CreateContract genesisAddress param (toMutez 0) (T.VInt c)-      (T.cCode $ compileLorentzContract dummyContract)+lambdasSideEffectsCheck+  :: MonadCleveland caps m+  => Maybe KeyHash+  -> [Address]+  -> ContractHandle (Maybe KeyHash) [Address] ()+  -> m a+  -> m ()+lambdasSideEffectsCheck param _st contract action = do+  void action+  originatedContracts <- getStorage contract+  forM_ @_ @_ @() (zip [(0 :: Integer) ..] $ reverse originatedContracts) \(n, ct) -> do+    case ct of+      Constrained addr@ContractAddress{} -> do+        getDelegate addr @@== param+        getStorage @Integer addr @@== n+      _ -> failure $ "Expected ContractAddress, but got " <> pretty ct  genSmallMatrix :: Gen SmallMatrix genSmallMatrix =@@ -96,5 +105,5 @@   $ Gen.list (Range.linear 0 15)   $ Gen.integral (Range.linearFrom 0 -1000 1000) -lambdaInLambdaCheck :: SmallMatrix -> Integer -> Either MichelsonFailed Integer-lambdaInLambdaCheck (SmallMatrix param) st = Right $ sum (st : map sum param)+lambdaInLambdaCheck :: SmallMatrix -> Integer -> Integer+lambdaInLambdaCheck (SmallMatrix param) st = sum (st : map sum param)
test/Test/Lookup.hs view
@@ -1,6 +1,5 @@--- SPDX-FileCopyrightText: 2020 Tocqueville Group------ SPDX-License-Identifier: LicenseRef-MIT-TQ+-- SPDX-FileCopyrightText: 2021 Oxhead Alpha+-- SPDX-License-Identifier: LicenseRef-MIT-OA  {-# OPTIONS_GHC -Wno-redundant-constraints #-} @@ -11,16 +10,17 @@   ) where  import Data.Singletons (Sing)-import Data.Typeable ((:~:)(..), eqT)+import Data.Typeable (eqT, (:~:)(..)) import Test.HUnit (Assertion, (@?=)) import Test.Tasty (TestTree, testGroup) import Test.Tasty.HUnit (testCase)  import Indigo hiding (fromInteger)+import Indigo.Backend.Lookup import Indigo.Backend.Prelude (fromInteger)-import qualified Lorentz.Instr as L-import qualified Lorentz.Macro as L-import Util.Peano+import Lorentz.Instr qualified as L+import Lorentz.Macro qualified as L+import Morley.Util.Peano  -------------------------------------------------------------------------------- @@ -86,15 +86,12 @@ --------------------------------------------------------------------------------  testVarActionGet-  :: forall (n :: Peano) s1 tail.-     ( L.ConstraintDuupXLorentz n FourInts Integer s1 tail-     , L.DuupX ('S n) FourInts Integer s1 tail-     )+  :: forall (n :: Peano) out. L.ConstraintDUPNLorentz ('S n) FourInts out Integer   => Sing ('S n) -> Assertion testVarActionGet (SS n) = duupXInstr @?= varActionGet (nthVar n) (StkElements fullStk)   where     duupXInstr :: FourInts :-> (Integer ': FourInts)-    duupXInstr = L.duupXImpl @('S n) @FourInts @Integer @s1 @tail+    duupXInstr = L.dupNPeano @('S n) @Integer @FourInts @out  testVarActionSet   :: forall (n :: Peano) mid tail.
test/Test/Util.hs view
@@ -1,6 +1,5 @@--- SPDX-FileCopyrightText: 2020 Tocqueville Group------ SPDX-License-Identifier: LicenseRef-MIT-TQ+-- SPDX-FileCopyrightText: 2021 Oxhead Alpha+-- SPDX-License-Identifier: LicenseRef-MIT-OA  -- | Utils for testing Indigo @@ -12,11 +11,8 @@   , zeroDivFail   , notNewKeyFail   , notNewKeyM-  , negativeResFail   , negativeResM -  , validateContract-  , validateContractOps   , validateContractSt   , validateContractConst @@ -25,11 +21,12 @@   , validateStack2    , noOptimizationContract+  , MichelsonFailureWithStack   ) where -import qualified Data.Text.IO.Utf8 as Utf8 (readFile)+import Data.Text.IO.Utf8 qualified as Utf8 (readFile) import Fmt (pretty)-import Hedgehog (Gen, MonadTest, PropertyT, annotate, forAll, property, (===))+import Hedgehog (Gen, MonadTest, PropertyT, annotate, failure, forAll, property, (===)) import Prelude import Test.HUnit ((@?=)) import Test.Tasty (TestTree, testGroup)@@ -38,13 +35,18 @@  import Indigo.Lorentz import Lorentz.Run (Contract(..))-import Lorentz.Test (ContractPropValidator, contractProp, dummyContractEnv, failedTest)-import Michelson.Doc.Test (buildMarkdownDocTest)-import Michelson.Interpret (MichelsonFailed(..))-import Michelson.Typed.Haskell.Value (IsoValuesStack)+import Morley.Michelson.Interpret (MichelsonFailed(..))+import Morley.Michelson.Interpret qualified as Interpret (MichelsonFailureWithStack(..))+import Morley.Michelson.Runtime.Dummy (dummyContractEnv)+import Morley.Michelson.Typed.Haskell.Value (IsoValuesStack)+import Test.Cleveland hiding (failure)+import Test.Cleveland.Doc (buildMarkdownDocTest)+import Test.Cleveland.Lorentz.Types (ToStorageType) +type MichelsonFailureWithStack = Interpret.MichelsonFailureWithStack Void+ type IndigoInstrValidator m pm st out =-  pm -> st -> Either MichelsonFailed (Rec Identity out) -> m ()+  pm -> st -> Either MichelsonFailureWithStack (Rec Identity out) -> m ()  -------------------------------------------------------------------------------- -- Tests@@ -56,12 +58,14 @@ testIndigoContract   :: forall pm st.      ( Show pm, Show st-     , NiceParameterFull pm, NiceStorage st+     , NiceParameterFull pm, NiceStorageFull st+     , HasCallStack+     , HasEntrypointArg pm (EntrypointRef 'Nothing) pm      )   => String   -> Gen pm   -> Gen st-  -> (pm -> st -> ContractPropValidator (ToT st) (PropertyT IO ()))+  -> (forall caps m. MonadCleveland caps m => pm -> st -> ContractHandle pm st () -> m [ContractEvent] -> m ())   -> ContractCode pm st   -> FilePath   -> TestTree@@ -73,19 +77,13 @@     , testProperty "has the correct resulting state and operations" $ property $ do         pm <- forAll genPm         st <- forAll genSt-        contProp pm st+        testScenarioProps $ scenarioEmulated do+          h <- originate "contract" st iContractWithoutOptimization+          propValidator pm st h $ transfer h WithContractEvents $ calling def pm     ]   where     iContractWithoutOptimization = noOptimizationContract iContract -    contProp :: pm -> st -> PropertyT IO ()-    contProp param storage =-      withDict (niceParameterEvi @pm) $-      contractProp-        (compileLorentzContract iContractWithoutOptimization)-        (propValidator param storage)-        dummyContractEnv param storage- testIndigoDoc     :: forall pm st.        String@@ -120,18 +118,15 @@ -- Common failures -------------------------------------------------------------------------------- -zeroDivFail :: MichelsonFailed-zeroDivFail = errorToVal [mt|devision by zero|] MichelsonFailedWith+zeroDivFail :: MichelsonFailureWithStack+zeroDivFail = errorToMichelsonVal [mt|division by zero|] -notNewKeyFail :: MichelsonFailed-notNewKeyFail = errorToVal notNewKeyM MichelsonFailedWith+notNewKeyFail :: MichelsonFailureWithStack+notNewKeyFail = errorToMichelsonVal notNewKeyM  notNewKeyM :: MText notNewKeyM = [mt|not new key|] -negativeResFail :: MichelsonFailed-negativeResFail = errorToVal negativeResM MichelsonFailedWith- negativeResM :: MText negativeResM = [mt|unacceptable negative result|] @@ -139,49 +134,27 @@ -- Contract Validators -------------------------------------------------------------------------------- --- | Makes a validator for `testIndigoContract` that can expect a failure or a--- resulting [Operation] from the given function. Ignores new storage value.-validateContract-  :: MonadTest m-  => IsoValue st-  => (pm -> st -> Either MichelsonFailed ([Operation], st))-  -> pm -> st -> ContractPropValidator (ToT st) (m ())-validateContract fn param st (res, _) =-  assertMichelsonResult (fn param st) res $ \(ops, val) (opsRes, resVal) -> do-    annotate "matches resulting Storage and Operations"-    (ops, toVal val) === (opsRes, resVal)----- | Makes a validator for `testIndigoContract` that can expect a failure or a--- resulting [Operation] from the given function. Ignores new storage value.-validateContractOps-  :: MonadTest m-  => (pm -> st -> Either MichelsonFailed [Operation])-  -> pm -> st -> ContractPropValidator (ToT st) (m ())-validateContractOps fn param st (res, _) =-  assertMichelsonResult (fn param st) res $ \ops (opsRes, _) -> do-    annotate "matches resulting Operations"-    ops === opsRes---- | Makes a validator for `testIndigoContract` that can expect a failure or a--- new storage from the given function. Ignores resulting [Operation]+-- | Makes a validator for `testIndigoContract` that can expect a+-- new storage from the given function. validateContractSt-  :: MonadTest m-  => IsoValue st-  => (pm -> st -> Either MichelsonFailed st)-  -> pm -> st -> ContractPropValidator (ToT st) (m ())-validateContractSt fn param st (res, _) =-  assertMichelsonResult (fn param st) res $ \val (_, resVal) -> do-    annotate "matches resulting Storage"-    toVal val === resVal+  :: forall st addr caps m pm.+     ( Show (AsRPC st), Eq (AsRPC st), NiceStorage (AsRPC st)+     , ToStorageType st addr, MonadCleveland caps m )+  => (pm -> st -> AsRPC st) -> pm -> st -> addr -> m [ContractEvent] -> m ()+validateContractSt val pm st h act = clarifyErrors "matches expected storage" do+  void $ act+  Showing <$> (getStorage @st h) @@== Showing (val pm st)  -- | Validator for `testIndigoContract` that expects the storage to remain--- the same and the resulting [Operation] to be empty. Ignores the parameter.+-- the same. Ignores the parameter. validateContractConst-  :: MonadTest m-  => IsoValue st-  => pm -> st -> ContractPropValidator (ToT st) (m ())-validateContractConst = validateContract (\_param st -> Right ([], st))+  :: forall st addr caps m pm.+     ( Show (AsRPC st), Eq (AsRPC st), NiceStorage (AsRPC st)+     , ToStorageType st addr, MonadCleveland caps m )+  => pm -> AsRPC st -> addr -> m [ContractEvent] -> m ()+validateContractConst _ st h act = clarifyErrors "storage doesn't change" do+  void $ act+  Showing <$> (getStorage @st h) @@== Showing st  -------------------------------------------------------------------------------- -- Instr Validators@@ -191,7 +164,7 @@ -- and the "storage" value to have changed as described by the given function. -- Resulting "param" is ignored. validateStSuccess-  :: (MonadTest m, Eq st, Show st)+  :: forall pm st m. (MonadTest m, Eq st, Show st)   => (pm -> st -> st)   -> IndigoInstrValidator m pm st '[pm, st] validateStSuccess fn = validateStEither (\p s -> Right $ fn p s)@@ -200,7 +173,7 @@ -- and Either end with a failure or with a new stack. Resulting "param" is ignored. validateStEither   :: forall m st pm. (MonadTest m, Eq st, Show st)-  => (pm -> st -> Either MichelsonFailed st)+  => (pm -> st -> Either MichelsonFailureWithStack st)   -> IndigoInstrValidator m pm st '[pm, st] validateStEither fn param st res = assertMichelsonResult (fn param st) res checkSt   where@@ -213,8 +186,8 @@ -- | Makes a validator for `testIndigo` that expects the stack to have 3 element -- (in order and with given values) or a failure to occur. validateStack2-  :: forall m st pm . (MonadTest m, Eq pm, Eq st, Show pm, Show st)-  => (pm -> st -> Either MichelsonFailed (pm, st))+  :: forall m st pm. (MonadTest m, Eq pm, Eq st, Show pm, Show st)+  => (pm -> st -> Either MichelsonFailureWithStack (pm, st))   -> IndigoInstrValidator m pm st '[pm, st] validateStack2 fn param st res = assertMichelsonResult (fn param st) res checkSt   where@@ -224,29 +197,30 @@       annotate "matches resulting state"       val === (newParam, newState) - -------------------------------------------------------------------------------- -- Helpers --------------------------------------------------------------------------------  assertMichelsonResult   :: MonadTest m-  => Either MichelsonFailed a-  -> Either MichelsonFailed b+  => Either MichelsonFailureWithStack a+  -> Either MichelsonFailureWithStack b   -> (a -> b -> m ())   -> m () assertMichelsonResult mRes1 mRes2 validatorRight = case (mRes1, mRes2) of   (Left err, Left e) -> annotate "expected failure" >> err === e-  (Left err, Right _) -> failedTest $ "should have failed with: " <> pretty err-  (Right _, Left e) -> failedTest $ "unexpected failure: " <> pretty e+  (Left err, Right _) -> annotate ("should have failed with: " <> pretty err) >> failure+  (Right _, Left e) -> annotate ("unexpected failure: " <> pretty e) >> failure   (Right val1, Right val2) -> validatorRight val1 val2 -noOptimizationContract :: ContractCode param st -> Contract param st-noOptimizationContract code = Contract-  { cCode = code-  , cDisableInitialCast = False-  , cCompilationOptions = noOptimizationOptions-  }+noOptimizationContract+  :: (NiceParameterFull param, NiceStorageFull st)+  => ContractCode param st -> Contract param st ()+noOptimizationContract = mkContractWith noOptimizationOptions  noOptimizationOptions :: CompilationOptions noOptimizationOptions = defaultCompilationOptions { coOptimizerConf = Nothing }++errorToMichelsonVal :: IsError e => e -> MichelsonFailureWithStack+errorToMichelsonVal msg =+  errorToVal msg (flip Interpret.MichelsonFailureWithStack def . MichelsonFailedWith)
test/Test/Util/Golden.hs view
@@ -1,13 +1,12 @@--- SPDX-FileCopyrightText: 2020 Tocqueville Group------ SPDX-License-Identifier: LicenseRef-MIT-TQ+-- SPDX-FileCopyrightText: 2022 Oxhead Alpha+-- SPDX-License-Identifier: LicenseRef-MIT-OA  -- | This module contains tasty ingredient used for regenerating -- Indigo golden test.  -- To regenerate the Michelson contracts for golden tests -- (without running the tests) execute:--- @stack test indigo --ta --regenerate@+-- @stack test indigo --ta --regenerate@ or @make test-regenerate@ module Test.Util.Golden   ( regenerateTests   ) where@@ -16,11 +15,11 @@ import Test.Tasty.Ingredients import Test.Tasty.Options +import Test.DebugComments import Test.Decomposition import Test.Examples import Test.Lambda import Test.Util-import Test.DebugComments  newtype RegenGoldenTests = RegenGoldenTests Bool   deriving newtype (Eq, Ord)@@ -57,12 +56,14 @@   saveToFile contractVarLorentz pathVar   saveToFile contractIfLorentz pathIf   saveToFile contractIfValueLorentz pathIfValue+  saveToFile contractWhenLorentz pathWhen   saveToFile contractIfRightLorentz pathIfRight   saveToFile contractIfConsLorentz pathIfCons   saveToFile contractCaseLorentz pathCase   saveToFile contractOpsLorentz pathOps   saveToFile contractAssertLorentz pathAssert   saveToFile contractUserCommentLorentz pathComment+  saveToFile contractSimpleEmitLorentz pathSimpleEmit    -- Lambda   saveToFile sumLambdaCalledOnce pathSumLambdaCalledOnce@@ -83,7 +84,7 @@  saveToFile   :: forall cp m st.-     (NiceParameterFull cp, NiceStorage st, MonadIO m, MonadMask m)+     (NiceParameterFull cp, NiceStorageFull st, MonadIO m, MonadMask m)   => ContractCode cp st -> FilePath   -> m () saveToFile ctr filePath = withFile filePath WriteMode $