These examples demonstrate the type-driven AI code generation workflow.
01_basic - Basic Functions
Difficulty: ⭐ Beginner Concepts: Simple types, public/private, basic conversion
Learn the fundamental workflow:
- Write Idris2 with clear types
- Convert to Python with type hints
- Auto-generate tests
Best for: Getting started, understanding the basics
02_dependent_types - Dependent Types
Difficulty: ⭐⭐⭐ Advanced Concepts: Vect, Fin, type-level arithmetic, dependent types
See the full power:
- Compile-time guarantees → runtime checks
- Type constraints → comprehensive tests
- Matrix operations with dimension tracking
Best for: Understanding how dependent types work
- Start with
01_basic/- understand the workflow - Run both Idris2 and Python versions
- Compare outputs
- Study
02_dependent_types/SafeList.idr - Notice how types prevent bugs
- Read the generated tests
- Try breaking the code!
- Create your own example
- Use dependent types for your domain
- Generate code and tests
- Share your patterns!
Each example directory is self-contained:
cd examples/01_basic/
# Compile Idris2
idris2 -o func func.idr
./build/exec/func
# Run Python
python func.py
# Run tests
pytest test_func.py -v- ✅ Basic type-driven workflow
- ✅ Idris2 → Python conversion
- ✅ Simple test generation
- ✅ Dependent types (Vect, Fin)
- ✅ Type-level constraints
- ✅ Comprehensive test generation
- ✅ Property-based testing
- ✅ Runtime assertion generation
Want to add your own example? Use this structure:
examples/03_your_example/
├── README.md # Explain what it demonstrates
├── YourModule.idr # Idris2 source
├── your_module.py # Generated Python
└── test_your_module.py # Generated tests
Have a great example? Submit a PR with:
- Your Idris2 code
- Generated Python code
- Tests
- README explaining the concept
We especially want examples for:
- Web API validation
- Business logic with complex rules
- Data transformation pipelines
- Parser combinators
- State machines