improve Types Not For Humans
This commit is contained in:
parent
57758098c6
commit
869b089bbb
1 changed files with 26 additions and 15 deletions
41
README.md
41
README.md
|
|
@ -23,6 +23,7 @@ Some of the sweet sweet batteries included:
|
||||||
3. **Pretty Printing** (no more `builtins.toString` errors)
|
3. **Pretty Printing** (no more `builtins.toString` errors)
|
||||||
4. **A Module System** (say goodbye to managing all your `imports`)
|
4. **A Module System** (say goodbye to managing all your `imports`)
|
||||||
5. **Types, Types, & More Types** (Maybe/Some/None, Monads, Tree, Rose, etc)
|
5. **Types, Types, & More Types** (Maybe/Some/None, Monads, Tree, Rose, etc)
|
||||||
|
6. **Support For Pipe Operators** (cleaner code with `<|` and `|>` )
|
||||||
|
|
||||||
## Types For Humans
|
## Types For Humans
|
||||||
|
|
||||||
|
|
@ -111,21 +112,31 @@ but coming back in a couple months you'd have to decipher your solution.
|
||||||
**NOW BEHOLD:**
|
**NOW BEHOLD:**
|
||||||
```nix
|
```nix
|
||||||
# nix made simple <3
|
# nix made simple <3
|
||||||
f = attrs:
|
let
|
||||||
attrs
|
inherit
|
||||||
|> nt.projectOnto
|
(nt)
|
||||||
{
|
projectOnto
|
||||||
a = {
|
missing
|
||||||
b = {
|
verify
|
||||||
c = null;
|
;
|
||||||
d = "hola";
|
in
|
||||||
|
{
|
||||||
|
f = attrs:
|
||||||
|
attrs
|
||||||
|
|> projectOnto
|
||||||
|
{
|
||||||
|
a = {
|
||||||
|
b = {
|
||||||
|
c = null;
|
||||||
|
d = "hola";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
e = {
|
||||||
|
f = required "error message...";
|
||||||
|
g = x: x;
|
||||||
|
h = null |> verify isString;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
e = {
|
|> ...; # your logic here...
|
||||||
f = nt.missing "error message...";
|
}
|
||||||
g = x: x;
|
|
||||||
h = nt.verify null isString;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|> ...; # your logic here...
|
|
||||||
```
|
```
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue