3Core Om types and operations for writing applications with dependency injection and checked exceptions.
5This is the base package that provides the `Om` type and all core operations. It works in both browser and Node.js environments.
10spago install yoga-om-core
15- **Om type**: The core monad transformer stack combining `ReaderT`, `ExceptV`, and `Aff`
16- **Error handling**: `throw`, `handleErrors`, `expand` for mix-and-match error types
17- **Dependency injection**: `ask`, `asks` for accessing context
18- **Parallel computations**: `race`, `inParallel` for concurrent operations
19- **Helpers**: `note`, `delay`, `unliftAff` and more
27myApp :: Om { dbUrl :: String } (dbError :: String) Unit
30 -- Your application logic here
35 { dbUrl: "postgresql://localhost" }
36 { exception: \e -> Console.error (show e)
37 , dbError: \err -> Console.error err
43### Context (Dependency Injection)
46getUser :: Om { db :: Database } _ User
49 -- Use db to fetch user
55saveUser :: Om _ (dbError :: String, validationError :: String) Unit
57 -- Can throw either dbError or validationError
58 Om.throw { validationError: "Invalid email" }
61### Parallel Operations
64fetchMultiple :: Om _ _ (Array User)
65fetchMultiple = Om.inParallel
74Tests are colocated with the implementation in the `test/` directory:
78cd packages/yoga-om-core && spago test
80# Or from workspace root
84See [test/Test/Om/Core.purs](./test/Test/Om/Core.purs) for comprehensive test examples.
92│ ├── Om.purs # Main Om implementation
94│ ├── Error.purs # Error types and helpers
95│ └── Error.js # FFI for error handling
96└── test/ # Tests colocated here!
98 ├── Main.purs # Test runner
100 └── Core.purs # Core Om tests (20 tests)
105- **[yoga-om-node](../yoga-om-node)** - Node.js-specific extensions
106- **[yoga-om-rom](../yoga-om-rom)** - Reactive Om: Bolson FRP integration (push-based)
107- **[yoga-om-strom](../yoga-om-strom)** - Stream Om: Pull-based streaming library
109For more examples, see the [main README](../../README.md) and [tests](./test/).
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list