git.iko.soy/typeable/cabal2nix
on master help sign in
toNixName: de-capitalize the first character
5a9c71cPeter Simons
cabal2nix.hs+2−1
@@ -32,7 +32,8 @@ data Pkg = Pkg PkgName PkgVersion PkgSHA256 PkgURL PkgDescription PkgLicense Pkg
32 deriving (Show)
32 deriving (Show)
33
33
34toNixName :: String -> String
34toNixName :: 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)
36 where
37 where
37 f [] = []
38 f [] = []
38 f ('-':c:cs) | c `notElem` "-" = toUpper c : f cs
39 f ('-':c:cs) | c `notElem` "-" = toUpper c : f cs