@@ -57,7 +57,7 @@ fromString string =
57 Left "You did not provide a project name (user/project)"
57 Left "You did not provide a project name (user/project)"
59 else if all (/='/') project then
59 else if all (/='/') project then
60− Name user <$> validate project
60+ Name user <$> validateProjectName project
63 Left "Expecting only one slash, separating the user and project name (user/project)"
63 Left "Expecting only one slash, separating the user and project name (user/project)"
@@ -66,14 +66,43 @@ fromString string =
66 Left "There should be a slash separating the user and project name (user/project)"
66 Left "There should be a slash separating the user and project name (user/project)"
69+whitelistedUppercaseName :: String -> Bool
70+whitelistedUppercaseName name =
71+ -- These packages were uploaded to package.elm-lang.org before version 0.16,
72+ -- when uppercase letters were disallowed in package names.
73+ -- They should be considered deprecated and removed from this list once users
74+ -- migrate to using the lowercase versions of the names.
78+ , "elm-MultiDimArray"
85+ , "Elm-Align-Distribute"
86+ , "Elm-Format-String"
88+ , "Elm-Random-Sampling"
69−validate :: String -> Either String String
95+validateProjectName :: String -> Either String String
70−validate str =
96+validateProjectName str =
71 if elem ('-','-') (zip str (tail str)) then
97 if elem ('-','-') (zip str (tail str)) then
72 Left "There is a double dash -- in your package name. It must be a single dash."
98 Left "There is a double dash -- in your package name. It must be a single dash."
74 else if elem '_' str then
100 else if elem '_' str then
75 Left "Underscores are not allowed in package names."
101 Left "Underscores are not allowed in package names."
103+ else if any Char.isUpper str && not (whitelistedUppercaseName str) then
104+ Left "Upper case characters are not allowed in package names."
77 else if not (Char.isLetter (head str)) then
106 else if not (Char.isLetter (head str)) then
78 Left "Package names must start with a letter."
107 Left "Package names must start with a letter."