From argument patterns to pattern matching
NixOS Discourse
From argument patterns to pattern matching
With |> already in use in Nix, I’ve been thinking about another small language extension. Nix already has partial functions at the argument-matching level: { a, ... }: ... accepts some arguments and rejects others. Adding just two trivial builtins would let us compose these into pattern matching. 1. builtins.functionDefinedAt: Ask whether a function accepts an argument Introduce builtins.functionDefinedAt f x, which checks the argument pattern without evaluating the body: functionDefinedAt ({...
0 comments
No comments yet.