Convert remaining playground examples to contracts - #17
Merged
Conversation
Y-Nak
approved these changes
Aug 20, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Similarly to #16, this PR updates all existing examples to use contracts and get rid of
wordtypes etchellomerged into the default example, renamed "Hello contract".std-usageis now a Calculator showing that a + b and Num.add(a, b) are the same trait call.traitis now a LightSwitch whose stored Switch enum is driven by the Toggle impl.genericsis replaced by a Registry: a where-constrained generic max working on a user-defined Version through its Eq/Ord impls.comptimeis now an Answer contract; comptime works, so no word needed.multi-fileretired: the option and mini NFT examples now demonstrate modules in realistic use.lambdaretired rather than converted. Flagging this one: closure application over runtime data currently fails Hull emission with SC0422: cannot lower closure dispatch in every shape tried, including higher-order functions taking lambda arguments. The previous example only compiled because all inputs were constants, so partial evaluation erased the closure before the backend ran; no e2e test exercises lambdas. The example should return once closure dispatch lowers to Hull.