[Nix-dev] isFloat

Игорь Пашев pashev.igor at gmail.com
Tue Dec 29 13:20:04 CET 2015


Is anybody needs floats in options :-)

  isFloat = x: isInt x ||
      ( isString x &&
        3 > length (splitString "." x) &&
        all (s: 2 == length (splitString s " 0123456789. "))
(stringToCharacters x)
      );

  float = mkOptionType {
    name = "float";
    check = isFloat;
  };


More information about the nix-dev mailing list