⚠️ Experimental Project NoticeThis is an experimental project generated with AI assistance for learning and exploration purposes. It demonstrates concepts from rs-respo ported to Idris2, but is not production-ready and should not be used in real-world applications.
Idris2 implementation of Respo, a virtual DOM library with effects system. This is a port of the core ideas from rs-respo.
- 🌳 Virtual DOM with efficient diffing
- 🎯 Component-based architecture
- ⚡ Effect system (mount/unmount/update hooks)
- 🔄 Parameterized effects with change detection
- 🎨 Type-safe rendering
- Idris2 v0.8.0 or later
- Python 3 (for local development server)
idris2 --codegen javascript --build respo.ipkgidris2 --codegen javascript --build respo.ipkg
python3 -m http.server 8080Then open http://localhost:8080 in your browser.
src/
├── Respo.idr # Core VNode and component definitions
├── Respo/
│ ├── Dom.idr # DOM FFI primitives
│ ├── Diff.idr # Virtual DOM diffing
│ ├── Patcher.idr # DOM patching operations
│ ├── Effect.idr # Effect system
│ ├── EffectCollector.idr # Effect collection from VNode tree
│ └── StateTree.idr # State tree management
└── Example.idr # Demo application
# Build
idris2 --codegen javascript --build respo.ipkg
# Create distribution
mkdir -p dist
cp index.html dist/
cp build/exec/respo dist/respo.jsrsync -avzr --progress dist/* rsync-user@tiye.me:/web-assets/repo/Respo/idr-respo/Automated build and deployment is configured via GitHub Actions:
- Build and Deploy (
.github/workflows/build-and-deploy.yaml): Runs on push to main branch- Uses Docker container with Idris2 pre-installed
- Builds the project
- Deploys to remote server via rsync
Effects provide lifecycle hooks for components:
-- Simple effect
counterEffect : RespoEffect
counterEffect = effectMounted "counter-effect" $ \coord => do
log $ "Counter mounted at: " ++ coord
-- Parameterized effect with data
counterEffectWithCount : Int -> RespoEffectWithData Int
counterEffectWithCount n = effectMountedWith "counter-with-data" n $ \coord, count => do
log $ "Counter mounted with value: " ++ show count ++ " at: " ++ coordcomp "my-component"
[counterEffect] -- Effects
[todoEffect myTodo] -- Parameterized effects
(div [] [ -- Virtual DOM tree
h1 [] [text "Hello"],
button [("data-action", "click")] [text "Click me"]
])MIT