3 ms·
> the "toGNUCommandLine" function would specify that it takes in a list of strings The problem is that `List<String>` isn't the correct type for that function'
by pansa2 6y ago
> the "toGNUCommandLine" function would specify that it takes in a list of strings
The problem is that `List<String>` isn't the correct type for that function's parameter. It converts each item in the list to a string by calling `mkValueStringDefault` [0], which takes an argument that's of any type except list, attrset or function.
So, the correct type for `toGNUCommandLine`'s parameter is something like `List<Any - {list, attrset, function}>`. Are there static type systems that make it easy to work with types like that?
[0] https://github.com/NixOS/nixpkgs/blob/9b935b02e3775d95490f6586b88857a006e05fe5/lib/generators.nix#L33 https://github.com/NixOS/nixpkgs/blob/9b935b02e3775d95490f65...
- Measter 6y ago> Are there static type systems that make it easy to work with types like that? In Rust things that can be rendered to a string (in a user-friendly manner) implement the Display trait. A slice of things that can be rendered would have this type: `&[&dyn Display]`.