Welcome to the Functional Programming Zulip Chat Archive. You can join the chat here.
Is there some nice way of composing functions, like the dot operator in Haskell, so I can avoid things like
modifier = drv: foo (bar (baz drv))
There's pipe in lib/trivial.nix, though I've never actually used it
pipe
lib/trivial.nix
https://github.com/NixOS/nixpkgs/blob/8252861507ef85b45f739c63f27d4e9a80b31b31/lib/trivial.nix#L32
You could also just inline something like
compose = f: g: x: f (g x); composeAll = builtins.foldl' compose id;
I can't even figure out how to pull in trivial.pipe..
trivial.pipe
@Magnus Therning Assuming you have pkgs or something in scope, I think you'd say pkgs.lib.pipe
pkgs
pkgs.lib.pipe
It's pretty new. You may not have it in your nixpkgs: https://github.com/NixOS/nixpkgs/commit/8252861507ef85b45f739c63f27d4e9a80b31b31
I managed to find it under pkgs.lib.trivial.
pkgs.lib.trivial
Is there some nice way of composing functions, like the dot operator in Haskell, so I can avoid things like
There's
pipe
inlib/trivial.nix
, though I've never actually used ithttps://github.com/NixOS/nixpkgs/blob/8252861507ef85b45f739c63f27d4e9a80b31b31/lib/trivial.nix#L32
You could also just inline something like
I can't even figure out how to pull in
trivial.pipe
..@Magnus Therning Assuming you have
pkgs
or something in scope, I think you'd saypkgs.lib.pipe
It's pretty new. You may not have it in your nixpkgs: https://github.com/NixOS/nixpkgs/commit/8252861507ef85b45f739c63f27d4e9a80b31b31
I managed to find it under
pkgs.lib.trivial
.