Commit 8b4ac72d authored by Oleg Grenrus's avatar Oleg Grenrus
Browse files

Fail if null components

parent 34eecf48
......@@ -87,10 +87,12 @@ fromString string = fromComponents (split string)
-- separated by dots.
fromComponents :: [String] -> ModuleName
fromComponents components'
| null components' = error zeroComponents
| all validModuleComponent components' = ModuleName (stlFromStrings components')
| otherwise = error badName
where
badName = "ModuleName.fromComponents: invalid components " ++ show components'
zeroComponents = "ModuleName.fromComponents: zero components"
badName = "ModuleName.fromComponents: invalid components " ++ show components'
-- | The module name @Main@.
--
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment