[Nix-dev] Would having a toBool function be nice or insane ?

Marc Weber marco-oweber at gmx.de
Mon Aug 18 07:52:15 CEST 2008


What do you think about introducing a 

lib.toBool = value : ! (value == false  || value == null || value == "")

function?

I'm not sure about the last  value == ""

It could be used in

mkDerivationOrBootScript = {
        enableFeature = lib.toBool config.[..]
        indstead of
        enableFeature = if config.[..] then true else false
}

Marc



More information about the nix-dev mailing list