1# Try the Error Messages!
51. Open `test/Playground.purs` in your editor
62. **Uncomment ONE example** (lines have `-- example1`, `-- example2`, etc.)
9 cd packages/yoga-om-layer
10 npx spago build -p yoga-om-layer
124. See the beautiful error message! ๐
16### Example 1: Missing Everything โ
19example1 :: Om (Record ()) () (Record (logger :: Logger))
20example1 = runLayer {} loggerLayer
24- First missing field: `"config"`
25- Required: `(config :: { ... })`
30### Example 2: Partial Context โ
33example2 :: Om (Record (logger :: Logger)) () (Record (cache :: Cache))
34example2 = runLayer { logger: { log: \_ -> pure unit } } cacheLayer
38- First missing field: `"database"`
39- Required: `(logger :: {...}, database :: {...})`
40- Provided: `(logger :: {...})`
42You can see `logger` โ
is there but `database` โ is missing!
46### Example 3: Multiple Missing โ
49combined :: OmLayer (config :: Config) (logger :: Logger, database :: Database) ()
50combined = combineRequirements loggerLayer databaseLayer
52example3 :: Om (Record ()) () (Record (logger :: Logger, database :: Database))
53example3 = runLayer {} combined
56**Error shows the full diff** with multiple missing dependencies!
60### Example 4: Success! โ
63example4 :: Om (Record (config :: Config)) () (Record (logger :: Logger))
64example4 = runLayer { config: { port: 5432, host: "localhost" } } loggerLayer
67**This one compiles!** No errors because all dependencies are satisfied.
73- Try uncommenting MULTIPLE examples at once to see different errors
74- Modify the type signatures to create your own error scenarios
75- Add more layers and combine them to see how deduplication works
76- Check out the test suite in `test/Test/Main.purs` for working examples
81# Run the full test suite
82cd packages/yoga-om-layer
85# Run negative error tests
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