Use head instead of (!! 0)

This commit is contained in:
Joseph C. Sible 2020-04-05 16:16:12 -04:00
parent 2ebf522a52
commit 4604066c37
1 changed files with 1 additions and 1 deletions

View File

@ -798,7 +798,7 @@ getVariablesFromLiteralToken token =
prop_getVariablesFromLiteral1 = prop_getVariablesFromLiteral1 =
getVariablesFromLiteral "$foo${bar//a/b}$BAZ" == ["foo", "bar", "BAZ"] getVariablesFromLiteral "$foo${bar//a/b}$BAZ" == ["foo", "bar", "BAZ"]
getVariablesFromLiteral string = getVariablesFromLiteral string =
map (!! 0) $ matchAllSubgroups variableRegex string map head $ matchAllSubgroups variableRegex string
where where
variableRegex = mkRegex "\\$\\{?([A-Za-z0-9_]+)" variableRegex = mkRegex "\\$\\{?([A-Za-z0-9_]+)"