Skip to content

Commit 2183d00

Browse files
Merge #970: Changes to Shorthands (& op precedence); ParserTests refactor
Walked into the `Shorthands` module. Main things: https://github.com/haskell-nix/hnix/blob/2021-07-09-changes/ChangeLog.md * fixed `mkAssert` * refactored `ParserTests`. * Added `@.<|>` operator that represents (previously unrepresentable by shorthands) feature of a language: `s.x or y`. * Established precedence between shorthand operators. This allows to write down the Haskell (pretty) directly to represent a one-to-one a Nix expression.
2 parents c159307 + bef95eb commit 2183d00

File tree

8 files changed

+1043
-511
lines changed

8 files changed

+1043
-511
lines changed

ChangeLog.md

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,37 @@
11

22
# ChangeLog
33

4-
## [(diff)](https://github.com/haskell-nix/hnix/compare/0.13.1...0.14.0#files_bucket) 0.14.0
4+
## [(diff)](https://github.com/haskell-nix/hnix/compare/0.14.0...0.15.0#files_bucket) 0.15.0
5+
6+
Partial log (for now):
7+
8+
* Breaking:
9+
10+
* `Nix.Expr.Shorthands`:
11+
* `inherit{,From}`: dropped second argument as irrelevant ([report](https://github.com/haskell-nix/hnix/issues/326)).
12+
* `mkAssert`: fixed ([report](https://github.com/haskell-nix/hnix/issues/969)).
13+
* fx presedence between the operators:
14+
15+
```haskell
16+
(@@), (@.), (@./), ($==), ($!=), ($<), ($<=), ($>), ($>=), ($&&), ($||), ($->), ($//), ($+), ($-), ($*), ($/), ($++), (==>)
17+
```
18+
19+
Now these shorthands can be used without sectioning & so represent the Nix expressions one to one.
20+
21+
```haskell
22+
nix = " a/b // c/def // <g> < def/d"
23+
hask = mkRelPath "a/b" $// mkRelPath "c/def" $// mkEnvPath "g" $< mkRelPath "def/d"
24+
```
25+
26+
* Additional
27+
* `Nix.Expr.Shorthands`:
28+
* `mkOper{,2}` entered deprecation, superceeded by new name `mkOp{,2}`.
29+
* `mkBinop` entered deprecation, supeceeded by new name `mkBinop`.
30+
* added `@.<|>` for Nix language `s.x or y` expession.
31+
* add `mkNeg` number negation.
32+
33+
34+
## [(diff)](https://github.com/haskell-nix/hnix/compare/0.13.1...0.14.0#files_bucket) 0.14.0 (2021-07-08)
535

636
* GHC 9.0 support.
737

src/Nix/Builtins.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -583,7 +583,7 @@ headNix :: forall e t f m. MonadNix e t f m => NValue t f m -> m (NValue t f m)
583583
headNix =
584584
maybe
585585
(throwError $ ErrorCall "builtins.head: empty list")
586-
(pure)
586+
pure
587587
. viaNonEmpty head <=< fromValue @[NValue t f m]
588588

589589
tailNix :: forall e t f m. MonadNix e t f m => NValue t f m -> m (NValue t f m)

0 commit comments

Comments
 (0)