Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Prefer statically building constants.md #666

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

peter-mlabs
Copy link

No description provided.

@SeungheonOh
Copy link
Collaborator

Adding the idea of pre-evaluating terms using evalTerm would be nice

@peter-mlabs
Copy link
Author

Can't actually figure out how to do that...

ghci> compile (Config NoTracing) . fromRight' $ evalTerm (Config NoTracing) viacon

<interactive>:23:1: error: [GHC-91028]
     Couldn't match expected type ClosedTerm a0
                  with actual type b0
      Cannot instantiate unification variable b0
      with a type involving polytypes: ClosedTerm a0
     In the first argument of (.), namely
        compile (Config NoTracing)
      In the first argument of ($), namely
        compile (Config NoTracing) . fromRight'
      In the expression:
        compile (Config NoTracing) . fromRight'
          $ evalTerm (Config NoTracing) viacon

<interactive>:23:43: error: [GHC-91028]
     Couldn't match type b0
                     with (Either EvalError (ClosedTerm PScriptPurpose),
                            PlutusCore.Evaluation.Machine.ExBudget.ExBudget, [Text])
      Expected: Either Text b0
        Actual: Either
                  Text
                  (Either EvalError (ClosedTerm PScriptPurpose),
                   PlutusCore.Evaluation.Machine.ExBudget.ExBudget, [Text])
      Cannot instantiate unification variable b0
      with a type involving polytypes:
        (Either EvalError (ClosedTerm PScriptPurpose),
         PlutusCore.Evaluation.Machine.ExBudget.ExBudget, [Text])
     In the second argument of ($), namely
        evalTerm (Config NoTracing) viacon
      In the expression:
        compile (Config NoTracing) . fromRight'
          $ evalTerm (Config NoTracing) viacon
      In an equation for it’:
          it
            = compile (Config NoTracing) . fromRight'
                $ evalTerm (Config NoTracing) viacon

@SeungheonOh
Copy link
Collaborator

Type is little messy,

unsafeEvalTerm :: Config -> ClosedTerm a -> ClosedTerm a
unsafeEvalTerm c t = go $ evalterm c t
  let 
    go (Right (Right t', _, _)) = t'
    go _ = error "term evaluation failed"

@SeungheonOh
Copy link
Collaborator

Any idea why PR's not working..?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants