Skip to content

Commit

Permalink
Add comment describing the mainFunctionWrapper
Browse files Browse the repository at this point in the history
  • Loading branch information
paulcadman committed Mar 28, 2024
1 parent f88c741 commit d39cc4e
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/Juvix/Compiler/Nockma/Translation/FromTree.hs
Original file line number Diff line number Diff line change
Expand Up @@ -304,6 +304,16 @@ anomaCallableClosureWrapper =

mainFunctionWrapper :: Term Natural
mainFunctionWrapper =
-- 1. The Anoma system expects to receive a function of type `ScryId -> Transaction`
--
-- 2. The ScryId is only used to construct the argument to the Scry operation (i.e the anomaGet builtin in the Juvix frontend),
--
-- 3. When the Juvix developer writes a function to submit to Anoma they use
-- type `() -> Transaction`, this wrapper is used to capture the ScryId
-- argument into the subject which is then used to construct OpScry arguments
-- when anomaGet is compiled.
--
-- 4. If the Anoma system expectation changes then this code must be changed.
let captureAnomaGetOrder :: Term Natural
captureAnomaGetOrder = replaceSubject $ \case
AnomaGetOrder -> Just (getClosureFieldInSubject ArgsTuple)
Expand Down

0 comments on commit d39cc4e

Please sign in to comment.