toNixName: de-capitalize the first character
commit5a9c71cdfc9eaab97a92b4fa7ef300b08cdd64d3
authorPeter Simons <simons@cryp.to>
dateFri 5 Aug 2011, 18:44 (15 years ago)
parent18333b6
cabal2nix.hs+2−1
@@ -32,7 +32,8 @@ data Pkg = Pkg PkgName PkgVersion PkgSHA256 PkgURL PkgDescription PkgLicense Pkg
3232 deriving (Show)
3333
3434toNixName :: String -> String
35−toNixName name = f name
35+toNixName [] = error "toNixName: empty string is not a valid argument"
36+toNixName name = f ((toLower (head name)) : tail name)
3637 where
3738 f [] = []
3839 f ('-':c:cs) | c `notElem` "-" = toUpper c : f cs