formality-core-idioms

Guide idiomatic formality-core Rust patterns for constructors, coercions, and judgment_fn.

29|4|Updated Jul 20, 2021
One-click install
npx skills add https://github.com/dada-lang/dada-model --skill formality-core-idioms
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: formality-core-idioms
Source: https://github.com/dada-lang/dada-model/tree/main/.pi/skills/formality-core-idioms
Command: npx skills add https://github.com/dada-lang/dada-model --skill formality-core-idioms

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Idiomatic patterns for writing code with formality-core, focusing on generated constructors, Upcast/UpcastFrom coercions, judgment_fn patterns, and conventions for term-related enums and structs. This guidance helps reduce boilerplate, prevent subtle bugs, and improve readability in projects built on formality-core.

Core Features & Use Cases

  • Generated constructors for structs and enums enable clean, concise construction and automatic upcast handling.
  • Upcast/UpcastFrom coercions reduce manual conversions and cloning by accepting references where owned types are expected.
  • judgment_fn patterns guide safe rule definitions and structured conclusions within judgments.
  • Common pitfalls and best practices to ensure reliable type definitions and parser-related code in formality-core projects.

Quick Start

Apply these idioms when writing or reviewing formality-core code to ensure generated constructors, Upcast/UpcastFrom coercions, and judgment_fn patterns are used idiomatically.

Frequently Asked Questions about formality-core-idioms

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I reduce boilerplate when defining structs and enums in formality-core?

Generated constructors enable clean construction and automatic upcast handling for formality-core structs and enums, reducing manual boilerplate. Apply these idiomatic patterns when writing or reviewing type definitions to ensure safe and readable code.

What is the idiomatic way to handle type conversions with Upcast and UpcastFrom in Rust?

Idiomatic Upcast and UpcastFrom coercions reduce manual conversions and cloning by accepting references where owned types are expected. Using these patterns in formality-core prevents subtle bugs and improves code readability.

How do I write safe judgment functions using formality-core macros?

judgment_fn patterns guide safe rule definitions and structured conclusions within judgments in formality-core. Following these idiomatic macro patterns ensures reliable type definitions and parser-related code when writing or reviewing judgment functions.

What are common pitfalls when writing parser-related components in formality-core?

Common formality-core pitfalls involve mismanaging term-related enums and structs or bypassing Upcast coercions. Applying idiomatic patterns for generated constructors and judgment_fn usage prevents subtle bugs and ensures reliable parser-related code.

When should I apply formality-core idioms during code reviews?

Apply formality-core idioms during code reviews when evaluating generated constructors, Upcast/UpcastFrom coercions, and judgment_fn usage. This ensures term-related enums, structs, and parser components follow safe, concise conventions that prevent subtle bugs.

Does formality-core work with standard Rust macros for code generation?

formality-core relies on specific idiomatic macros like judgment_fn and generated constructors rather than standard Rust macros. Following these dedicated patterns ensures proper Upcast handling and safe type definitions in formality-core projects.