I couldn't find this handy pipe-like operator:
val (|>) : 'a -> ('a -> 'b) -> 'b
Reverse-application operator:x |> f |> gis exactly equivalent tog (f (x)).
Example use case:
builtins.readDir "/dir" |> builtins.attrNames
instead of
buitins.attrNames (builtins.readDir "/dir")
The extensive haskell subcommunity in Nix will probably want $ too, if this goes in 馃槃
@copumpkin you mean https://github.com/NixOS/nix/issues/1845 ? :smile:
And before you know it, Nix will support Agda-style arbitrary mixfix operators 馃槃
nix-repl> let __div = x: y: y x; in
builtins.readDir "/etc" / builtins.attrNames / builtins.length
77
nix-repl> let __mul = x: y: if builtins.typeOf y != "lambda" then x y else z: x (y z); in
builtins.length * builtins.attrNames * builtins.readDir "/etc"
77
ans so on (https://github.com/NixOS/nix/issues/861)
Yes please!
Any progress?
No, there are no plans to add this.